| Author |
Count number of users accesing the web application
|
yekkala krishna
Ranch Hand
Joined: Mar 04, 2007
Posts: 105
|
|
Hi,
In our web application we are using servlets,jsp and spring technologies.Here we are also maintaining session mechanism in our application.But now i need to count number of users accessing our web application at a time. How can i implement this mechanism if anybody having idea please suggest me.
Regards,
Rama Krishna.Y
|
 |
Sriram Ture
Greenhorn
Joined: Aug 20, 2010
Posts: 23
|
|
Hi,
You can write a session listener for your application.
The code looks like this.
|
 |
yekkala krishna
Ranch Hand
Joined: Mar 04, 2007
Posts: 105
|
|
Hi Sriram,
Thanks for your suggestion.
Now i am able to count number of active and inactive sessions.
regards,
Rama Krishna.Y
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Are you not handling Guest users ??
Your coding is as such that :
If a User opens a Web page you cant create a Session for him , until he logs into the web site .(He may open the web page just to browse , without logging in )
I think you have got the point i am mentioned .
|
Save India From Corruption - Anna Hazare.
|
 |
Virendrasinh Gohil
Ranch Hand
Joined: Jun 09, 2004
Posts: 46
|
|
Ravi Kiran V wrote:Are you not handling Guest users ??
Your coding is as such that :
If a User opens a Web page you cant create a Session for him , until he logs into the web site .(He may open the web page just to browse , without logging in )
I think that depends on the business scenario whether Yekkala Krishna wants to know number of concurrent users or number of concurrent active request? If it's active users, sriram's reply is sufficient but if it's number of active request, you may choose ServletRequestListener instead.
One more modification, I would prefer to use AtomicInteger instead.
|
 |
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
|
|
JAMon is an api that counts things and lets you display them on a web page. For example you can count and time web page accesses, sql calls and more without changing your code. Here is an example of how you can track sessions.
http://jamonapi.sourceforge.net/httpsession_sample.html
|
http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
|
 |
 |
|
|
subject: Count number of users accesing the web application
|
|
|