Welcome Guest, Not a member yet? Register   Sign In
Session processing degrades the performance greatly
#1

[eluser]joneslee[/eluser]
Can someone suggest me a way to detect why my 2 lines of code:

Code:
$this->session->unset_userdata('menu');
$this->session->set_userdata('menu', 'men');

runs fine on my local dev server but so so so slow on the live host?
#2

[eluser]Thorpe Obazee[/eluser]
Could it be that there are other things that might be affecting the speed?
#3

[eluser]joneslee[/eluser]
I double check and confirm the culprit is the session. I think it could have something to do with 4kb limit. Is there a way to check session size?
#4

[eluser]Thorpe Obazee[/eluser]
I believe Firebug can check it.
#5

[eluser]huuthanh3108[/eluser]
you can check it on firefox
#6

[eluser]joneslee[/eluser]
Could you show me how? I was googling around for the way
#7

[eluser]Thorpe Obazee[/eluser]
if you have firebug, you can see it in the cookies tab.
#8

[eluser]huuthanh3108[/eluser]
//file config.php add a line
// two value 'CI' or 'PHP'
Code:
$config['sess_mode']        = 'PHP';

and create file MY_Session.php in folder library: My_Session.php
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$CI = & get_instance();
if($CI->config->item('sess_mode') == "PHP")//config use session of PHP
{
    class MY_session
    {
        function MY_session()
        {
            session_start();
        }
        function userdata($name)
        {
            if($name == "session_id")
                return session_id();
            else
            {
                return isset($_SESSION[$name])?$_SESSION[$name]:'';
            }
        }
        function set_userdata($name, $value)
        {
            $_SESSION[$name] = $value;
        }
        function unset_userdata($name)
        {
            $_SESSION[$name] = '';
        }
    }
    
}
else//config use session CI
{
    class MY_session extends CI_session
    {
        function MY_session()
        {
            parent::CI_Session();
        }
    }
}
?>




Theme © iAndrew 2016 - Forum software by © MyBB