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

Q: batching assumption #1

Closed
jardakotesovec opened this issue Sep 15, 2015 · 3 comments
Closed

Q: batching assumption #1

jardakotesovec opened this issue Sep 15, 2015 · 3 comments

Comments

@jardakotesovec
Copy link

@leebyron this lib looks great, thanks for sharing!

Is my assumption correct that dataloader batches requests within one event loop and send request to db on nextTick or something? I guess its only way to say when batching is finished.

If so, maybe would be good to explicitly mention that in docs as it can get important when designing backend flow.

Lets say that I have sql backend without parallelize - it seems that in that case it still might make sense to batch sql queries there, so they resolve at the same event loop, therefore they have higher chance to batch together in subsequent queries and result in less requests. Does that sounds like reasonable thought process? :-)

@acdlite
Copy link

acdlite commented Sep 16, 2015

You are correct: https://github.com/facebook/dataloader/blob/master/src/index.js#L156-L158

DataLoader batches all loads which occur in a single frame of execution, but should include in the batch all loads which occur during the flushing of the "PromiseJobs" JobQueue after that same execution frame.

@leebyron
Copy link
Contributor

Thanks for the feedback! I'll clarify in the readme

@tonyxiao
Copy link

are there other ways in which we can configure the batching? Say within 1000 milliseconds rather than 1 event loop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants