Joomla 1.5 : How to find number of concurrent / active users in my joomla based intranet system

791 views Asked by At

I have a Joomla 1.5.10 based Intranet system. Sometimes we see that number of DB threads are too high and performance become down. When I checked through Administrator section, I can see the number of logged-in users only. These number is between 1000-5000 only. is it correct to execute below query to find the concurrent active users:

select count(*) from jos_session;

For example, If I execute above query and check the logged-in user through administrator, below is the data:

select count(*) from jos_session; = 2628
logged-in users visible from admin section = 1545

Both results are not matching each other. Also, what is the best way to find the concurrent / active users in my system at a time?

1

There are 1 answers

3
Valentin Despa On

I think just by analizing __session you won't get the info you need / want. If you need to understand what you see in back-end, check the module located at:

administrator\modules\mod_status\mod_status.php

There are all the queries listed. Important is to understand that guest is an user which is not authenticated, and also client_id (front-end (0) VS backend authentication (1)).

Here is the thing:

  • jos_session stores all the sessions that have not expired
  • probably you have a SSO authentication mechanism, which means that the user probably get a new session id if it closes and opens again the browser. Having more active sessions than users it's a clear sign that the session expiration time is set to high.

Just do a query against the jos_session:

SELECT `username`, count(username) FROM `jos_session` WHERE 1 GROUP BY `username`

If too many users have a too large value for count, reduce the session lifetime.

This way you will get a more realistic figure on how many users are at a certain time in the system, but again this is just a session, it does not provide you with exact information on how many users are actually performing an action on a website.

To put it in plain English is like saying: I know that 1500 users opened the Intranet in the last [FILL IN SESSION LIFETIME] minutes.

Session settings

You need to understand how exactly do the DB threads get generated and why the value is high.

Basically, quoting the documentation, The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close().

Might be worth checking if you have something like a JavaScript polling your server with AJAX requests to get some info, which might run even if the user just has the browser open.

Hope this helps in a way or another.