Re: [PHP] PHP connection to external application
- Date: Fri, 13 Jun 2008 10:25:42 +0200
- From: Per Jessen <per@xxxxxxxxxxxx>
- Subject: Re: [PHP] PHP connection to external application
hce wrote:
> I am not certain if the msg_send / msg_receive in PHP can talk to the
> external C program msg_send / msg_receive as PHP and external C
> program are in different processes, different memory spaces.
System V message queues are intended for just that; IPC = Inter Process
Communication.
> (a) A simple way is if for every PHP request, it opens socket, sends a
> request and gets a response from the C server then closes the socket.
> It should work, but I am not sure:
> (i) if the open / close socket per request will cause delays and
> performance issues.
They will cause both delays and performance issues. But whether these
will matter for your use is a different question. The process you've
describe (open,get,close) is no different to sending an email or
getting a web-page. People send a lot of email and serve a lot of
webpages without major performance issues :-)
> (ii) What is the maximum number concurrent requests in a PHP web
> application?
That's up to your webserver - if it's big enough, you can serve a lot of
concurrent requests.
> Will the maximum socket number / or port number (up to 2^16) be a
> bottleneck for large number of concurrent requests (hundred
> and thousands)?
Probably not.
> (b) If for all PHP requests share only one socket to connect to the
> external C server, I am not sure if the PHP is able to do multiplex
> responses for each request as the PHP is stateless.
"PHP is stateless" ?? PHP is a scripting language, not a protocol.
Besides, it would take quite a bit of work to make your thousands of
concurrent PHP requests share a single socket.
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php