Skip to content
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

control over event loop batch sizes #706

Open
jcjones1515 opened this issue Aug 5, 2021 · 2 comments
Open

control over event loop batch sizes #706

jcjones1515 opened this issue Aug 5, 2021 · 2 comments
Labels
api: datastore Issues related to the googleapis/python-ndb API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@jcjones1515
Copy link

jcjones1515 commented Aug 5, 2021

Feature Request: I think a use case we have would benefit from more control over how many concurrent requests will be used when fetching large #s of entities by key. Specifically my idea was to give the ability to control this batch size

We have some cases where we have several thousand Keys to lookup, and from what we've observed python-ndb is making a small number of 1000 key calls. I've tried various ways to make smaller overlapping async calls (including writing tasklets) without any success. I believe this is because python-ndb will try to keep adding to the existing batch all the way up to 1000 keys to lookup.

Smaller overlapping async calls would (IMO) perform better in our case, or at least allow us to tune the balance between the concurrency of requests and the overhead of making more requests.

So my first question is is there already a good way to do what I'm trying to do? If not I'd be happy to contribute a PR if someone could provide some guidance on how to add more control over this behavior.

Thanks!

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-ndb API. label Aug 5, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Aug 7, 2021
@chrisrossi chrisrossi added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Aug 17, 2021
@chrisrossi
Copy link
Contributor

There is not, currently, a way to tune this number. One thing you could do, if you were so inclined, is do some benchmarking while tweaking the batch size by hand to see if there is any advantage to smaller numbers.

@jcjones1515
Copy link
Author

thanks @chrisrossi I was considering forking temporarily and doing just that. I'll report back here any findings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/python-ndb API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants