Seravo / wp-vagrant

Vagrant box for the Seravo WordPress project template
https://seravo.com/docs/
MIT License
18 stars 3 forks source link

XDebug shouldn't be enabled by default due to performance #16

Closed anttiviljami closed 4 years ago

anttiviljami commented 8 years ago

Thanks Janne from kehittämö for finding out this bug

ottok commented 8 years ago

This is bug report is invalid.

First of all this WP Vagrant image is only for development, there is no need to optimize performance here. Secondly XDebug is installed yes, but is only does profiling when get parameter XDEBUG_PROFILE=1 is present.

The production environment does not have XDebug installed at all, and that is where performance matters.

The feature is documented here: https://docs.wp-palvelu.fi/development/xdebug/ The documentation however could be extended and the RADME.md in this repo should advertise the existence of dosc.wp-palvelu.fi

anttiviljami commented 8 years ago

This is a verified performance issue.

Tested with a real multisite installation, disabling the plugin gave a significant performance improvement from 1-3 seconds per page to around 200ms.

ottok commented 8 years ago

How slow is it then when you run the actual profiling with ?XDEBUG_PROFILE=1 Xdebug also does other things, like provide extended error messages and stack traces.

Disabling Xdebug from everybody's development environment because it slows down somebody's development environment in isolated cases would be a huge trade-off.

anttiviljami commented 8 years ago

Just ran some tests on the kehittamo box front page php.

xdebug.ini disabled avg: 0.531s xdebug ini enabled, no ?XDEBUG_PROFILE avg: 1.546 xdebug ini enabled, with ?XDEBUG_PROFILE avg: 2.793

onnimonni commented 8 years ago

If it's on by default it lowers the barriers to use it. The box could have option to disable it in config.yml. Or it could have another php backend (possibly hhvm) which doesn't have any debug options.

Ofc it's annoying if it's that slow, but I wouldn't change the default setting to be something else than the current one.

anttiviljami commented 8 years ago

It's not just annoying, on slower machines the current situation is almost unbearable.

I would suggest a small script in vagrantfile to either enable or disable xdebug via a config.yml option. The default can be on, but it needs to be documented that it may slow down your dev site.

wp-vagrant box seems to be suffering from other performance issues on some machines as well. might have something to do with virtualbox...

ottok commented 8 years ago

Installation dialog / documentation / config option seems to be the correct way to approach this.

Vagrant is anyway slow because it is a Virtual Box virtual machine, it accesses the files via weird mounts etc.. Vagrant version 2 can support also Docker as a provider, that would be much faster at least on all Linux machines: https://www.vagrantup.com/docs/docker/

ottok commented 8 years ago

@anttiviljami What would your benchmark show if the debugger was shut off by disabling line https://github.com/Seravo/wp-vagrant/blob/master/roles/xdebug/templates/20-xdebug.ini.j2#L26 ?

Maybe the performance hit is caused by the debugger being active? Most people don't use the debugger. If having it running is the fault, then I'd be OK by making it off by default, but easy to enable (the config is already there, user just need to make one switch). The rest of xdebug could be kept enabled.

anttiviljami commented 8 years ago

checking now..

anttiviljami commented 8 years ago

With xdebug.default_enable = 0 average front page load is 1.532s. Sadly, that's not a significant improvement.

anttiviljami commented 8 years ago

Tried fiddling around with all the xdebug conf options, but nothing seemed to make a real difference. Looks like the only viable option is to have a configuration option. (I would suggest adding a prompt within vagrant up) to ask whether to enable xdebug or not.

ottok commented 8 years ago

Re-opening. Vagrant is still slow and disabling XDebug is one of the biggest single items that decreases Virtualbox I/O.

anttiviljami commented 8 years ago

I think it must be a separate issue. Vagrant works beautifully fast for me right now, even with XDebug enabled. Could you post your system information here? Virtualbox, Vagrant, OS versions?

ottok commented 6 years ago

One solution would be to implement #39 and then run Vagrant with XDebug off by default.

ottok commented 6 years ago

Test from latest seravo/wordpress-beta Vagrant box:

vagrant@vagrant:~$ wp-xdebug-off
...
All versions of PHP restarted!
vagrant@vagrant:~$ wp-speed-test 
Testing speed URL https://seravocom.local...

URL                       TOTAL NAMELOOKUP CONNECT APPCONNECT PRETRANSFER STARTTRANSFER    = AVG
...
https://seravocom.local   0.381      0.000   0.000      0.000       0.000         0.381    0.436
https://seravocom.local   0.191      0.000   0.000      0.000       0.000         0.191    0.421
https://seravocom.local   0.294      0.000   0.000      0.000       0.000         0.293    0.413
https://seravocom.local   0.329      0.000   0.000      0.000       0.000         0.329    0.408
https://seravocom.local   0.212      0.000   0.000      0.000       0.000         0.211    0.398
https://seravocom.local   0.195      0.000   0.000      0.000       0.000         0.195    0.388
...

vagrant@vagrant:~$ wp-xdebug-on
...
All versions of PHP restarted!
vagrant@vagrant:~$ wp-speed-test 
Testing speed URL https://seravocom.local...

URL                       TOTAL NAMELOOKUP CONNECT APPCONNECT PRETRANSFER STARTTRANSFER    = AVG
...
https://seravocom.local   0.381      0.000   0.000      0.000       0.000         0.381    0.559
https://seravocom.local   0.491      0.000   0.000      0.000       0.000         0.490    0.555
https://seravocom.local   0.397      0.000   0.000      0.000       0.000         0.396    0.546
https://seravocom.local   0.577      0.000   0.000      0.000       0.000         0.576    0.547
https://seravocom.local   0.374      0.000   0.000      0.000       0.000         0.374    0.538
https://seravocom.local   0.386      0.000   0.000      0.000       0.000         0.385    0.531

The overhead of Vagrant is about 200 milliseconds of 2x in this example.

ottok commented 5 years ago

Xdebug off is recommended here in case of slowness: https://seravo.com/docs/development/vagrant-box/#if-you-experience-slowness

ottok commented 4 years ago

https://seravo.com/docs/get-started/release-notes/#vagrant-box-seravowordpress-2019100800

XDebug is disabled by default to improve PHP speed. Run wp-xdebug-on to enable it