0

I am using cakephp framework for my application development and included the session component for session management in AppController

var $components = array('Session');

On each and every page reload CakeSession::_startSession is calling which takes merely 7.5 secs (don't know why), and also FileEngine::read() which takes 8.5 secs

enter image description here

Session statistics

enter image description here Note: these standards are given by performance tool

How can i improve my page performance as the session taking too much time

Please help me to get resolve this issue

I'm using cakephp version 2.30

Thanks in advance

Update

we got the below link when I've googled about the issue

session_start seems to be very slow (but only sometimes)

in answer it has the below function to call

session_write_close();   // close write capability

And the same we have in CakePhp 2.6 version (in CakeSession::_startSession()) where it's not in cake 2.3.0 (which I'm using currently)

So while comparing 2.3.0 & 2.6.0 versions, i found below code which isn't in version 2.3.0, Can i include this piece of code to resolve the Issue ?

self::init();
session_write_close();
self::_configureSession();

Please suggest me

Community
  • 1
  • 1
Anil kumar
  • 4,107
  • 1
  • 21
  • 36
  • 2
    So `833` means `8.33` seconds? Are you sure about that? Wouldn't `7,290` then mean `72.9` seconds? And your page calls really take more than 15 seconds? That sounds like you have some serious server issues, which you should debug further before asking a question here on SO, as it's rather unspecific and open-ended, all people can do is shooting in the dark. – ndm Jan 05 '16 at 08:23
  • Here the statistics are in **ms** i.e. 7,290ms @ndm – Anil kumar Jan 05 '16 at 09:19
  • Just as explanation: using session_write_close() and starting the session_start($session_id_of_previous_session) again is used to "reset" the session timout to the new value. Else clients are not notified about the new, extended session timeout. Else Clients and Server only keep the initial value. – powtac Dec 15 '16 at 12:10

1 Answers1

0

I guess, that the problem is the creating of the session itself - which is file based (writes to the file system). I solved this by using redis as session store (see this turtorial).

DIDoS
  • 812
  • 9
  • 23