Creating an PHP API with php fpm and Socket connection

     

i want to create a PHP API that can be used as a microservice. It should not be accessible from the internet so connection security is not an issue. Priority is performance. I was thinking of using a simple TCP socket connection to get rid of HTTP overhead and to have a persistent connection. But I also want to use the strengths of php-fpm.   Is something like this possible?


+---------------------+ +-----------+ +--------------------+  | php App (stateless) +---+ php-fpm +---+ tcp socket server? |  +---------------------+ +-----------+ +--------------------+  

could I use nginx as the tcp server? or could i directly connect with php-fpm?


I hope my intention is clear. Thx in Advance.

  
"
answer1
  
  

Ok so for everyone trying to build microservices including state full services that can use persistent socket connections and would also like to use PHP