RE: Re: Compiler for the PHP code (memecached)

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

 




> -----Original Message-----
> From: Alessandro Pellizzari [mailto:alex@xxxxxxxxx]
> Sent: Tuesday, March 19, 2013 2:06 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  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.



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