2

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?

ursitesion
  • 988
  • 2
  • 15
  • 26

1 Answers1

1

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.

Valentin Despa
  • 40,712
  • 18
  • 80
  • 106
  • Many Thanks Valentin for clarification. In my system, there is no provision for guest user. Only after login, a user can enter into the application. Also, when I execute the query give by you, I found that there are only few users for which count >=4. Maximum users have 1-2 count only. Even, execution of this script, there is a difference between logged-in users displayed in admin section (1966) and number of records fetched after execution of the above query (1579). How can I manage the session lifetime in my application? – ursitesion Dec 10 '13 at 08:07
  • In Jooma -> Global Configuration -> System -> Session Settings (should be something similar in 1.5.) – Valentin Despa Dec 10 '13 at 08:35
  • Thanks, I got the settings and found that session lifetime is 120 minutes. – ursitesion Dec 10 '13 at 12:47