cakephp 1.3 and php 5.3 performance improvement

I’ve been doing some profiling of my cake apps. Found a decent improvement.

For your production apps only

in core.prod.php change
        Configure::write(‘log’, true);
to

define(‘DISABLE_DEFAULT_ERROR_HANDLING’,1);
Configure::write(‘log’, E_ERROR | E_WARNING);

You don’t even know it (cuz it never logs) but because cake has backwards compatibility with php4, there are tons of notices and strict notices thrown that cake swollows.  Thing is, there are 300+ of these every request – thats 300+ extra method and stack increases each request.  The downside of my “fix” above is PHP warnings/errors will no longer be written to the tmp/logs/error.log – instead it will go to the generic php5-fpm /var/log log.  Which to me is way worth the perf increase.

I opened a ticket u can read if u want more info – this should be a no-issue in cake 2.0.

Want to profile your app? I highly recomend http://www.xdebug.org/docs/profiler and easy x-debug plugin for Firefox.  You can see my post on setting up a debugger for php and eclipse for more info.

Advertisement

1 thought on “cakephp 1.3 and php 5.3 performance improvement

  1. Nice! My app went from ~30 req/s to 35 req/s by disabling Cake’s error logging.I got an error when running shell tasks about DISABLE_DEFAULT_ERROR_HANDLING already being defined, but found it isn’t necessary to define the constant to get the nice speed bump šŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close