Dynamic versus static web pages optimization

The choice between static and dynamic when building software for the web is a critical one, and one that I think deserves in-depth discussion.

In a dynamic site, pages are assembled “on the fly” as and when they are requested. Most server side languages as PHP, JSP and ASP powered sites do this technology by actively encourages dynamic content creation. Generating pages dynamically allows for all sorts of clever applications, from e-commerce, random quote generators to full on web applications such as Hotmail.

In a static publishing system, HTML pages are pre-generated by the publishing software and stored as flat files on the web server, ready to be served. This approach is less flexible than dynamic generation in many ways and is often ignored as an option as a result, but in fact the vast majority of content sites consist of primarily static pages and could be powered by static content generation without any loss of functionality to the end user. See this static web page generation diagram:


The most widespread example of a static publishing system is D2S, which rebuilds static files for a site each time a page is added or modified – although it can be configured to serve content dynamically instead.

Benefits of dynamic publishing

At first glance, the benefits of dynamic publishing are obvious. What is frequently ignored are the benefits of static publishing, at least for content-driven sites which don’t have any heavy need for dynamic features. The most obvious benefit is performance; serving static files is what web servers such as Apache are optimised to do, and they can do it fast.

The reliability advantage

A big part is that it takes the pressure off of going live. You can be sure before going live that the published website is correct. The actual CMS may explode in flames, but the site will be fine. Going live with a web application is always a stressful process, and anything that reduces the stress of that is a great benefit. As time goes on, static publishing is also a big stress reduction for the system administrator, since a simple Apache configuration is a lot more reliable under different loads and configurations than any dynamic site will be.

Performance issues

Static site will increase the performance of any website or online application. Static pages will have a €˜circular’ effect on speed: static pages will take up less load time; less load time will allow for better performance under stress, and better performance will reduce the server stress and give the user faster downloads. Note, though, that accessibility should always have a higher priority than performance.

Static over dynamic – Conclusion

Not everything needs to be dynamically created. If there are pieces of information that have quite a long dynamic cycle, embed them statically, but perhaps allow for new items to be re-embedded easily, through a pseudo-dynamic process.


WordPress Video Lightbox