[JAVA-1306] Gridfs chunk size should be configurable during creation Created: 04/Jul/14  Updated: 03/Sep/15  Resolved: 02/Sep/15

Status: Closed
Project: Java Driver
Component/s: GridFS
Affects Version/s: 2.12.2
Fix Version/s: 3.1.0

Type: New Feature Priority: Major - P3
Reporter: Sukrit Khera Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Refer:
https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/gridfs/GridFSInputFile.java#L64

The _chunksize and the buffer parameter gets created using the default value frm GridFS which is 255k.

Though we can reconfigure the chunksize later using setChunkSize, however during creation 255k chunk of memory in Java program gets reserved which feels a little inefficient use of memory if we are going to resize chunksize later.

Ideally, I think we should be able to inject the chunksize during creation:
https://github.com/mongodb/mongo-java-driver/blob/master/src/main/com/mongodb/gridfs/GridFS.java#L381
as a parameter which can default to DEFAULT_CHUNKSIZE.



 Comments   
Comment by Ross Lawley [ 02/Sep/15 ]

Fixed in the new GridFS implementation JAVA-1713

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