[systemd-devel] Socket based activation/deactivation

Gary Mort garyamort at gmail.com
Tue Aug 26 17:49:29 PDT 2014

Socket based activation for systemd is a really cool feature for my dev 

Prior to using socket based activation, on my dev system I would have 2 

1) Automatically start mysql, apache, php fastcgi, memcached, mongodb 
and a dozen other services just in case I happen to be working with them 
on this particular bootup.

2) Manually start them when needed....usually /after/ trying to test 
something and discovering the service isn't running.

With socket based activation, I can start up dozens of servers on 
different sockets and they won't bog my system down - they only truely 
activate if they are actually used.

However, there is still a missing item to this feature[or it's not 
missing and I am simply unaware of it] - there is no way to do the 
reverse.  IE if apache is running on my server there is no way to 
configure things so if there are no active socket connections for 30 
minutes, have it automatically shutdown and pass the socket control back.

Not only would this be great for my dev system, it would also be almost 
everything needed for servers.  A lot of server admins don't like the 
idea of socket activation because it means that when they boot a server, 
they won't know if there is some blocker for a server to run[corrupted 
database files for example] until it is actually used.   With the 
ability to hibernate/sleep/whatever - a server can be configured to:

1) On bootup, use socket activation for all those expensive servers like 
mysql, apache, etc.   This means that unless there is active traffic to 
the system, the server can skip starting all those daemons and boot faster.

2) Using systemd scheduled tasks, very simple probes to the various 
sockets can be activated 5 minutes after bootup is complete.  That way 
if there is a corruption issue, system admins will be notified shortly 
after bootup when apache/mysql/mongo is activated by the socket probe 
and fails to start.

3) Using the hibernation feature, 35 minutes[or whatever the schedule 
is] after bootup, those services will be suspended, freeing resources 
that aren't being used.

So I'm curious if this feature is somewhere in socket activation I'm not 
aware of[it might simply be needing to write the proper systemd 
configuration files] or if it is something that would need to be added?

More information about the systemd-devel mailing list