enabling xdebug remote debug makes apache server very slow

后端 未结 11 443
野的像风
野的像风 2020-12-02 12:03

If I enable xdebug by settting xdebug.remote_enable=1, the apache server becomes very slow; once I change the setting to 0, it\'s normal.

I

相关标签:
11条回答
  • 2020-12-02 12:32

    For me I had

    xdebug.remote_connect_back = 1
    

    which slowed everything and stopped remote debugging from working. Once I remove it, everything works fine.

    0 讨论(0)
  • 2020-12-02 12:35

    In my case this was caused by having

    xdebug.remote_autostart = 1
    

    set in php.ini. That causes xdebug to try to connect to remote debugger on every request. I had some PHP handled styles, auto_preppend_file and other PHP files in the request and for each of them it waited approximately 2secs, which added up to sth. like 15 seconds or so. Setting

    xdebug.remote_autostart = 0
    

    solved the problem completely. xdebug connects only when debug cookie is present. Please note you need to remove the debug cookie/param if you are not in debug session for this fix to work.

    Here is my config that I use to setup xdebug.

    0 讨论(0)
  • 2020-12-02 12:37

    Also, if you do want to leave xdebug.remote_autostart = 1 enabled all the time, in your Phpstorm settings try increasing the max simultaneous sections. This should reduce hanging and blocks, but will still result in a performance impact based on my experience.

    0 讨论(0)
  • 2020-12-02 12:39

    In my case low performance was caused by having 200+ breakpoints set in PHPStorm which were evaluated on every request by xdebug.

    Clearing those breakpoints in PHPStorm increased perfomance from 60 sec to 6 sec per request.

    0 讨论(0)
  • 2020-12-02 12:41

    It's likely that there are some networking timeouts that happen here. The best way to find out what's going wrong is to try to debug a command line script. If that still has the same issue, then use strace to see what it is hanging on:

    export XDEBUG_CONFIG="idekey=yourname"
    strace -tt -o /tmp/strace.log php full/path/to/script.php
    

    Then have a look at /tmp/strace.log and see where the slow down happens.

    0 讨论(0)
  • 2020-12-02 12:42

    Experienced also low performance with XDebug (loading Captcha in 6 seconds instead of milliseconds) Remarks on this page got me on the way to identify the cause.

    Turned off the profiler and loading time was divided by 3. Still slow, but better already.

    xdebug.profiler_enable = 0
    
    0 讨论(0)
提交回复
热议问题