Buffering is sometimes used to render a web page to minimize the number of attempts to render HTML or data from code in ASP pages in the client browser, thereby increasing overall performance. TCP / IP is designed in such a way that it is more efficient to send data to the client in large chunks.
Necessary
HTML editor
Instructions
Step 1
The page becomes slower due to buffering - from what is sent to users only after final formation. Therefore, for pages that are generated by scripts for a very long time, you can disable buffering either completely or partially.
Step 2
Use the Response. Buffer = False command to completely disable buffering. This method will send data to the user immediately.
Step 3
Use the Response. Flush method. To partially disable buffering, you will need a more complex algorithm of actions, but it seems to be more preferable. It uses the Response. Flush method, which sends all the HTML accumulated in the buffer to the client.
Step 4
For example, after the generated first hundred rows of a table that has a total size of 1,000 rows, the ASP scripts call Response. Flush to send the first chunk of the page to the client browser. This approach allows the user to see that first hundred rows even before the entire table is ready. Moreover, it is possible to send it to the client in the same parts during the generation of a new line.
Step 5
Such work with the buffer is the most optimal, it achieves a tangible increase in the level of performance and the ability to load pages calculated over a long period of time in stages, without forcing visitors to the resource to wait for a long time in front of a clean browser window.
Step 6
Break the page down into building blocks. It is important to remember that some browsers do not support displaying parts of a table - they will wait for it to close. In this case, you need to simulate such a closure - for example, a large table can be split into one hundred lines, as described above. In this case, after the next sub-table is generated, it can be sent to users using the Response. Flush method.
Step 7
Apply the Flush method. In some cases, it is possible that the technology of partially disabling buffering consumes large amounts of server memory in the zone of generating very large pages. Without using the Flush method, it will not be possible to ensure the correct use of this technology and avoid unnecessary overuse of the system resource. The disadvantage of this method is the fact that for the user to display the table correctly on the screen, it is necessary to ensure the creation of columns of the same width in each of the sub-tables.