-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.pl.example
executable file
·78 lines (68 loc) · 1.61 KB
/
config.pl.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl
package HogeHoge::Worker::Gearman::Double;
use strict;
use warnings;
sub work_job {
my ($class, $job) = @_;
my $ret = $job->arg * $job->arg;
return "$ret (pid $$)";
}
package HogeHoge::Worker::Gearman::Sqrt;
use strict;
use warnings;
sub work_job {
my ($class, $job) = @_;
my $ret = sqrt($job->arg);
return $ret;
}
1;
package main;
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
use lib 'lib';
use Dainamo;
use Dainamo::Profile::Gearman;
my $dainamo = Dainamo->new(
max_workers => 10,
log_level => 'info',
# daemonize => 1,
# log_path => "| /opt/local/sbin/cronolog /tmp/dainamo_log/daimano.%Y%m%d.log",
);
$dainamo->add_profile(
profile => Dainamo::Profile::Gearman->new(
name => 'hogehoge',
max_requests_per_child => 100,
weight => 1.0,
config => +{
job_servers => ['127.0.0.1'],
workers => [qw( HogeHoge::Worker::Gearman::Double )],
},
),
);
$dainamo->add_profile(
profile => Dainamo::Profile::Gearman->new(
name => 'hogehoge',
max_requests_per_child => 150,
weight => 1.0,
config => +{
job_servers => ['127.0.0.1'],
workers => [qw( HogeHoge::Worker::Gearman::Double )],
},
),
);
$dainamo->add_profile(
profile => Dainamo::Profile::Gearman->new(
name => 'fugafuga',
max_requests_per_child => 60,
weight => 1.0,
config => +{
job_servers => ['127.0.0.1'],
workers => [qw( HogeHoge::Worker::Gearman::Sqrt )],
}
),
);
sub {
$dainamo; # last line
}->();