View Issue Details

IDProjectCategoryView StatusLast Update
0001658XdebugUncategorizedpublic2019-07-19 11:39
Reporterclewis2019 Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version2.7.0 
Summary0001658: Very slow performance when xdebug extension is loaded, but not enabled
Description

Running simple php benchmark script, http://www.php-benchmark-script.com, which just loops over a series of string and math operations with php 7.0, 7.1, or 7.3, results in execution time being 6-7 times slower than without the extension loaded. This is on a centos 7 system.

strace -c shows:

% time seconds usecs/call calls errors syscall


90.93 0.239892 10 25066 gettimeofday
3.21 0.008480 13 678 21 stat
1.21 0.003205 10 308 mmap
0.79 0.002089 10 204 mprotect
0.69 0.001820 10 183 close

without xdebug loaded:

% time seconds usecs/call calls errors syscall


34.58 0.010055 15 677 20 stat
14.02 0.004075 13 305 mmap
9.18 0.002669 13 202 mprotect
8.52 0.002476 15 161 4 open
7.66 0.002228 12 182 close
6.67 0.001940 12 165 fstat
4.77 0.001386 10 138 munmap
4.57 0.001330 12 110 read
2.35 0.000684 15 47 3 lseek
2.18 0.000635 14 44 getdents
2.16 0.000628 15 43 43 ioctl
1.23 0.000357 16 22 openat
0.42 0.000121 15 8 3 lstat
0.37 0.000108 3 31 brk
0.22 0.000064 13 5 3 access
0.22 0.000063 6 11 write
0.21 0.000062 31 2 statfs
0.17 0.000048 10 5 rt_sigaction
0.09 0.000026 3 9 gettimeofday
0.07 0.000021 11 2 rt_sigprocmask

/etc/php.d/xdebug.ini:

;zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.profiler_enable=0
xdebug.default_enable=0
xdebug.profiler_enable_trigger = off

Steps To Reproduce

run attached script with or without xdebug extension enabled:

Additional Information

I was expecting that with xdebug loaded, but not triggered, the performance would be roughly the same as with it not loaded, but that is not what I have experienced.

Tagsperformance
Operating Systemlin
PHP Version7.0.20-7.0.24

Activities

derick

2019-04-21 15:03

administrator   ~0005003

The gettimeofday issue (top of your list), should be fixed in Xdebug 2.7.1: https://bugs.xdebug.org/view.php?id=1641 — Will you please try that?

Besides that, Xdebug does have quite a bit of overhead, even it's enabled. I hope to fix that in Xdebug 3.0, as outline at https://derickrethans.nl/xdebug-experience.html

clewis2019

2019-04-21 21:16

reporter   ~0005005

I followed your suggestion and compiled the 2.7.1 version, but did not see any improvement: the overall performance was still about 6 times slower.

The number of gettimeofday did not change.

% time seconds usecs/call calls errors syscall


90.81 0.248393 10 25066 gettimeofday

huguesalary

2019-07-18 00:07

reporter   ~0005068

I am also running into this issue.

I was using PHP 7.0 with xdebug 2.5.0 with no slowness when the extension was loaded and not enabled, but now, using PHP 7.3 with xdebug 2.7.1 and 2.7.2 (the 2 versions I tried) my application becomes extremely slow.

I originally reported this issue here https://bugs.xdebug.org/view.php?id=1685 thinking I was running into another problem.

derick

2019-07-19 11:39

administrator   ~0005073

I am closing out this issue, as there is no actionable issue here. I am reviewing Xdebug's performance for Xdebug 3.0.