ASP to improve the performance of a first-page skills

Source: Internet
Author: User
Tags relative
Brief introduction: General A Web site's first visit is the largest, if your site's home page open very slowly, your customers will be leaving your site. Often we cache data that requires complex operations or query databases, or generate static Web pages to improve the performance of Web applications. This time we directly cache the output of the first page into a string, and then updated regularly, that is, take care of the performance, but does not affect the timeliness of the home page. Here are some VBS custom classes, application objects, XMLHTTP objects, ADODB.stream objects, Relevant knowledge you can look up the information to understand.
It is best to let this page and you want to cache the page in a directory, or some relative path of the picture can not be displayed, and the other cached pages will appear garbled, I do not know how to solve this problem, may be in the response need to set the type of coding, we can try
<%
Dim Wawa,startime,endtime
Startime=timer ()
Set wawa=new Cls_cache
Wawa. reloadtime=0.5
Wawa. Cachename= "Wawa"
Wawa. Name= "Xmlinfoindex"
If Wawa. Objisempty () Then Cachexmlinfoindex ()
Response.Write Wawa.value
Endtime=timer ()
Response.Write "<br> Execution Time:" & FormatNumber ((endtime-startime) *1000,5) & "milliseconds. "
Sub Cachexmlinfoindex ()
Dim BodyText, XML
Set XML = Server.CreateObject ("Microsoft.XMLHTTP")
' Replace the following address with the address of your home page, be sure to use the absolute path beginning with http://, cannot write relative path
Xml. Open "Get", "http://onlytiancai/bak/vote/InfoIndex.asp", False
Xml. Send
Bodytext=xml. Responsebody
Bodytext=bytestobstr (BodyText, "gb2312")
Wawa. Value=bodytext
Set xml = Nothing
End Sub
Function Bytestobstr (Body,cset)
Dim objstream
Set objstream = Server.CreateObject ("ADODB.stream")
Objstream. Type = 1
Objstream. Mode =3
Objstream. Open
Objstream. Write body
Objstream. Position = 0
Objstream. Type = 2
Objstream. Charset = Cset
Bytestobstr = objstream. ReadText
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.