Ask HN: Why do web frameworks always use database?
* All those database lookups are going to be slow
* All your data is locked up in a binary file
* How do you update your site? It doesn't seem like you can easily merge two databases, or update just the change deltas.
Instead, if all the content lives in separate files with other files telling how to put it together, then you can use a compiler (of sorts) to generate the site as a bunch of static pages for the site. The advantages would seem to be:
* Fast to serve content
* Easy to redesign (edit files, re-run `make` on the static pages)
* Easy to update the server: cvs update -d -P; make
* If there is user content, CGI could add files (assuming availability of locking). Then a backup would be as simple as `cvs commit`.
* Rolling back after an update gone bad would be easy.
The drawbacks seem to be minimal:
* Requires extra disk space (cheap)
* CPU-intensive to change site layout (infrequent)
* CPU-intensive to add content (presumably rarer than reading content, which is fast)
So am I missing something? Why are databases so popular, given that they seem to be slower, and harder to update/backup?
[Edit: slightly better formatting]
6 comments
[ 0.25 ms ] story [ 18.8 ms ] threadLook into Movable Type (http://movabletype.com/). It is written in Perl and it writes static html files. I did the redesign of http://www.steves-digicams.com/ in Movable Type 4.23 and there are over 12,000 pages. Movable Type generates the static files at publish time in about as much time as Wordpress takes.
A big advantage of using static files on Steve's Digicams is that it is very easy to replicate across a load-balanced network of servers without the hassle of having to load-balance MySQL with a master-slave configuration.