Response. Buffer

Source: Internet
Author: User

I don't know how much you know about Buffer. Many people are vague about this concept, especially in asp. Many beginners rarely use this statement when writing asp programs. Next I will talk about the usage of Buffer and Its Role in asp programs.

I. Buffer

Buffer is called a Buffer, because it is not only a noun, but also a verb.

The buffer zone stores a series of data. The data obtained by the client can be directly output from the execution results of the program or the buffer zone. However, the two methods differ in speed: in the web, when an asp program is requested for a small number of times, there is basically no difference between the two, at least we do not feel it. However, when many people request an asp program, the speed may be different. If there is no buffer, the result obtained by the client of each person requesting the asp program is the result obtained by executing the asp program once. If the asp program is buffered in advance, the result obtained by each client is the result of the buffer, not the result of executing a program. For example, if 1000 users access an asp page at the same time, if the asp program is not buffered, the program will be executed one thousand times, so that the server load will increase, this slows down the page opening speed of the client. If the asp program is buffered, the results will be different. Each client obtains data directly from the buffer zone, the server will not increase the number of program executions because of the increase in access, so the client can open the page faster than in the previous case. This is the benefit of Buffer.

Ii. How to buffer asp programs

This problem is actually very simple, as long as the first line of the asp program is added:

<% Response. Buffer = True %>

You can.

This statement indicates whether the output page is buffered. When the attribute value is True, the server will not send any information to the client until all programs are executed or

<% Response. Flush %> or <% Response. End %>

Statement to release the buffer information.

Application: improve user experience

In this way, when we run a program that requires complex operations or a large number of cycles, we can use <% Response. flush %> outputs the buffer information while running to reduce user waiting time. enhance user experience.

Iii. Summary

Although the Buffer attribute of Response can increase the page display speed, what should be done. If you are creating an ordinary personal homepage with a low access volume and no complicated execution programs, it is not very important to use this attribute, it takes some time to buffer data, but we don't feel it. But if you are creating a large forum or a product demonstration or other business site, and the traffic is high, so I suggest adding

<% Response. Buffer = True %>

In this case, the customer can obtain more data within the effective time.

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.