I am working on a not so big project (3 bundles I created and 6 I downloaded / 5 Entities) and I have placed this code on my home controller :
class HomeController extends Controller
{
public function indexAction()
{
$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
echo $time;
die();
//...
It's giving me under 100ms on the localhost (with APC enabled) which is fine.
The real problem is the behavior on the online server (using prod env and APC not installed) : If I don't use the website for like 10 minutes, the first time it is really slow to load (2 to 4 seconds) and then if I stay on the website, if I refresh the page, it is way faster (from 500ms to 1s).
Is that normal ? Is there something wrong with my online server or my symfony2 project ?
You should definetly setup APC to decrease the loading time. Here's a note on that:
Performance
(2015 edit: link updated)
Just have a look at the timeline tab of the great toolbar / profiler which Symfony provides: http://symfony.com/blog/new-in-symfony-2-2-new-stopwatch-component (not limited to 2.2)
Are you using localhost as the database_host? If so, try 127.0.0.1 instead!
Are you accessing a third party API like Facebook (FOSUserBundle)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With