Beekeeper

 view release on metacpan or  search on metacpan

bin/bkpr-top  view on Meta::CPAN

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Filters --host, --pool and --class can be combined.
 
The metrics displayed are:
 
   nps:   number of received notifications per second
   cps:   number of processed calls per second
   err:   number of errors per second
   mem:   resident non shared memory size in KiB
   cpu:   percentage of CPU load
   load:  percentage of busy time
 
Change sorting pressing (N)otifications, (C)alls, (M)emory, cp(U) or (L)oad.
 
";
 
if ($opt_help) {
    print $Help;
    exit;
}

bin/bkpr-top  view on Meta::CPAN

261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
    
  Filters --host, --pool and --class can be combined.
   
  The metrics displayed are:
   
     nps:   number of received notifications per second
     cps:   number of processed calls per second
     err:   number of errors per second
     mem:   resident memory size in KiB
     cpu:   percentage of CPU load
     load:  percentage of busy time
   
  Change sorting field pressing (N)otifications, (C)alls, (M)emory, cp(U) or (L)oad.
 
=head1 DESCRIPTION
 
Display real-time performance metrics of running workers in a C<top> fashion.
 
Sorting order can be changed pressing keys N, C, M, U and L.
Pressing Q quits the program.

bin/bkpr-top  view on Meta::CPAN

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
=item cpu
 
Percentage of CPU load (100 indicates a full utilization of one core thread).
 
For example, supposing that there are 4 core threads available, a service that
shows a C<cpu> load of 200 is using half of the CPU resources.
 
=item load
 
Percentage of busy time (100% indicates that there are no idle workers).
 
Note that workers can have a high load with very little CPU usage when being
blocked by synchronous operations (like slow SQL queries).
 
For example, supposing that there are 10 workers running, a service that shows a
C<load> of 50% is working at half capacity. Spawning 10 additional workers will
lower the load to 25%.
 
Due to inaccuracies of measurement the actual maximum may be slightly below 100%.

lib/Beekeeper/MQTT.pm  view on Meta::CPAN

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
0x19 => 'Re-authenticate',                        # AUTH
0x80 => 'Unspecified error',                      # CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT
0x81 => 'Malformed Packet',                       # CONNACK, DISCONNECT
0x82 => 'Protocol Error',                         # CONNACK, DISCONNECT
0x83 => 'Implementation specific error',          # CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT
0x84 => 'Unsupported Protocol Version',           # CONNACK
0x85 => 'Client Identifier not valid',            # CONNACK
0x86 => 'Bad User Name or Password',              # CONNACK
0x87 => 'Not authorized',                         # CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT
0x88 => 'Server unavailable',                     # CONNACK
0x89 => 'Server busy',                            # CONNACK, DISCONNECT
0x8A => 'Banned',                                 # CONNACK
0x8B => 'Server shutting down',                   # DISCONNECT
0x8C => 'Bad authentication method',              # CONNACK, DISCONNECT
0x8D => 'Keep Alive timeout',                     # DISCONNECT
0x8E => 'Session taken over',                     # DISCONNECT
0x8F => 'Topic Filter invalid',                   # SUBACK, UNSUBACK, DISCONNECT
0x90 => 'Topic Name invalid',                     # CONNACK, PUBACK, PUBREC, DISCONNECT
0x91 => 'Packet Identifier in use',               # PUBACK, PUBREC, SUBACK, UNSUBACK
0x92 => 'Packet Identifier not found',            # PUBREL, PUBCOMP
0x93 => 'Receive Maximum exceeded',               # DISCONNECT

lib/Beekeeper/Service/Supervisor.pm  view on Meta::CPAN

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
Resident non shared memory size in KiB. This is roughly equivalent to the value
of C<RES> minus C<SHR> displayed by C<top>.
 
=item cpu
 
Percentage of CPU load (100 indicates a full utilization of one core thread).
 
=item load
 
Percentage of busy time (100 indicates no idle time).
 
Note that workers can have a high load with very little CPU usage when being
blocked by synchronous operations (like slow SQL queries, for example).
 
Due to inaccuracies of measurement the actual maximum may be slightly below 100.
 
=back
 
=head1 METHODS

lib/Beekeeper/Service/Supervisor/Worker.pm  view on Meta::CPAN

452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
Resident non shared memory size in KiB. This is roughly equivalent to the value
of C<RES> minus C<SHR> displayed by C<top>.
 
=item cpu
 
Percentage of CPU load (100 indicates a full utilization of one core thread).
 
=item load
 
Percentage of busy time (100 indicates no idle time).
 
Note that workers can have a high load with very little CPU usage when being
blocked by synchronous operations (like slow SQL queries, for example).
 
Due to inaccuracies of measurement the actual maximum may be slightly below 100.
 
=back
 
=head1 SEE ALSO

lib/Beekeeper/Worker.pm  view on Meta::CPAN

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    stop_cv         => undef,
    callbacks       => {},
    task_queue_high => [],
    task_queue_low  => [],
    queued_tasks    => 0,
    in_progress     => 0,
    last_report     => 0,
    call_count      => 0,
    notif_count     => 0,
    error_count     => 0,
    busy_time       => 0,
};
 
$JSON = JSON::XS->new;
$JSON->utf8;             # encode result as utf8
$JSON->allow_blessed;    # encode blessed references as null
$JSON->convert_blessed;  # use TO_JSON methods to serialize objects
 
$DEFLATE = Compress::Raw::Zlib::Deflate->new( -AppendOutput => 1 );
 
if (defined $SIG{TERM} && $SIG{TERM} eq 'DEFAULT') {

lib/Beekeeper/Worker.pm  view on Meta::CPAN

809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
            delete $worker->{callbacks}->{$_} foreach @cb_keys;
            delete $worker->{subscriptions}->{$service};
            undef $unsub_tmr;
 
            return unless $worker->{shutting_down};
 
            if ($worker->{in_progress} > 0) {
 
                # The task queue is empty now, but an asynchronous method handler is
                # still busy processing some requests received previously. Wait for
                # these requests to be completed before telling _work_forever to stop
 
                my $wait_time = 60;
                $worker->{stop_cv}->begin;
 
                my $busy_tmr; $busy_tmr = AnyEvent->timer( after => 1, interval => 1, cb => sub {
                    unless ($worker->{in_progress} > 0 && --$wait_time > 0) {
                        undef $busy_tmr;
                        $worker->{stop_cv}->end;
                    }
                });
            }
 
            # Tell _work_forever to stop
            $worker->{stop_cv}->end;
        }
    );
};

lib/Beekeeper/Worker.pm  view on Meta::CPAN

936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
$worker->{call_count} = 0;
 
# Average notifications per second
my $nps = sprintf("%.2f", $worker->{notif_count} / $period);
$worker->{notif_count} = 0;
 
# Average errors per second
my $err = sprintf("%.2f", $worker->{error_count} / $period);
$worker->{error_count} = 0;
 
# Average load as percentage of wall clock busy time (not cpu usage)
my $load = sprintf("%.2f", ($BUSY_TIME - $worker->{busy_time}) / $period * 100);
$worker->{busy_time} = $BUSY_TIME;
 
# Queues
my %queues;
foreach my $queue (keys %{$worker->{callbacks}}) {
    next unless $queue =~ m/^req\.(?!_sync)(.*)\./;
    $queues{$1} = 1;
}
 
local $client->{auth_data} = $AUTH_TOKENS{'BKPR_SYSTEM'};
local $client->{caller_id};



( run in 0.466 second using v1.01-cache-2.11-cpan-709fd43a63f )