How to improve performance on codeigniter How to improve performance on codeigniter codeigniter codeigniter

How to improve performance on codeigniter


I think "Session: Class initialized using 'files' driver." taking time.

Files Driver:The ‘files’ driver uses your file system for storing session data.

AS per Codeigniter Session documentation you can change storage engine session in database or other places like files, redis, memcached.

$config['sess_driver'] = 'database';$config['sess_save_path'] = 'ci_sessions';CREATE TABLE IF NOT EXISTS `ci_sessions` (        `id` varchar(128) NOT NULL,        `ip_address` varchar(45) NOT NULL,        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,        `data` blob NOT NULL,        KEY `ci_sessions_timestamp` (`timestamp`));

Also, you can set absolute path :

To be more specific, it doesn’t support PHP’s directory level and mode formats used in session.save_path, and it has most of the options hard-coded for safety. Instead, only absolute paths are supported for $config['sess_save_path'].


I think I found the cause to my problem.

In fact, it is a rather heavy class that my controller was loading every time (registered_user - when I comment it, the program becomes much faster - )

public function __construct() {    parent::__construct();    $this->load->model('user_inscription');    $this->load->model('user_connexion');    $this->load->model('mouchard');    $this->load->model('synchronisation');    $this->load->helper('string');    $this->load->helper('form');    $this->load->helper('language');    $this->load->library('session');    //$this->load->library('registered_user');    $this->load->library('sendsms');}

and here is the class. It connects to an oracle database. I don't know why it takes so much time to instanciate.

class Registered_user {    private $query;    private $connexion;    public function __construct($host, $port, $serviceName, $user, $passwd) {        $baseLink = '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = ' . $host . ')(Port = ' . $port . '))) (CONNECT_DATA = (SERVICE_NAME = ' . $serviceName . ')))';        $this->connexion = oci_connect($user, $passwd, $baseLink);    }    public function getConnexion() {        return $this->connexion;    }    public function setQuery($query) {        /*set the query*/    }    public function getInfos() {        $stid = oci_parse($this->connexion, $this->query);        oci_execute($stid);        $row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS);        return $row;    }}