Re: Own webserver, with PHP plus opcache/similar?
| From: | Sanford Whiteman | Date: | Wed, 11 Jun 2014 20:14:53 +0000 |
| Subject: | Re: Own webserver, with PHP plus opcache/similar? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74854@lists.php.net to get a copy of this message | ||
> I am thinking about the difference of using a remote process, or
> writing my own SAPI ontop of the Embed-SAPI - maybe making a C++
> module to nodejs, so I can kick requests and thei rhandles into a
> different thread, and have nodjs interact directly with PHP, rather
> than a process. I dont know though, how efficient that is, when
> looking at caching.
> Do you think I should rather spawn an array of php workers (and if,
> -cgi or -fpm?) or write my own layer using the Embed SAPI?
I feel the Embed SAPI is better for your case.
The FastCGI protocol is built for the classic HTTP request/response
cycle, not for Websockets' continuous bidirectional pump. You would
find yourself synthesizing HTTP-like requests just to interact with
FCGI. That way madness lies.
I think for the goal "Process websocket messages in PHP code,"
assuming no time/technical limitations, you should lean as little on
other protocols as possible. Sticking to the websocket server's async
I/0 model, with PHP loaded into its memory space so you can write in a
familiar language, would be ideal.
Note I do not know which, if any, opcode caches will load under the
Embed SAPI. You have a lot of moving parts here.
-- S.