Ask HN: Why all websites are not statically generated?
Don't statically generated sites save a lot of computational resources?
Don't statically generated sites save a lot of computational resources?
A lot of websites are powered by WordPress. Most of the users who run those sites don't even know the difference between Static and Dynamic (I explain this all the time to clients). They don't care. They just want their website to work.
I have thought, recently, about the possible utility of a dynamic-site generator for things like CMS or even ERP. Imagine you are designing an open source ERP to be customized for different companies. Instead of having sensible tables like "customers", "products", "orders", etc., you have these weird higher-level "table" tables to allow different users to customize their own schemas.
Maybe what you could do to simplify this is create a generator that spits out dynamic sites without the overly abstract data model...
With a dynamic generator, you might maintain a cache of the latest articles somewhere, and stitch it into another cached copy of the newspaper section chrome, and then insert the content. It might be more CPU in total, but the changes are live faster, and the total disk I/O would be much lower.
Also, you'd need more disk space with a static generator.
For most simple sites and blogs, there's no real resource use regenerating the entire site, so you get all the benefits of the static generator, and almost none of the drawbacks.
When there is no dynamic content, using a static site tends to make the most sense. For example, a WordPress site with no moving parts (i.e. no comments) can be easily converted into a purely static site, though adding a cache in front achieves basically the same result.
Things get more complicated when a site or app needs dynamic content. Using API calls, the server doesn't need to generate the HTML every time, but performance-wise, you would also need to factor in the additional round-trips performed to fetch the data.
In the instance where data changes rarely, static output can be cached, but you still need a way to generate the output dynamically.
Now... when should the cache expire?
I guess the dynamic page generators are simpler.
You need to change a lot of the static generators for custom solutions. A lot of tinkering is involved.