is there any code that can handle high volume on PHP? I tried ab -n 20000 -c 500 producer seems to choke on PHP, but nodejs is fine...
the broker and consumer are all ok, on the producer... the code is...
$my_topic = "test0";
$brokers="192.168.48.79,192.168.48.80,192.168.48.86";
$conf = new RdKafka\Conf();
$rk = new RdKafka\Producer($conf);
$rk->addBrokers($brokers);
$topic = $rk->newTopic($my_topic);
$topic->produce(RD_KAFKA_PARTITION_UA, 0, "$i Record Has Been Entered Here");
while ($rk->getOutQLen() > 0) {
$rk->poll(0);
}
$conf->set('internal.termination.signal', SIGIO);
$rk->poll(0)
or it'll busy-loop
Hi everyone! Does anybody know how to interrupt librdkafka internal threads using a signal and let the application process some signal? I have daemon+worker application and kafka is used inside the worker. When daemon receives SIGTERM it sends one to all workers. The problem is when the application is consuming a topic, the signal handler inside worker is not called. However using strace I can see, that process actually receives SIGTERM and hangs inside system calls like this:
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=30489, si_uid=1000} ---
rt_sigreturn({mask=~[KILL TERM STOP RTMIN RT_1]}) = -1 EINTR (Interrupted system call)
futex(0x5602a96ca6bc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 17, {1484151715, 231482000}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
futex(0x5602a96ca690, FUTEX_WAKE_PRIVATE, 1) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], ~[KILL TERM STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[KILL TERM STOP RTMIN RT_1], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], ~[KILL TERM STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_SETMASK, ~[KILL TERM STOP RTMIN RT_1], NULL, 8) = 0
Lines after rt_sigreturn are repeated until the worker is killed after timeout.
I'm using asynchronous signal processing from php 7.1 and when I replace kafka consuming with sleep
function everything works well.
Environment: php 7.1
, php-rdkafka 3.0.0
, librdkafka 0.9.2-237-gd3dcc0 (d3dcc0198517160b9c8e374da2e963f563eb2c6f)