Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2: Slow page loads

Tags:

php

symfony

I am attempting to setup Symfony2 on an Ubuntu virtual host. However even the simple hello world page is taking around 7-8 seconds to load. I have tried running other applications such as PhpMyAdmin and they are running fine but i cannot figure out why symfony is taking so long to load.

Here are some webgrind results: Web Grind Results

Im sorry i cant provide any more information at the moment but im not sure where to look. Thanks in advance.

Daniel

like image 665
Daniel Cannon Avatar asked Mar 09 '11 21:03

Daniel Cannon


1 Answers

Try disabling Xdebug completely.

I noticed in Symfony 1.3 / 1.4 that my page loads took 40%+ longer to load when Xdebug's profiler was running. I haven't tried Xdebug with Symfony 2.0 yet, but I imagine similar results would ensue.

The problem is that Symfony is a large framework that does a lot of background processing for you. When Xdebug is profiling this, your pages will take a lot longer to load.

Your best bet is to download a plugin for your browser that allows you to send the profiler flag to the server only when you need to use it. Xdebug can be setup to profile on request.

Here are my current Xdebug configurations on my development box:

xdebug.remote_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req

xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "c:\var\profile\"
xdebug.profiler_output_name = "cachegrind.out.%t"
like image 170
Craige Avatar answered Nov 03 '22 21:11

Craige