5 ms·
It's really weird to have to write on every request. If you're logging user visits for example, you can queue those up in a list (in the code) and flush it to
by hasenj 9y ago
It's really weird to have to write on every request.
If you're logging user visits for example, you can queue those up in a list (in the code) and flush it to the database every few seconds instead of flushing it on every visit.
- dotancohen 9y ago> queue those up in a list (in the code) That won't work in the language that most server-side website code is written in. PHP processes are created and destroyed per HTTP request, and even the FastCGI implementation won't let one share data across requests. PHP does have a sessions feature, but that data is written to either the filesystem (by default) or a database on every request!
- hasenj 9y agoYes but if you use SQLite because you value minimalism you would also choose a language that compiles the server to a statically linked binary, e.g. Go, in which case this is a trivial "optimization" to do (if you would even call it that).
- Can_Not 9y agoI've ran sites in the ~500 users per day category where MySQL and postgre use nearly nothing in resources while user interaction causes complex transactions and competing row-level locks. Sounds pretty minimal to me. Odd though that someone who values golang would want to use DB with a poor reputation for concurrency.
- SteveNuts 9y agoJust add Kafka in between
- masklinn 9y agoSo you avoid just using a "real" db by adding half a dozen different pieces of software to paper over your "not db" replacement?
- orthecreedence 9y agoExactly. When my 10 visitors a day start writing too many comments, I usually jump to containerizing everything, deploying kubernetes, and installing a queuing system w/ workers to handle the load. A zookeeper cluster with Kakfa could definitely work too, and has the added benefit that you can replay history if your SQLite comment database ever got corrupted. I just don't understand why people can't see the logic behind using something operationally simple like SQLite.
- marklgr 9y agoIt's pretty common to write session data in memory eg. memcache/redis.
- hasenj 9y agoRedis is yet another dependency that you can certainly do without.