-
Notifications
You must be signed in to change notification settings - Fork 15
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
Worker wont unregister on high workload. #7
Comments
I'm not sure what you are trying to achieve here. Can you post a full example which can be run? |
There's a race condition when trying to unregister a worker from the queue.
If an unregister message comes in between the above 2 steps, the worker will not be unregistered. I.e: in doUnregister() processors.remove() will return false. It is possible to sneak in an unregister before or after the above 2 steps, but as the workers become more busy it becomes even harder to unregister. With very simple tweaks on how the work queue handles the processors queue it ispossible to unregister the worker safely without disrupting any work. Option 1: Don't remove the worker in checkWork() Option 2: Use a queue to track the received unregistered messages. When processedMessage() is supposed to return the processor back on the queue have it check the unregistered messages queue. If the processor is on that list don't put him back, otherwise put him back. Performance is on par. |
Here is my fix using option 2 I added 2 new Queues called unQueue and registered. And modified the doRegister(), doUnregister() and messageProcessed() package org.vertx.mods; import org.vertx.java.busmods.BusModBase; import java.util.LinkedList; /**
} |
Can you submit a PR? It's very hard to see your changes when they are just pasted in a comment. |
Ok let me try :) |
Ok I think I may have found an issue with the work queue on highly concurrent work load and what's causing me to ask crazy questions and running in circles. And it doesn't take much, 1 Jmeter user sending 250 requests per second.
Very easy to reproduce.
Create a simple http verticle and work queue with one worker. For each request made to the http verticle add a job to the work queue.
Setup JMeter to send requests to the http verticle. As JMeter is running attempt to unregister the worker, sometimes it does, sometimes it doesn't though the status ok is always returned.
It can be proven quite easily. If no work is being executed and you unregister and then send another request to the work queue the done handler never fires since obviously there's no worker to reply back. But if you keep adding jobs to the queue sometimes it cannot unregister the worker.
This is the http handler to test. Of course one must register a work queue and worker to complete the test.
public void handle(final HttpServerRequest req) {
}
Thoughts?
The text was updated successfully, but these errors were encountered: