NAME

Beekeeper::Service::Supervisor::Worker - Worker pool supervisor.

VERSION

Version 0.03

DESCRIPTION

A Supervisor worker is created automatically in every worker pool.

It keeps a shared table of the status of every worker connected to a logical bus in every broker, routinely checking local workers and keeping track of workers periodic performance reports.

worker_status

Handler for 'supervisor.worker_status' job.

This job is sent by workers every few seconds and acts as a heart-beat. It contains statistical data about worker performance.

Note that workers doing long jobs (like slow SQL queries) may not send this request timely.

on_worker_exit

Handler for 'supervisor.worker_exit' job.

This job is sent by workers just before exiting gracefully. It is not sent when worker is terminated abruptly (as process has no chance to do so).

check_workers

Check every worker process in this host (even workers in other pools) to ensure that they are running, and measure their memory and CPU usage.

This is needed as workers with long blocking procedures may not report its status timely, and abruptly terminated workers has no chance to report that they had exited.

check_queues

In the case of all workers of a given service being down, all requests sent to the service will timeout as no one is serving them. This may cause a serious disruption in the application, as any other service depending of the broken one will halt too for the duration of the timeout.

In order to mitigate this situation the Sinkhole service will be notified when unserviced queues are detected, making it to respond immediately to all requests with an error response. Then callers will quickly receive an error response instead of timing out.

get_workers_status

Handler for 'supervisor.get_workers_status' job.

Used by bkpr-top command line tool.

get_services_status

Handler for 'supervisor.get_services_status' job.

Used by bkpr-top command line tool.

restart_workers

Handler for 'supervisor.restart_workers' notification.

This request is sent by bkpr-restart command line tool.

restart_pool

Handler for 'supervisor.restart_pool' notification.

This request is sent by bkpr-restart command line tool.

AUTHOR

José Micó, jose.mico@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015-2021 José Micó.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.

This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.