Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: IIS5
Expertise: Beginner
May 15, 2001

Put buffering and Response.Flush to good use

IIS5 enables buffering by default, therefore all the output from your ASP is actually sent to the browser only when the page completes its processing. In many cases this approach improves the overall processing speed, and indirectly makes for a more scalable site. However, buffering has two minor defects: (1) the end user might perceive a loss in speed, because she won't see any output until the page is complete, and (2) buffered output has to be maintained on the server, therefore your ASP application is going to take more memory than it would do if buffering were disabled. On server machines with an inadequate amount of memory, large HTML pages can reduce the overall performance.

Fortunately, you can solve both problems with judicious use of the Response.Flush method, that lets you flush the output buffer periodically when sending a large amount of data back to the client. For example, if you are sending back to the client data from thousands of records, you might flush the buffer every 100 records, so that the end user sees some results earlier and you don't tax the server's memory.

Note, however, that you must take special precautions when your output is an HTML table, because many browsers won't render the table until the closing </TABLE> is received. For more info, see the link below.

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date