Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
I am always concerned about performance, this is my question:

It seems, having a look at qa-page-question.php (or other files) that


is called in the beginning of the files.

This function creates a session (see users.php) with: qa_start_session();


Maybe I am missing something, but it seems that q2a is starting a session on the server for each visitor.

Isn't this a performance killer? (I hope I am wrong.)

2 Answers

+1 vote
selected by
Best answer
Yes, it does create a session for each "new visitor". Actually, By "new visitor" meaning a user who does not already have a session assigned in the server or has no valid cookie to send.

You will most likely need the session to perform many actions, regardless of whether you're logged in or not. EG: Take into account anonymous posting and, actually, most form posting that perform security checks. (Disclaimer: I can't confirm this as I haven't taken a look at the code, though... just using my memory here).

Regarding performance, I can say taking more actions per user in the server will always consume more resources. However, the performance you pay should be a fair price considering the features you can get. If you're still worried about performance then you can take a look at this section http://php.net/manual/en/session.configuration.php from the PHP user's manual.
Thanks for your confirmation.

Actually, I got this question with another non-q2a-project. There are "normal" pages but if clients visit these sites, they have to change their design. I have solved this by setting an extra cookie for clients at login and reading this cookie at first at the "normal" pages. If the cookie exists, only then start a session. Just my hack :)
0 votes
It's starting an session every time when an user is logging in and it's removing the session after logout.
But from the code I guess it is starting a session on each visit, please see qa-page-question.php