-
Notifications
You must be signed in to change notification settings - Fork 50
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
Process payloads in batches #93
Comments
well -> #82 |
Ah ha! I will take a look @mauricio |
👍 |
@mauricio Here's what I would do differently:
|
@grantr that would simplify the implementation a lot. Another problem is, how do you know if a queue produces batch jobs or not? This was one of the main complications for my implementation, having to pull and push stuff back to the queue when they are "single" jobs instead of batch jobs. My usage back at the time was a single use queue, so I didn't have to care about this much, but if you're running on top of a general queue this could give you trouble as clients mix batch and non-batch jobs at the same place. Why would you implement batch pushes separately? Seems like a very simple solution to have given you have a backend that supports them, you just push many messages at once instead of one at a time. |
IMO this is the backend's responsibility. The backend can decide whether it will pull payloads in bulk from the queue service. If it so decides, then the This decouples batch pop from batch process, and keeps the perform logic in the Batch push is separate because it doesn't have anything to do with batch processing (IMHO). Consumers don't need to know if producers have batch push, and producers don't need to know if consumers have batch pop. |
Some jobs would benefit from being able to process a bunch of payloads at once. Specifically, a job that writes documents to a data store could see a dramatic performance increase by sending 50 or 100 documents per request instead of 1. Since it may not be possible for the producer to enqueue entire batches in a single payload, the queue framework needs to handle popping multiple payloads and collecting them into a batch job.
This could work well with batch pop support in the backend, but doesn't require it. Even if the backend only supports popping one payload at a time, a job might still want a batch of payloads.
The text was updated successfully, but these errors were encountered: