Welcome Guest, Not a member yet? Register   Sign In
Faster Application
#1

[eluser]Mareshal[/eluser]
How can I make my application faster? at this moment: "Page loaded in: 0.2190 :: Server is using: 2.15MB" and is not good enough. I have BambooInvoice and I simply added benchmarking to it, just to test and is using only 2.08MB ram. and faster loading time than mine... and mine is not even ready, or a final version. I can't cache the page since is working with sql and is in admin panel. I tried to cache sql but takes me +0.2MB RAM.

And, I forgot, page load time measured with a firefox plugin is 1.5 sec.

Any solution?
#2

[eluser]Wuushu[/eluser]
You mention SQL.. my bet is on poorly optimized queries, or lack of indexes. Have you tried enabling the Profiler?

$this->output->enable_profiler(TRUE); in your controller.. then report back here with the results.
#3

[eluser]Mareshal[/eluser]
URI STRING
/manager/settings/ban_unban_ips

CLASS/METHOD
settings/ban_unban_ips

MEMORY USAGE
2,329,864 bytes

BENCHMARKS
Loading Time Base Classes 0.0783
Controller Execution Time ( Settings / Ban Unban Ips ) 0.1373
Total Execution Time 0.2159

GET DATA
No GET data exists

POST DATA
No POST data exists

DATABASE: elite_monitor QUERIES: 2
0.0027 SELECT *
FROM (`ig_elite_banned_ips`)
WHERE `flag` = 0
ORDER BY `time_stamp` desc
0.0010 SELECT *
FROM (`ig_elite_banned_ips`)
WHERE `flag` = 1
ORDER BY `time_stamp` desc
#4

[eluser]Wuushu[/eluser]
Then it's not queries or lack of indexes.. what is going on in the controller that is taking so long? Any heavy looping or.. cURL'ing or anything else?
#5

[eluser]Mareshal[/eluser]
this is my code

Code:
$this->load->helper('url');
        $this->load->model('settings_model');
        $this->load->model('loader_model');
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<span style="font-size: 10px; color: red;">', '</span>');
        $this->output->enable_profiler(TRUE);


function ban_unban_ips()
    {
        //$this->output->cache(1);
        
        $session_id = $this->session->userdata('session_id');
        
        if($this->input->post('token') === $session_id){
        
            $this->add_banned_ip();
        
        }else{
            
            $return['banned_ips'] = $this->settings_model->_get_ips(0, 'time_stamp', 'desc');    //get banned ips
            
            $return ['allowed_ips'] = $this->settings_model->_get_ips(1, 'time_stamp', 'desc');    //get ips which are allowed to access manager panel
            
            $this->load->view('manager/settings/ban_unban_ips', $return);
            
        }
        
    }

and that page is just making _get_ips() from settings_model
Code:
function _get_ips($flag = '', $field = '', $order = ''){
        
        if(isset($flag))    $this->db->where('flag', $flag);
        
        if(isset($field) && isset($order)) $this->db->order_by($field, $order);
        
        return $this->db->get('banned_ips');
        
    }
#6

[eluser]Wuushu[/eluser]
That is indeed very strange... have you tried with a cacher for the server.. like APC or anything the like?
#7

[eluser]Mareshal[/eluser]
I am running this on localhost - xampp. I can't install APC(don't know how Big Grin) but should work without that. because not every host has APC installed
#8

[eluser]Wuushu[/eluser]
Sorry then i dont know why, could be because of your localhost configuration? I'm not sure.. with only 2 queries on my server, im seeing loadtimes on about 0.015s, 0.8MB memory consumption
#9

[eluser]Mareshal[/eluser]
$autoload['libraries'] = array('database', 'session');

If I am deleting database from autoload I get -0.6MB ram. My laptop is intel, core duo 2 ghz, 2GB ram
#10

[eluser]Yorick Peterse[/eluser]
- Use a cache system, such as MP_Cache or CodeIgniter's built in cache system
- Optimize your PHP :

This

Code:
if($this->input->post('token') === $session_id){        
    $this->add_banned_ip();        
}

is slower than this


Code:
$token = $this->input->post('token');
if($token === $session_id){        
    $this->add_banned_ip();        
}




Theme © iAndrew 2016 - Forum software by © MyBB