Best way to administer code updates to server daemon

D

Daniel da Silva

Hi,

I am writing a custom IRC server, and I was wondering would be the
best way to administer code updates to the daemon. Am I doomed to have
to restart the server every time I want to do an update (which would
disconnect all clients)? I don't mind doing something a little more
advanced if it means I can keep close to continuous uptime.

Thanks,
Daniel
 
M

MRAB

Hi,

I am writing a custom IRC server, and I was wondering would be the
best way to administer code updates to the daemon. Am I doomed to have
to restart the server every time I want to do an update (which would
disconnect all clients)? I don't mind doing something a little more
advanced if it means I can keep close to continuous uptime.
As I see it, the server listens for a new client, starts a handler for
that client (it might be starting the handler in a new thread), and
then tidies up when the client disconnects.

The server code could be split into the core and the handler. The core
of the server might not be updated very often, so it would stay
running, and the handler would be in another module. There could be
more than one version of the handler available.

When the core wanted to start a handler for a new client it would use
the latest version of the handler, and when an old version of the
handler was no longer being used by any client then it could be
discarded.
 
P

Paul Rubin

Daniel da Silva said:
I am writing a custom IRC server, and I was wondering would be the
best way to administer code updates to the daemon. Am I doomed to have
to restart the server every time I want to do an update (which would
disconnect all clients)? I don't mind doing something a little more
advanced if it means I can keep close to continuous uptime.

There are several possible approaches:

1) load new code into the server with the import function, being careful
about what data structures you can mess with etc.

2) have a simple front end proxy that maintains the inbound tcp
connections to clients, and uses a connectionless or restartable
protocol to pass the info to the server. Of course now you have the
issue of how to update the proxy. But for a serious HA system you have
to do stuff like this anyway.

3) Start the new server in a new process, and use the Linux SCM_RIGHTS
message that lets you pass open file descriptors through Unix domain
sockets, to hand off any open TCP connections from the old server to the
new one.

Maybe there are other ideas possible too.
 
C

Carl Banks

Maybe there are other ideas possible too.

I don't know of any off-hand but there are probably virtual network
drivers that sit between your server and the network stack that can
keep a connection open.

It seems like it'd be a common enough need that someone's figured out
an easy way to handle it.


Carl Banks
 
P

Paul Rubin

Carl Banks said:
I don't know of any off-hand but there are probably virtual network
drivers that sit between your server and the network stack that can
keep a connection open.

It seems like it'd be a common enough need that someone's figured out
an easy way to handle it.

I don't see big conceptual obstacles to making a network stack itself be
able to package up the internal state of a TCP or even SSL connection,
and hand it off to another computer over a LAN, so that you could have
graceful turnover of live connections. They could even cross-update
info about the connection for hardware failover. I woder if (e.g.)
Erlang OTP already does something like that. I worked on a device with
such a feature a while back, based on very special purpose hardware and
software and a special (hardware) communication bus for the purpose, but
with some careful coding it can probably be done with stock hardware and
ethernet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,829
Latest member
PIXThurman

Latest Threads

Top