If we need to store some data in a database, but without the need of advanced SQL features, can we use this scheme (written here in Javascript / node.js) :
var myDb = {}; // the DB will be in RAM !
// serialize to disk every minute
setInterval(function() { fs.writeFile('./myDb.json', JSON.stringify(myDb)); }, 60 * 1000);
myDb['record1'] = 'foo';
myDb['record2'] = 'bar';
// ...
See the longer version here as a gist (8 lines of code).
1) Does this DB practice have a name? Is it really so bad?
2) Scalability: until which size would this system work without performance problems?
i.e. would it work until 2GB of data on a a normal Linux server with 4GB RAM? Or would there be real performance problems?
Note: a minute seems enough to write a 2GB data to disk... Of course I admit it is 100% non-optimized, we could add diff feature between n-1th and nth writing to disk...
3) Search: can I use ready-to-use tools to do some search in such a "simple" database? Lucene, ElasticSearch, Sphinx, etc. something else?
Aucun commentaire:
Enregistrer un commentaire