Re: Re: Persistent PHP web application?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Josh Whiting wrote:
> However, would a single process PHP server daemon be able to
> appropriately handle the incoming load from Apache, which will be
> running multiple processes handling concurrent incoming requests?

I don't think you've quite got the right picture here...

When you write your single process PHP server daemon, Apache's not even in
the same picture frame any more.

The requests aren't coming from Apache -- PHP is listening to a port you
select, exactly in the same way that Apache listens to port 80, MySQL
listens to 3306, your SSH server listens to 22, your Mail server listens
to 25, your FTP server listens to [I forgot]...

In other words, you are giving PHP a "promotion" from a Module of Apache,
to being its own "web" server, only it won't be a "web" server, it will be
a "Whatever You Want" server.  I'll call it WYW (Whatever You Want) for
the rest of this post.

Just don't ask me how to pronounce WYW. :-)

So you're going to write you own WYW server, which will:

while (true){
  Listen to port X for requests from WYW clients.
  make a socket back to them for the request
  send back your response in the WYW protocol
}

What you're really asking, or should be asking, is:

Is PHP fast enough to handle heavy load as a WYW server?

That should be fairly easy to test.

There are pre-existing packages out there to make PHP sockets easy, or you
could roll your own test in a day (max) of programming.

Throw Apache Benchmark at it, or whatever you like to stress-test it.

I'm betting the do-nothing PHP socket-server will handle VERY heavy load. 
That code is all thinly-disguised wrappers around the C socket library on
your server -- The same library Apache, FTP servers, and so on are all
using to handle their load, almost for sure.

Whether or not what you need to *DO* with the incoming data and your
calculations needed to compose a valid response will be fast enough really
depends on what you want your WYW server to *DO*...

You might even want to have multiple PHP processes going, just like
Apache, if you need to handle really have load.

Or, you might want to fork right before you calculate your response.

Or...

PHP is probably not the FASTEST language to do these things in -- but it's
not going to slow you down horribly either.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux