-
-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add skip conform to schema #1572
base: main
Are you sure you want to change the base?
Add skip conform to schema #1572
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. |
This pull request is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 3 days. |
Hi, any chance for this or something similar to get merged soon? 🙂 |
@nopol10 & @vasily-polonsky I'm debating this one a lot. I get the performance benefit. But I then question what the value is in Dynamoose. The whole idea of Dynamoose is to have strict schemas for your DynamoDB data. I'm curious if either of you could explain why with this PR you still choose Dynamoose over numerous other options out there? It seems like this is getting rid of a huge benefit and purpose of Dynamoose. So I'm curious about your thoughts and how you are viewing that. Regardless, this PR needs unit tests. |
Hi @fishcharlie Regarding the |
Yup, as @vasily-polonsky says, there are cases where I am certain that the schema will be correct so I will not be worried about non-conformance. In addition, dynamoose provides an API that makes dynamodb related code easier to write and maintain so I'll like to have retain that if possible with a small code change rather than rewriting the query to use the dynamodb ask directly. |
hi, @fishcharlie it has been a while since this PR is opened. Sadly, i think i got this issue too. |
This can't be merged until unit tests are added. |
Summary:
The library shows poor performance when you need to query a large number of items from the database, especially if they have a nested structure. This is especially true for serverless, where the environment is not a cluster/EC2 instance and the CPU is usually limited. For example, during development on a local machine the operation of scanning 250 items with dynamoose takes about 3 seconds, in a lambda with 0.1 vCPU it takes over 30 seconds. This makes it not possible to use on production. Using aws-sdk it takes 600ms for the same requests in both environments (local and serverless).
The problem is that dynamoose consumes huge CPU resources during the
confromToSchema
method call, so the solution I propose is to make it possible to skip this method call during large queries where a large number of items must be returned. Mongoose has a solution to this problem with lean.Lean
works a little differently, but the idea is the same - make it possible to handle a large number of items with less performance degradation. Meanwhile, I think theconfromToSchema
method itself needs to be refactored.I haven't written documentation for the
skipConformToSchema
method, because I think we should first agree on the name and whether it's appropriate to introduce this method.GitHub linked issue:
#1260
https://stackoverflow.com/questions/74356120/slow-on-fetching-records-from-dynamodb-table
#----
Other information:
Type (select 1):
Is this a breaking change? (select 1):
Is this ready to be merged into Dynamoose? (select 1):
Are all the tests currently passing on this PR? (select 1):
Other: