• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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) ?
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic