BSON Parsing very slow in nested array #343
Unanswered
C3po-D2rd2
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
We are benchmarking MongoDB against PSQL in order to migrate our 40T data base to Mongo. Unfortunatly we are not able to reach the same level of performances and it seems that it is due to BSON parsing of the answer from MongoDB.
We used an extract of DB to benchmark, so only 734M of documents, each record are looking like that:
{ id: string, group_id: string, value: decimal, pressures: [{type: string, value: decimal}], impacys: [{type: string, value: decimal}] }
As you can see we have two array of object nested in our record.
In our Benchmark let's say we are retrieving data by group_id. each group_id should have between 3K to 5K records.
here is the performance results:
Mongo is very efficient to retrieve the data (see DB time) but CPU is high. We try excluding array or only arrays and we realised that they were considerably slowing down the process. Using MongoBSON our self allowed us to divide by 2 the performance issue (excluding mongoid ORM from the solution) yet we are still far from the 250ms we have we psql (VS 478ms with MongoBSON).
Digging still, we understood that half of the time spent was in MongoBSON parsing which disappear if we only retrieve id and quantity.
we are trying to split the pressures and impacts in different "table" but I am very surprised of this issue. May be we are not doing something right. Can anyone help us on this matter?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions