News for hackers. Stuff that matters.
Re:What are the best non-database solutions you've seen? Wha... by jey on Thursday April 19, 2007 @12:36PM (#14660)
I fully agree with what pg said about keeping everything you can in in-memory structures. You can save modifications to a sequential logfile, or some other simple on-disk structure that is easily maintained (e.g. separate file per record), and read this structure into memory when you restart. Once that becomes infeasible, I would switch to using SQLite's BTrees [1] directly and bypassing the entire SQL layer. Using the SQL layer is just pretty pointless and a waste of resources. You're going to have a "data access layer" over your database anyway, so why not have it operate on a level where you have precise control over the access patterns and can tune it for your application? If you use the SQL layer, you're basically losing all that information by having your data access layer transform your operations into a high level data manipulation language by building a string (eww), then you leave the SQL layer of the database engine to parse your string back to something sensible and have it guess at how to optimize the query to get the best performance. Instead just tell it directly and skip the whole string construction, string parsing, and query analysis crap.

Notes

1. I'd suggest BDB, but it seems to suck. YMMV, always benchmark it yourself.

Re:What are the best non-database solutions you've seen? Wha... by evgen on Friday April 20, 2007 @12:24AM (#14943)
I would second the suggestion to try SQLite first (or give metakit a glance if you want something that lets you iterate over a table quickly) and concur with staying as far away from BDB as is possible...

The other advantage that using memory/fs has over a RDBMS for most simple applications is that unless you are doing complicated joins you will keep things simple and avoid introducing an additional layer of complexity and point of failure into your app.

Re:What are the best non-database solutions you've seen? Wha... by anupamkapoor on Friday April 20, 2007 @01:50AM (#14964)
may you please explain why BDB sucks ? thanks !
Re:What are the best non-database solutions you've seen? Wha... by ralph on Saturday April 21, 2007 @07:24AM (#15445)
Seconded, please explain. I don't have a view but was wondering about using Berkeley DB, including its replication, to have the web server running on each machine, with the BDB library linked in. Each machine would be a web server but also one of the replication group, with one master and many replicas. Writes go to the master, reads can be shared around the replicas.

BDB seems pretty flexible in policy decisions, e.g. the master can say the commit is complete when it hears back from N replicas depite not having written to disc itself yet.