Graceful Restart Multiprocess #5674
Unanswered
smathersPersonal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been playing around with different ways to achieve graceful restart. I have 1 method that actually works but its not very efficient.
To get the above to work,
All the above will work with a server that does not take alot of requests, by chance eventually u should reach a cnt of 0
Now here is the inefficient part, duplicate "fixed" dispatch mode in a php function with 1 change.
That is check the $stables to make sure if its a new connection dont pick workers that have "stop_connections" set (in order words, don't pick a worker that is trying to restart)!
So in order to make this better
I've tried using swooles graceful shutdown in the newest version of swoole, v6.0.0
So to explain this, SWOOLE_BASE is suppose to be more efficient right? max_wait_time of 3 hours because this system controls phone calls, some of those phone calls go quite long. And i cannot interrupt the flow of phone events to the application, otherwise the call drops or is mis handled.
Trial 1, issue graceful restart via cmdline:
kill -USR1 main_process_PID
I can see it working, but instead of the workers blocking new connections. All new connections and and existing ones are blocked (existing connections stop receiving tcp events). This is no good the phone call i had tested this with fails to handle properly
Trial 2, Use some of the pieces above in that i store details in $sTable, and slowly restart workers one by one using the stop() graceful feature.
self::$server->stop($row['workerId'],true);
, the true means wait for event loop to be empty. This worked mostly, but as testing got on and chance kicked in, my phone call eventually hit a worker that was in this gracefully state and was blocked from making a new connection instead of picking a worker that was not restarting! So in the end this was no better then above.Q: Was wondering what peoples thoughts on all this?
Feature: Maybe a new dispatch mode that pays attention to graceful restarts and stops new connections from dispatching there?
Thanks a lot for reading!
Beta Was this translation helpful? Give feedback.
All reactions