• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Count number of users accesing the web application

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can write a session listener for your application.

The code looks like this.

 
yekkala krishna
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sriram,

Thanks for your suggestion.
Now i am able to count number of active and inactive sessions.

regards,
Rama Krishna.Y
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Virendrasinh Gohil wrote:

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.



ServletRequestListener will only give the total count of request in web application scope. However, that count will be more than the number of users(Guest + Member) as each user may have more than one request.

How to find out the total count of users (Guest + Member) ?
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic