On Tuesday, 13 October 2015 16:43:20 UTC+3, Aapo Talvensaari wrote:
On Tuesday, 13 October 2015 16:27:02 UTC+3, Aapo Talvensaari wrote:
On Monday, 12 October 2015 21:14:55 UTC+3, David Linenberg wrote:
- Can I have a single client call get routed to *all* worker processes?
Forget what I just said. ngx.timer(0, ...) only executes on one worker if it is done somewhere else than init_worker_by_lua.
You could still start recurring timer on each worker with init_worker_by_lua, but to pass some state or calculation work to it you will need pub/sub or something. And of course timers need to push their data to somewhere.
Something like this:
1. Each worker has a recurring timer
2. Now you request "/start_calculation_with_state_provided", what happens:
1. You send a message in redis pub/sub and then start waiting for a results by subscribing a results channel
2. Each timer gets notified and will start calculating with a new state
3. When the calculations are finished each timer will report back to results channel
4. When N numbers of results have been received from results channel (or timeout occurred) the original request will be finally served
I'm sure this is what you are NOT looking, and I don't really know if it works, but just something to think about.