You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Rishabh Daim (Jira)" <ji...@apache.org> on 2026/02/23 14:00:00 UTC
[jira] [Updated] (OAK-12106) MongoDocumentStore - improve calculation of document sizes
[ https://issues.apache.org/jira/browse/OAK-12106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rishabh Daim updated OAK-12106:
-------------------------------
Description:
For diagnostics after exceptions, we currently estimate the size in the VM.
However, there's an API in the Java driver what could be used:
Like:
{{ Document doc = new Document("text", "Hello ");}}
{{ BsonDocument bsonDoc = doc.toBsonDocument();}}
{{ RawBsonDocument raw = RawBsonDocument.parse(bsonDoc.toJson());}}
{{ int size = raw.getByteBuffer().remaining();}}
{{ System.out.println("BSON size: " + size + " bytes");}}
See : https://stackoverflow.com/questions/34545555/how-to-get-size-in-bytes-of-bson-documents
That would become more interesting should we try to back off with smaller batch sizes (OAK-12104).
was:
For diagnostics after exceptions, we currently estimate the size in the VM.
However, there's an API in the Java driver what could be used:
Like:
{{ Document doc = new Document("text", "Hello ");}}
{{ BsonDocument bsonDoc = doc.toBsonDocument();}}
{{ int size = bsonDoc.getByteBuffer().remaining();}}
{{ System.out.println("BSON size: " + size + " bytes");}}
That would become more interesting should we try to back off with smaller batch sizes (OAK-12104).
> MongoDocumentStore - improve calculation of document sizes
> ----------------------------------------------------------
>
> Key: OAK-12106
> URL: https://issues.apache.org/jira/browse/OAK-12106
> Project: Jackrabbit Oak
> Issue Type: Task
> Components: documentmk
> Reporter: Julian Reschke
> Priority: Major
>
> For diagnostics after exceptions, we currently estimate the size in the VM.
> However, there's an API in the Java driver what could be used:
> Like:
> {{ Document doc = new Document("text", "Hello ");}}
> {{ BsonDocument bsonDoc = doc.toBsonDocument();}}
> {{ RawBsonDocument raw = RawBsonDocument.parse(bsonDoc.toJson());}}
> {{ int size = raw.getByteBuffer().remaining();}}
> {{ System.out.println("BSON size: " + size + " bytes");}}
> See : https://stackoverflow.com/questions/34545555/how-to-get-size-in-bytes-of-bson-documents
> That would become more interesting should we try to back off with smaller batch sizes (OAK-12104).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)