سؤال

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 ?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

You can install APC and enable APC for command line caching. Make sure! to disabled APC for your webserver in that case otherwise the two will clash.

Don't expect too much from APC as the opcode generation usually isn't the part that slows your script down, look at profiling your scripts.

edit:
Add these settings to your config file:
apc.enabled = 1
apc.enable_cli = 1

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top