What type of session is Yii Default? And how to change?

My Application includes an dashboard with an lot of "stand-alone" content boxes. Every box updates the content using an Ajax request. 2 Boxes calls an heavy reporting function on server side, so the request needs 10 seconds to deliver the data to the client.

At this time, all other ajax connections are "blocked". The are started by the browser but will return the result after the long running request is finished.

Searching the web, what could happens here, i found: in most cases file-based session on PHP side is the reason for that.

So the question is: what type of session i’m using?

I don’t know, because it looks like, Yii starts a session by default in the background. And I use this session.

Is this session an file-based session? Is there an easy way to change that type to DB based or memcached-based?

//Edit: oh, i found this, which looks good.

http://programmersnotes.info/2009/03/05/speeding-up-yii-or-why-should-you-use-db-sessions/

Are there any contras, why not using DB Sessions?

Thank you, rall0r.

Since CHttpSession.autoStart defaults to true, then we can presume than you have session management enabled and running.

To find out how CHttpSession manages sessions, you can check out CHttpSession’s source code.

I’m assuming that your webapp uses DB, in that case I see no reason why not to use DB based sessions.

Changing configuration to use CDbHttpSession is very easy.

In your protected/config/main.php file:


	'components'=>array(

        	'session'=>array(

                	'class'=>'CDbHttpSession',

                	'connectionID'=>'db',

                	'autoCreateSessionTable'=>true,

        	),

 	),


NB! Be careful when using CHttpSession.sessionName property. Last time I tried to set it, it didn’t work, I was forced to use the default value.