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

concurrent/async jobs #105

Open
wessel-techtribe-nl opened this issue Mar 2, 2019 · 1 comment
Open

concurrent/async jobs #105

wessel-techtribe-nl opened this issue Mar 2, 2019 · 1 comment

Comments

@wessel-techtribe-nl
Copy link

If multiple jobs are waiting with batch mode = false and each jobs takes 2 seconds, they are executed sequentially instead of concurrently (asynchronously).

If I run multiple runners (with bin/consoledtc:queue:run) at the same time concurrent handling works ok, but then batch mode (which should enforce sequentially if I understand it correctly) doesn't work.

This is in symfony 4 with ORM.

Is this something in my configuration?

@mmucklo
Copy link
Owner

mmucklo commented Jul 26, 2019

@wessel-techtribe-nl Sorry for the delay in response.

If multiple jobs are waiting with batch mode = false and each jobs takes 2 seconds, they are executed sequentially instead of concurrently (asynchronously).

This is correct

If I run multiple runners (with bin/consoledtc:queue:run) at the same time concurrent handling works ok, but then batch mode (which should enforce sequentially if I understand it correctly) doesn't work.

No batch mode doesn't enforce the order. What batch mode does is if you submit multiple jobs with the same arguments, and they are all waiting to get executed (say the queue is backlogged by 1000 jobs), the jobs with the same arguments will all "clump" or "batch" together as one job (with only a single execution). Perhaps "batch" is the wrong moniker here. Maybe it should be called something different, like "merge" mode or something.

The idea is if you have a burst of activity and the queue gets backed up, and say you have an event that sends you a page once per minute by enqueueing a job every minute. You won't suddenly get a flurry of pages once the queue starts to catch up if you set batch mode on. Another example could be a password-reset email that gets enqueued, but back logged, and the user retries 100 times to send it, it can batch or merge those jobs as a single email-reset job, so they'll only get a single email once the queue catches up.

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

2 participants