I have requirements in my application to show below:
1. Number of active users
2. Number of users who accessed the web site
I have searched the code ranch forum and googled and have below questions.
For 1. Number of active users
I am thinking of counting the number of active sessions using HttpSessionListener. The only question was how to account for users who do not login and thus there is no session created for them.
For 2. Number of users who accessed the web site
Persist a count in DB to store the number of users in a app_statistics table. This approach can account for requirement 1) also.
I think it might be doing too much for a small requirement. But I would like to hear what other people have to say and how they have handled it in their applications.