[JAVA-2028] The GridFS chunk size is wrong Created: 05/Nov/15  Updated: 12/Nov/15  Resolved: 06/Nov/15

Status: Closed
Project: Java Driver
Component/s: GridFS
Affects Version/s: 3.1.0
Fix Version/s: 3.1.1, 3.2.0

Type: Bug Priority: Critical - P2
Reporter: Rick Rupp Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux


Issue Links:
Duplicate

 Description   

The default chunk size in GridFSBucketImpl is 255 bytes not 255k bytes as documented in the GridFS manual (https://docs.mongodb.org/manual/core/gridfs/). This causes a severe performance penalty when uploading medium sized files. As an example uploading a ~32MB file using 255 byte chunks can take +30 minutes while using 255k bytes blocks takes several seconds.



 Comments   
Comment by Jeffrey Yemin [ 12/Nov/15 ]

Closing for 3.1.1 release.

Comment by Rick Rupp [ 06/Nov/15 ]

Thanks Ross. It's as if you were looking at my code.

Comment by Githook User [ 06/Nov/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: GridFS fix default chunk size

JAVA-2028
Branch: 3.1.x
https://github.com/mongodb/mongo-java-driver/commit/323189070ef1d43269ea527adc785188982701a7

Comment by Githook User [ 06/Nov/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: GridFS fix default chunk size

JAVA-2028
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e02b9aba11ed2e05214daae2f9314fb395352bc9

Comment by Ross Lawley [ 06/Nov/15 ]

Hi rerupp,

Thanks for the ticket - that is a bug and an oversight. Whilst a fix is pending, please use the following code to set the correct chunkSize:

GridFSBucket gridFSBucket = GridFSBuckets.create(database).withChunkSizeBytes(255 * 1024);

Generated at Thu Feb 08 08:56:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.