RE: [PECL-DEV] Static array & PHP CLI

From: Date: Tue, 26 Jun 2012 10:09:12 +0000
Subject: RE: [PECL-DEV] Static array & PHP CLI
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-9545@lists.php.net to get a copy of this message
Hi, if you use such an architecture, everything is done as only one PHP 'request'. The PHP 'request' just lasts one week ! So, PHP persistence is useless in your case, as persistence is used to persist data between several PHP requests. You will also need to dispatch requests between several PHP CLI processes if you want to handle concurrent requests. Note that, in your architecture, the memory cleanup mechanism used to free memory between requests doesn't run. So, you must pay much more attention to you process memory usage. De : William MARTIN [mailto:wysman@gmail.com] Envoyé : mardi 26 juin 2012 08:47 À : Laupretre François Objet : Re: [PECL-DEV] Static array & PHP CLI Patrick, Yes, this array is used many time on every request. This first class is just a start of work, they have many other classes to implement. François, Thanks for your inputs. The PHP process run as a daemon and handle lot of requests, i restart it one time per week. The architecture is like : Client <--HTTP--> Mongrel2 <---ZMQ--> PHP Photon (CLI) -> Mognrel2 is a webserver that dispatch the request to handlers (here my PHP process) with ZMQ (http://www.zeromq.org/) On Mon, Jun 25, 2012 at 7:42 PM, Laupretre François <francois.laupretre@francetv.fr<mailto:francois.laupretre@francetv.fr>> wrote: Persistent arrays can be used in any PHP mode: CLI, CGI, apache module, ZTS active or not. But, do you really understand what CLI mode implies ? I don't understand your architecture. Do you understand that persistence is between requests ? If you use a mode like CLI which handles a single request before shutting down the process, I don't see very well what persistence will bring. The same in CGI mode. In these two modes, a different process is created for each request and there is no persistence possible between processes, at least not the basic memory persistence provided by the Zend library. For examples using persistent arrays, you can have a look at the code of the automap (http://pecl.php.net/package/automap) and phk (http://pecl.php.net/package/phk) extensions. Start with automap, which is a cache system using persistent arrays. François -- --------------------------------------------------------- William MARTIN wysman @NoSpAm@ gmail @DoT@ com Click here<https://www.mailcontrol.com/sr/1xCj0J8tb7vTndxI!oX7UoH9GbmNk6!Rtzp9liBoBnPixFdBBrDqfG5PWUCnv8VgMpg6riKLD4c0OzGclh82!Q==> to report this email as spam.

« previous php.pecl.dev (#9545) next »