CodeIgniter Forums
too slow, ~12 sec for load - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: too slow, ~12 sec for load (/showthread.php?tid=32549)

Pages: 1 2 3


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidino86[/eluser]
Hi all,

http://portobello.bitnet.it/

this is a site that i'm trying to get it faster, now for complete the request it takes about 12 second i don't think is normal.

the site is on a windows server 2003 with mssql for db, i set the pconnect of CI to false, i don't know if is enough for you to help me.

it takes too long for load any pages at the beginning, why?

thanks for the help.


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidbehler[/eluser]
Code:
$this->output->enable_profiler();
Put this in the code of a slow site. This might help you find what's taking so long.


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidino86[/eluser]
i put the code in the home controller if you want you can go at site from the link above, because i don't understand wich is the thing that runs the site too slow...thanks


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidbehler[/eluser]
I was expecting to see a query or two that take very long but they look fine.

Any special operations in your controller?

Posting some code might make it easier for us to see what's up.


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]gyo[/eluser]
First of all, the homepage weighs more than 1mb.
In fact after the first load, the other pages are much faster.
You should definitely optimize images+css+js.
Add Gzip encoding too.

As additional test, you could contact your hosting provider and ask them to give some info about it.
They might confirm you if your application is actually wasting too many resources, or not.


Hope it helps!


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]gyo[/eluser]
Also, I can quickly suggest you to convert those two side banners (which are now PNGs) into JPGs.


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidbehler[/eluser]
The profiler showed, that it took the controller about 17sec to do his job...that's before the browser even gets an answer and starts loading the files.


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]gyo[/eluser]
I can't see the profiler but I get your point, it's a different story.

How many queries was the DB doing?
I think it should be benchmarked on localhost too.
If possible, also try a Linux server.
And the assets optimization I suggested is still valid. Wink

Btw, if nothing fixes the issue, there must be some mistake in your code... impossible to guess. Big Grin


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidbehler[/eluser]
You are right, the assets optimization is still a valid option and he should definetly do this. Apart from that we'll have to wait for some code Smile


too slow, ~12 sec for load - El Forum - 07-27-2010

[eluser]davidino86[/eluser]
here i'm, sorry!

i put the output profile once again, and here the code of the home controller


the first part

Code:
<?php

Class Home extends Controller
{

    public function __construct()
    {
        parent::__construct();
        //$this->output->cache(5);
        //Load necessary library
        //$this->lang->load('freakauth');
        $this->load->library('FAL_front', 'fal_front');
        $this->load->library('cart');
        $this->load->model('image_model');
        $this->load->model('categories_model');
        $this->load->model('companies_model');
        $this->load->model('banner_model');
        $this->load->model('news_model');
        $this->load->model('supplier_model');

  

        $this->load->model('annunci_model', 'annunci');
        $this->load->helper('image_helper');

        if ($this->freakauth_light->isValidUser() == FALSE)
            {
                $this->login_small();
            }


        if ($this->uri->segment(1) == 'shop' || $this->uri->segment(1) == 'cart')
        {
            $this->all_shop_companies();
             $this->template->write_view('header', 'inc/shop_header');
          
        }else{
            $this->all_products_by_category();
            $this->template->write_view('header', 'inc/main_header');
             //$this->random_products_header();
        }


        $this->menu();
        $this->vetrina();

        $this->banner_left();
        $this->banner_right();


    }

    function index()
    {

        $this->output->enable_profiler(TRUE);

        //Set the main view for the home page
        $this->template->write('title', ' Il portale di riferimento per il tuo centro di bellezza:
solarium, centri estetici, parrucchieri e molto di più!
');
        
        


        //Load the Box Views in the home page in view order --------------------
        if ($this->freakauth_light->isValidUser() == FALSE)
            {            
                $this->welcomePanel();
            }
            
            $this->bestAds();
            $this->latestNews();
            $this->mission();
        //----------------------------------------------------------------------

        $this->template->render();
    }

    function banner_left()
    {
        $data = $this->banner_model->get_random_ver_banner();

        $this->banner_model->update_banner_impression(mssql_guid_string($data['ID_Banner']));
        $this->template->parse_view('banner_left', 'inc/banner_ver_view', $data);
      
    }

    function banner_right()
    {
        $data = $this->banner_model->get_random_ver_banner();
        $this->banner_model->update_banner_impression(mssql_guid_string($data['ID_Banner']));
        $this->template->parse_view('banner_right', 'inc/banner_ver_view', $data);
    }

    /*function banner_oriz()
    {
        $data_banner_oriz = $this->banner_model->get_random_oriz_banner();
        $this->banner_model->update_banner_impression(mssql_guid_string($data_banner_oriz['ID_Banner']));
        
    }*/

    function welcomePanel()
    {
        $this->template->write_view('content', 'panels/welcome_panel');
    }

    function mission()
    {
        $this->template->write_view('content', 'panels/mission_view');
    }