GridFS performance/benchmarking

585 views
Skip to first unread message

Mike Atkins

unread,
Sep 19, 2011, 5:20:09 PM9/19/11
to mongod...@googlegroups.com
I've been trying to determine what kind of write performance I can expect from GridFS using the java driver. I had hoped that write performance would be only slightly worse than writing directly to the underlying filesystem. Unfortunately this is not the case so far. I am seeing writes that are 5 to 50 times slower. I've heard that others have had better performance. I'd love to know what I should expect and how people have benchmarked this type of thing.

some details on my setup:
OS: centos 5.6 running and Amazon EC2, with EBS storage.

I'm comparing the time required to do the following:

GridFSInputFile gridFile = grid.createFile(byteArray);

gridFile.setFilename(fileName);

gridFile.save();

with the time required to do this:


File file = new File("/ebs/uploads/"+fileName);

FileOutputStream fileOutputStream = new FileOutputStream(file);

fileOutputStream.write(byteArray);

fileOutputStream.close();

Thanks!

-Mike

Antoine Girbal

unread,
Sep 19, 2011, 7:18:55 PM9/19/11
to mongodb-user
Hi Mike,
So in the case of GridFS, your client has to go through a socket to
send it to mongod which then writes it to disk.
In the 2nd case you are just writing the byte array directly to a
file.
For a better comparison you should compare writing the file from a
different server as the client, for example compare GridFS with scp.
Also you may want to consider if the speed is already "fast enough" in
that it will not be the bottleneck for your application.
If you think it's still too slow, could you give some numbers?
AG

Mike Atkins

unread,
Sep 20, 2011, 11:07:41 AM9/20/11
to mongod...@googlegroups.com
Antoine-

It is not so much that I think it is too slow, I was just surprised by how much slower it appears to be, given what I had heard from others. You are correct, that it may in fact be fast enough for our needs. I am still evaluating it so as to make such a determination. As to comparing with scp or similar, that wouldn't really be relevant to our use case, so I'll leave that to others. 

Thanks!
-Mike

James Gosnell

unread,
Sep 23, 2011, 11:23:47 PM9/23/11
to mongodb-user
I've been getting extremely low write performance as well, compared to
a sequential write to a drive. My 1000MB/sec RAID is only writing at
1.2MB/sec using a simple bulk_insert PERL script. And no, it's not CPU
bound.

Antoine Girbal

unread,
Sep 24, 2011, 1:36:36 PM9/24/11
to mongodb-user
When you say bulk insert, you mean not using gridfs this time, just
regular docs?
A few things that can influence speed a lot:
- journaling. This could drop write perf by 30% or more. If you use
mongo 2.0, you can turn off with --nojournal
- safe writes. If turned on, the client will wait for acknowledgment
from db for each operation. Turning it off can greatly improve perf.
- the driver itself. Not sure about the perf of the PERL driver. You
may want to test with other driver.
Reply all
Reply to author
Forward
0 new messages