general questions about using mongodb -
general questions about using mongodb -
i'm thinking trying mongodb utilize storing our stats have general questions whether i'm understanding correctly before start learning it.
i understand concept of using documents, i'm not clear how much info can stored within each document. next diagram explains layout i'm thinking of:
website (document) - keys/values particular document - statistics (tree) - millions of rows each record inserted pageview (key/value array containing info such timestamp, ip, browser, etc)
what got me excited mongodb grouping functions such as: http://www.mongodb.org/display/docs/aggregation
db.test.group( { cond: {"invoked_at.d": {$gte: "2009-11", $lt: "2009-12"}} , key: {http_action: true} , initial: {count: 0, total_time:0} , reduce: function(doc, out){ out.count++; out.total_time+=doc.response_time } , finalize: function(out){ out.avg_time = out.total_time / out.count } } );
but main concern how hard command illustration on server if there 10's of millions of records across dozens of documents on 512-1gb ram server on rackspace example? still run low load?
is there limit number of documents mongodb can have (seperate databases)? also, there limit number of records in tree explained above? also, query showed above run instantly or sort of map/reduce query? not sure if can execute upon page load in our command panel stats instantly.
thanks!
every document has size limit of 4mb (which in text lot).
it's recommended run mongodb in replication mode or utilize sharding otherwise have problems single-server durability. single-server durability not given because mongodb fsync's disk every 60 seconds, if server goes downwards between 2 fsync's info got inserted/updated in time lost.
there no limit of documents other disk space in mongodb.
you should seek import dataset matches info (or generate test data) mongodb , analyse how fast query executes. remember set indexes on fields utilize heavily in queries. above query should work pretty lot of data.
in order analyze speed of query utilize database profiler mongodb comes with. on mongo shell do:
db.setprofilinglevel(2); // set profiling level [your query] db.system.profile.find(); // see results
remember turn off profiling 1 time you're finished (log pretty huge otherwise).
regarding database layout suggest alter "schema" (yeah yeah, schema less..) to:
website (collection): - keys/values particular document
statistics (collection) - millions of rows each record inserted pageview (key/value array containing info such timestamp, ip, browser, etc) + dbref website
see database references
mongodb
Comments
Post a Comment