Fwd: [PECL-DEV] Static array & PHP CLI
| From: | William MARTIN | Date: | Tue, 26 Jun 2012 14:43:43 +0000 |
| Subject: | Fwd: [PECL-DEV] Static array & PHP CLI | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-9546@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.
>
The PHP process get requests one by time, like for PHP-CGI.
At the end a the request, the process is not killed, It's just waiting for
another request, so persistence is usefull here.
> You will also need to dispatch requests between several PHP CLI processes
> if you want to handle concurrent requests.
>
Yes, it's already done by the ZMQ layer (http://www.zeromq.org/bindings:php
).
If you want to known more about that you can read this chapter
http://zguide.zeromq.org/page:all#Divide-and-Conquer
Ventilator & Sink is mongrel2 (the web server), and Worker are PHP process.
ZMQ allow you to dispatch requests on several processus, on several server.
It's allow to add/remove processus/server without interruption of the web
site / web application.
On a private project, we handle requests burst by simply start an EC2
instance and shutdown it 20 minutes after, without reconfiguration.
> ****
>
> ** **
>
> 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.
>
Yes, it's a important point.
Actually, a single PHP process handle many thousandth requests without leak.
For example, this website (http://www.photon-project.com/) is working with
a full implementation in PHP of the photon Framework, with 3 workers.