What are the good ways to handle active client connections during code deployment in Node.js?
-
I have to build an application which will have many active client connections (TCP) and these connections will remain active for prolonged period. How can I deploy code changes in my production server without breaking any of these connections (critical requirement)? PS: I am right now evaluating Node.js vs Erlang for a chat *like* application I am developing and saw that Erlang provides hot swapping. I have no experience in either of them.
-
Answer:
No matter what scale you're at, be it an IRC server or a massively-multiplayer game, you're going to have maintenance time, so the best thing you can do is schedule it and let your users know. Deploy to production at a time when the fewest number of users are going to be using your application. On the client-side, set your clients so that they attempt to reconnect as soon as a socket times out. If your build is efficient, then from the client's perspective, the downtime for them should be very minimal. There are many possible ways that your clients can lose their persistent connection besides this, and you need to take into consideration all of them when developing your application. 100% uptime is the Holy Grail that all developers chase, but it's an impossible dream,
Clarence Leung at Quora Visit the source
Other answers
Add a shutdown switch which stops listening on the server port but gracefully finishes off the old connections. Then when you trigger the switch, you immediately start the new server and run the two together for some time. See http://nodejs.org/api/net.html#net_server_close_callback
Anders Brownworth
Related Q & A:
- What are some good ways for 11 year olds to earn money?Best solution by Yahoo! Answers
- What are some good ways to gain confidence?Best solution by Quora
- What are some good ways to study in college?Best solution by Quora
- What are some good ways to fundraise?Best solution by Yahoo! Answers
- What are some good ways to advertise a business?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.