No actually I am doing it in main thread. I just need one message per PHP page request. But I have found that it is not possible as PHP forks a new process for every request.So a new connection is created every time to push a message in Kafka. It is taking 400ms per request. I think I need to revise my model.