Monday, February 27, 2012

XDebug is not suitable for production environments

XDebug PHP extension, is a great, open-source debugger and profiler for PHP. It is a good alternative to the commercial Zend server. XDebug besides its profiling capabilities, it adds full stack traces to PHP error messages when enabled.These include Fatal Errors and Warnings.

however it is not suitable for production environments as Zend server is. 

Few people recommend that using XDebug on demand (remote debugging) does not harm server performance but there are major flaws here.

1. Basically  Xdebug comes with simple command line client for the DBGP protocol. We append  XDEBUG_SESSION_START in url and php script get that query string and xdebug start debugging and print output.

2. XDebug keeps traces in memory, which can lead to “out-of-memory” errors in

3. Imagine if php had to create a 100MB file for every request. By turning on xdebug.profiler_enable_trigger, you can at least selectively run the profiler.

4. Even when the profiler is off, the other primary function of xdebug (detailed stack traces on errors) causes your php instance to track lots of extra information slowing down execution. On a recent real world example where I turned on xdebug temporarily (with profiler off) and then shut it off, xdebug caused average response time to go from 400ms to 700ms.

5. There is still a bit (of overhead), about 10%. Xdebug 2.2 (currently SVN-only) have some improvements for this with (xdebug.coverage_enable=0) checkout this

No comments:

Post a Comment