In general, with node.js you'll find that breaking up your back-end into
many processes, works best. Have a single HTTP process and a separate
websocket process that then emit IPC requests either directly or via a
messaging bus like 0mq will help address issues like this.

Specifically, in a well architectured highly decoupled application,
development tends to be silo'd to specific concerns at any given time. So
fixes to a specific service (process) would then require restarting only
that specific service, and thus at worst any IPC requests made during the
restart to that specific service would be dropped and could optionally be
resubmitted. Additionally, using a message queue like 0mq offers cheap
message buffering that will ensure (within reason) message delivery after
restart so no requests get dropped.

This also breaks up your application nicely as it leads to a better
separation of state; Your main application logic doesn't store it.

We use my teammate's, Michael Schoonmaker, 0mq library Shuttle:
https://github.com/Schoonology/shuttle

Development tends to go like this:

1. I'm making changes to the foo API namespace.
2. I spend most of my time updating things related to the foo namespace.
3. I constantly restart and retest internal IPC calls to the foo service
4. When I feel confident the functionality is complete, I integration test
the new foo functionality as part of the whole system.

Another nice perk of breaking your application into many decoupled focus
processes, is it helps with horizontal scaling.

Cheers,
Adam Crabtree


On Tue, Feb 19, 2013 at 10:46 AM, Mark Hahn <m...@hahnca.com> wrote:

> I use a websocket instead of page loads and the user can't tell when the
> server reboots.  Socket.io automatically reconnects.
>
>
> On Tue, Feb 19, 2013 at 7:01 AM, greelgorke <greelgo...@gmail.com> wrote:
>
>> look at this https://github.com/LearnBoost/up
>>
>> it in fact spinns new worker processes and let the old ones live for
>> defined amount of time, so they have the chance to end their work
>> gracefully before they die. and you have a cluster and simple keep-alive
>> monitoring for free.
>>
>> Am Dienstag, 19. Februar 2013 01:05:55 UTC+1 schrieb Federico Kereki:
>>
>>> Hi!
>>>
>>> What's the best way to reload a node.js website? I mean, working with
>>> Apache/PHP if you just upload a new PHP file, all newcomers will use that
>>> file, without needing to restart/reload Apache. However, if you simply
>>> "kill" a node.js process and restart it, currently connected users will be
>>> in trouble, processes may be aborted in the middle, updates could be lost,
>>> etc.
>>>
>>> I'm guessing that you could have a process running periodically, which
>>> would monitor loaded modules for updates and, if needed, "require(...)"
>>> them again after having done a "delete require.cache[...]".
>>>
>>> I've also found recommendations for "node-supervisor" and "nodemon", and
>>> I'm sure there must be some more out there.
>>>
>>> My only hard-and-fast requirement is that no connection is lost because
>>> of the restart -- connected users shouldn't notice any change at all,
>>> though I could stand a certain delay.
>>>
>>> What's the best way?
>>>
>>> Thanks, and best regards,
>>> Federico Kereki
>>>
>>  --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nodejs@googlegroups.com
>> To unsubscribe from this group, send email to
>> nodejs+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to nodejs+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Better a little with righteousness
       than much gain with injustice.
Proverbs 16:8

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to