phpeacceleratorzend-optimizer

Good optimizer for CPU and memory intensive command line PHP scripts?


I have optimized the scripts at most possible bottlenecks. It is difficult to port the code to other language, so that is not a good solution.

are there any opcode generators, optimizers that I can use to optimize the peformance of these continuously running PHP scripts ?

They run from command line, not on apache.

/usr/bin/php myBatchProcessor.php 

Does eaccelerator or Zend optimizer work for command line scripts ? or any other suggestions ?


Solution

  • PHP "optimizers" are snake oil!

    "Optimizers" were only needed in the PHP4 era because of inefficiencies in the transformation from PHP source to the bytecode on which Zend Engine 1 ran. This is no longer an issue in PHP5. The modern derivatives of the PHP4-era products also perform bytecode caching, which is very helpful. Be wary of any product that claims it can make plain vanilla PHP faster. Especially for money.

    They run from command line, not on apache.

    Normally, as others have done, I'd recommend the APC bytecode cache, but APC does nothing for long-running scripts run at the command line.

    Are you sure that you already profiled your code and removed every possible bottleneck?

    If so, it might be time to take a stab at HipHop, a compiler that transforms PHP into C++ before creating an executable. It might not be suitable for your needs, as it's designed exclusively for serving HTTP requests.