These are chat archives for arnaud-lb/php-rdkafka

21st
Dec 2016
Aaron Gong
@ais-one
Dec 21 2016 12:38
Does it work on php5.6, 64bit linux?

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);
Magnus Edenhill
@edenhill
Dec 21 2016 15:38
@ais-one you typically want to persist the producer and reuse it across multiple produce() calls. otherwise things become really slow.
also use a proper timeout rather than zero in $rk->poll(0) or it'll busy-loop