We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Slow invo page load

Hi,

I installed invo app and it is fast and works very well. In fact all the pages a loading for 0.15 - 0.30 s except for invo/products/index page which loads for 1.20 - 1.80 s which is very big difference (I am starting invo on localhost with apache + php 5.4 on windows and I am measuring the time in Chrome with "Page load time" extension). Then I took a look at the code - here is the index action in the controler:

public function indexAction()
    {
        $this->persistent->searchParams = null;
        $types = array(array("id" => 1, "name" => "q"));
        $this->view->setVar("productTypes", ProductTypes::find());
    }

If I comment the ProductTypes::find() line ant the appropriate code in the view the page loads for 0.30 s. I cannot see any logic - in product_types table there are only 2 records! The last thing I can think of is the hasMany function which is used in the ProductTypes class but I commented the hasMany function and there wasn't any change in the page load time.

I would be very thankful if someone can help me to solve this mistery. I find this so important because if I cannot understand the reason for slowing down the page load in such a simple project there is no use in trying to make a bigger one and also the speed is the biggest advantage of Phalcon.



98.8k
Accepted
answer

Try changing localhost by 127.0.0.1 in the database host



7.9k

I tried but there is no difference. Tomorrow I will install it on a server to see if it will be quicker.



7.9k

I installed invo on a server and now invo/products/index loads as fast as the other pages. Thanks for the help :)