ControlFreak::Proxy - Delegate some control to an intermediary process.
There are some cases where you want some services managed in a special way,
and it makes no sense to implement this in
Indeed, one design trait of ControlFreak is its absolute simplicity, we don't want to clutter it with features that are only rarely used or that could make the controller unstable.
One example of that is Memory Sharing.
If you have 20 application processes running on one machine all having the same code running,
there is a memory benefit into making sure the app is loaded in the parent process of all these applications.
it would allow all children to initially share parent code and thus potentially reduce the memory footprint of the application by quite a while,
it's out of question for the
controller to load that code in its own memory.
A better solution is to use a
ControlFreak::Proxy separate process that will:
$proxy = ControlFreak::Proxy->new( ctrl => $ctrl, cmd => '/usr/bin/cfk-share-mem-proxy.pl --preload Some::Module', ); $proxy->add_service($svc); $proxy->destroy_service($svc); $proxy->run; $proxy->start_service($svc); $proxy->stop_service($svc); @list = $proxy->services; $proxy->shutdown; $proxy->is_running;
Returns the status of the proxy, including its eventual pid in one line of text, where the following fields are seperated with tabs:
Returns a list of ControlFreak::Service objects related to the proxy.
Declares a service under the control of the proxy.
Adds an environment key, value pair to the proxy
Resets proxy environment to empty.
Runs the proxy command.
Quits the proxy (and consequently stops all related services).
Called when the proxy has exited. It performs a number of cleaning tasks.