php-rdkafka: In the FPM environment, the response is very slow,

  • PHP version: 7.0.10
  • librdkafka version: 0.9.2
  • php-rdkfaka version: 3.0.0
$_st  = microtime(TRUE);
$producer = new \RdKafka\Producer();
$producer->addBrokers('kafka001:9092,kafka002:9092');
$topic = $producer->newTopic('PHPTest');
$topic->produce(\RD_KAFKA_PARTITION_UA, 0, date(DATE_W3C));
var_dump(microtime(TRUE) - $_st);

output: float(0.00036001205444336)

But in the nginx log is mostly 100 to 200ms

I would like to ask FPM how to optimize it?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 37 (10 by maintainers)

Most upvoted comments

@arnaud-lb seems out of all the php libs, this is the last man standing. What a sad state of affairs!

I’m having the same problem.

When will persistent connections and better performance be forth-coming?

Thanks for the work on the lib, much appreciated!

Hi @arnaud-lb. I know this is an outdated thread possibly - but I was wondering if there were any speed improvements - currently, New Relic is reporting it’s taking around 34ms to add the data to Kafka in my application, would that seem about right? Seems slow to me - would enabling the internal.termination.signal + pcntl_sigprocmask() help to get this lower? I was hoping I would be able to achieve this in less than 10ms for just this part of my application

Many thanks