First loading of a page takes 4-5 seconds

Hello,

I’m working on my first yii big site with many database records. Currently I’m developing it on a shared hosting I’ve used for many years and didn’t met such problem.

So, when I open a page for a first time for the last ~10 minutes it takes 4-5 seconds to load. Next time it’s milliseconds. First I thought it’s caused by a database query and turned on the query profiler, but there are no slow queries, so just started to test on a page without database. When I turn on the logger for all system classes, it shows more than a second between the loading of the assets manager and the next class. But if I delete immediately the assets and reload it, it just loads for milliseconds. Then I commented the assets on the page I’m testing, waited ~10 minutes and it again takes a couple of seconds to load.

I noticed when I put Yii::beginProfile(‘view’) before and Yii::endProfile(‘view’) after $this->render(‘test’) most of these seconds are for the “view” label, but if I profile everything in the layout, it just shows less than a millisecond so maybe the problem is somewhere in the rendering script.

I also launched the site on a wamp, but without any caching engine (the shared hosting has eAccelerator) - and it doesn’t have such problem, just every reload takes about 50ms, but it’s ok, my computer is slow. Any ideas? I could provide more information if needed.

Thanks,

Ivo