View Issue Details

IDProjectCategoryView StatusLast Update
0001658XdebugUsage problems (Wrong Results)public2019-04-21 21:16
Reporterclewis2019Assigned Toderick 
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionopen 
Product Version2.7.0 
Target VersionFixed in Version 
Summary0001658: Very slow performance when xdebug extension is loaded, but not enabled
DescriptionRunning 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 Reproducerun attached script with or without xdebug extension enabled:

Additional InformationI 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

clewis2019

2019-04-21 14:48

reporter  

bench.php (3,175 bytes)

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

Issue History

Date Modified Username Field Change
2019-04-21 14:48 clewis2019 New Issue
2019-04-21 14:48 clewis2019 Tag Attached: performance
2019-04-21 14:48 clewis2019 File Added: bench.php
2019-04-21 15:03 derick Assigned To => derick
2019-04-21 15:03 derick Status new => feedback
2019-04-21 15:03 derick Note Added: 0005003
2019-04-21 21:16 clewis2019 Note Added: 0005005
2019-04-21 21:16 clewis2019 Status feedback => assigned