RE: [PHP] Re: Compiler for the PHP code (memecached)
| From: | Daevid Vincent | Date: | Tue, 19 Mar 2013 17:32:31 +0000 |
| Subject: | RE: [PHP] Re: Compiler for the PHP code (memecached) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-320658@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Alessandro Pellizzari [mailto:alex@amiran.it]
> Sent: Tuesday, March 19, 2013 2:06 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: Compiler for the PHP code
>
> Il Tue, 19 Mar 2013 08:46:22 +0000, Kevin Peterson ha scritto:
>
> > My webcode written in PHP and it is running in the interpreted way. My
> > problem is it is not giving the desired performance so want to try the
> > compiler if any.
>
> PHP gets compiled to bytecode on the server before being executed.
> You can cache the precompiled code with (for example) APC.
> Unless your code is several thousand lines of code (or your server very
> slow... 486-slow), the compilation phase is not that long.
>
> I think your main problem can be one of:
>
> 1- wrong algorithm
>
> 2- long waits (database, files, network, etc.)
>
> 3- heavy calculations
>
>
> Solutions:
>
> 1- find and use a different algorithm
>
> 2- Try to parallelize code (with gearman or similar, or via pctnl_fork)
>
> 3- rewrite the heavy functions in C, C++ or Go and compile them, then call
> them via PHP extensions or via gearman/fork.
Another thing you can do is store both page "renders" as well as database results in http://memcached.org/ blobs and pull from those in intelligent ways
(you can creatively mix and match "live" stuff with cached stuff and you can make pages
expire in defined hours via your cache class or even a crontab).
We also add another layer in that if a blob exists in the memecached but not locally, we save it
locally for the next hit. Depending on your hardware though the Gigabit/Fiber might be faster access
than a local HD/SSD/RAM disk, so YMMV.
We use LAMP and our site gets > 30,000 hits per SECOND on two servers and 5 pools.