Link to home
Start Free TrialLog in
Avatar of LiquidIce911
LiquidIce911

asked on

Total number of active sessions

Is it possible to get the total number of active sessions for my website? I want to do this because I would like to see how many "guests" are on without having to add every single one to a database
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Well as security issues are often telling you to have a custom session handler it would be easy to count files or db-records as you will. This only is more cumbersome than just inserting hits into your database and selecting unique ip's.

Regards

-r-
Avatar of LiquidIce911
LiquidIce911

ASKER

If there is no way of getting the number of sessions what is the fastest way about handling this because my site may have up to 10,000 active users.
ASKER CERTIFIED SOLUTION
Avatar of maunded
maunded

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, forgot to add you need to change session handler in the php.ini from files to user (Took me a while to figure out why my sessions wernt going into the db :|)
I didnt want to write my own session handler but this raises another question .. is writing a SQL session handler faster than the standard file handler? My site will have thousands of users at a time and I would like to maximize as much speed as possible.
I guess you could always count the number of sess_* files in the session directory(/tmp).
:)
Im not sure about he speed, I used the sql session handler because I load balance my site across a few servers, and having file sessions just dosent work the way I want it to without using networked storage, which would be slower than a db query.