[imp] Correct way to measure amount of current users
Lord Apollyon
implist at paypc.com
Wed Sep 24 16:31:56 PDT 2003
> IŽm trying to find out how many users are logged into IMP at
> one instant and NOT using a MySQL query, so...
>
> Is it correct to count the number of "on-line" users in IMP by
> counting the session files in /tmp ??
>
> i.e.
> ls -l /tmp | grep sess | wc -l
Not really. You need to take into account the "age" of those sessions. If
the only session-based web-application on your server is IMP, then you can
probably get a fair idea of the number of current users using this
technique...
I'd do something like this:
find /path/to/session/files -name "sess_*" -amin -20 | wc -l
This limits the sessions matched to those which have been touched within
the past 20 minutes...
Given that this is a web application, you have no real way to truly
measure "usage" other than during the (brief) moments there is an actual
http(s) connection to your server. All you can do is make time-qualified
guesses. I'm always amused by how much energy goes into these functions,
and how much of a performance slag admins are willing to tolerate for it
(when using DBs for this purpose).
=Apollyon=
More information about the imp
mailing list