Re: Re: Persistent PHP web application?

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

 



Hello,

on 01/04/2005 03:01 PM Josh Whiting said the following:
Why don't you just create a daemon started from the command line (shell/DOS) and have it accept socket connections from your Web server PHP scripts and provide a SOA (Services Oriented API) to the code that accesses your data structures pre-loaded in memory?

Setting up a separate persistent daemon PHP script is appealing to me because It implements exactly what I want, which is a persistent PHP application server, and also would allow me to abstract the implementation behind an API, move it to other servers when load increases, etc.

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?

You can always make your daemon pre-fork a few processes using pcntl extension and delegate the execution of the requests to those processes keeping the parent daemon process there free most of the time just managing the requests and responses and child processes lifetime.


This is basically how Apache works in pre-fork mode, except that there is a lot of overhead dealing with the HTTP protocol specifics.


Implementing a multi-process forking SOAP server in pure PHP seems
inefficient, but maybe I'm not understanding the basic
premise/implementation of the suggestion?

Forget SOAP. SOAP is meant for heterogenous environments on which client and server machines are independent and so they may not represent data in the same format. That is mostly why it uses XML (a text based format) to exchange messages. There is at least one PHP SOAP extension but that does not avoid the overhead of marshalling and unmarshalling request and response messages in XML.


Since you will be doing your own client and servers and do not have the need to share it to the world, you can crank your own proprietary format probably with marshalling based on PHP pack and unpack functions.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
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