MongoDB performance, is my performance expected?
My MongoDB server that I've just setup can handle about 2,500 writes per second, is this an acceptable rate? If not what is? What are your systems running at? What steps would you take to improve this?
To add a bit of detail, my objects were small, actually only a single 5 character string, written one by one with a small ruby script.
So as for servers I'm using Amazon EC2, and just a small little ruby script like:
task :test => :environment do |t, args|
start_time = Time.now
1000000.times do
Item.create({:name => "#{Digest::SHA1.hexdigest("#{Time.now.to_i}-#{rand}")}"})
end
puts Time.now - start_time
end
But even when running both database and app on my local machine I get simi开发者_运维问答lar performance.
Well, 2500 writes/second is nothing - especially not with 5-byte strings. Decent hardware reaches up to 50k to 100k writes/second for typical small documents. If your system only reaches this performance then you are using either old hardware or having other issues.
2500*5 = 12.5KB / seconds...sorry but every database should be faster....provide additional information about your setup etc..or your data processing/code is so slow for whatever so it can not saturate the database.
As said: MongoDB out of the box on commodity hardware is fast.
精彩评论