|
Web Site Optimization Techniques |
|
See Also: |
Dynamic pages with no cacheable content can be optimized, but it is usually much more work to optimize and maintain them, compared to the other optimization techniques.
Completely dynamic pages are pages with no cacheable content - they are highly volatile or transactional in nature. Examples include stock portfolios and airline reservation systems.
Dynamic content is often valuable - personalized views and transactions can improve the user experience and stickiness of the web site.
At the same time, dynamic content can often be combined with cacheable content to further improve the user experience - for example, in a stock portfolio site, financial headlines and market movers can be displayed to all users using page fragment caching.
The primary disadvantage of dynamic content is that it puts a heavy load on the web server and can be difficult to optimize, particularly compared to the ease of optimization using static page generation and two-phase content generation.
Note: APGen cannot be used to optimize pages that are completely dynamic. However, data caching with ASPCache may be useful.
If web hosting cost is an issue, it is often desirable to save the web server CPUs for important transactional load, like purchasing. This means optimizing other pages as much as possible, so the load of shoppers browsing the store doesn't impair customers trying to make purchases.
When pages must be completely dynamic, they can be optimized by making database access more efficient, making page code more efficient, and performance testing while trying different optimizations. This can involve quite a bit of work, testing, and analysis.
A key point is to test optimization techniques before putting any effort into modifying an existing site. This seems obvious, but much effort has been wasted changing web sites to see little or negative impact on performance.
When optimizing dynamic pages, always try to identify the biggest bottlenecks, and work to optimize those. If you optimize a certain operation within a page and make it 50% faster, the optimization may not have a noticeable effect on overall page performance. If this occurs, it simply means the improved operation isn't a significant bottleneck.
If a dynamic page needs to be very high performance, write an ISAPI filter or extension. ISAPI extensions usually don't perform as well as static pages, so use static pages if the content is not very volatile. ISAPI filters and extensions can be difficult to write and debug and they don't have any of the ASP intrinsic objects, so everything must be written by hand in C or C++. ISAPI filters should only do very simple types of processing, since they are called for every HTTP Request. Badly written filters can negatively impact your entire site. If an ISAPI extension performs any sort of time-consuming work (such as a database query), a thread pool mechanism should be implemented and the request should be handled on a thread from the pool. Synchronization and threading issues must be dealt with, which can be difficult and frustrating even for experienced developers.