: Is static HTML the fastest? I have been researching several different techniques to deliver web content fast, like nginx and node.js. When it comes down to performance optimization http expires
I have been researching several different techniques to deliver web content fast, like nginx and node.js.
When it comes down to performance optimization http expires headers and gzip come to mind. After that come common techniques like sprites and CDNs etc.
But I am wondering.
What would be the very fastest technique to load a website?
Is static html the very fastest that can be? Or is there something else even faster?
More posts by @Kaufman445
2 Comments
Sorted by latest first Latest Oldest Best
The speed at which webservers deliver pages usually depends on how quickly they can pull the data together from where it is stored. Here are the places that data for a website is usually stored from fastest to slowest.
In memory
On disk
In a network cache
In a database
So even when you are talking about static files on disk, it would be faster to have the files loaded into memory. In fact, that is going to be the biggest difference between webservers that serve static files: How much memory they allocate to caching static files and how often they have to check to see if they have changed.
One you get enough static files, they can't all be cached in memory. At that point, a dynamically generated site can be made faster than static. Your dynamic site can cache the header and footer of each page (which are duplicated across your entire site) just once and have more room to cache other page contents in memory.
If you have the need to use a database for your website, then you should do so. Site speed can be optimized by caching data from the database and only looking it up when it has changed. In other words, dynamic sites can be made to be as fast as static sites (but it takes implementation and testing).
It depends on your definition of fastest. If you measure the time it takes for one page to completely render, then, yes, static HTML with embedded resources would be the fastest when fully optimized:
Deliver with compression (Gzip/Deflate).
Minimize code, avoid white-space, use the minimum tags and properties needed.
Spread resources across cookie-less domains.
Minimize resources, CSS and Javascript.
If you measure the time to the page starting to render, then you would deliver the minimal HTML and resources, possibly inlining CSS, and then use AJAX to obtain anything that is not visible to the user at the start.
On the server-side anything that is not HTML needs to processed into HTML, so inherently all those technologies such as PHP/Django/etc can never be faster than static HTML. Of course, with proper caching, they can be equally fast when the cache is hit, since it basically would deliver static HTML.
Reality is that there are far too many variables to have one thing being the fastest in all cases. You have to consider network and browsers too. Most allow up to 4 connections to a single host, so you can parallelize by having resources spread across hosts up to however many hosts can be accessed simultaneously and as long as your page is not constructed to force the serialization of requests.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.