• Post Reply Bookmark Topic Watch Topic
  • New Topic

No. of concurrent users or sessions through servlets.  RSS feed

 
Harry Singh
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurus,
I have just started learning servlets and various questions have started evading my mind.. sojust wanna share those questions. Well first of all
1. How can we check the number of sesions that a webapplication currently executing? is there any way by which we can check this through servlet specifications or we will have to take place of counter variable.
2. Can we check through servlets, how many maximum concurrent users that a website can support? or by any other means we can get to know this..As per my understanding there must be a saturation level that a website can support so how can we get to know this. Does servlet container can give some info on this?
3. we always use Request & response objects in servlets... so does that means we do have some concept of these objects pooling as well like we have database connection pooling.
4. Any way of checking the max number of DB connections that a DB can support through servlets? Though this is immaterial as almost all app servers support Connection pooling, but then no harm in discussing about this?
Thanks in advance..
Regards,
Harry
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How can we check the number of sesions that a webapplication currently executing? is there any way by which we can check this through servlet specifications or we will have to take place of counter variable.

There is no support for this in servlet spec. The vendow may provide its own API for this. You can also use sessionlisteners to keep track of the count.
2. Can we check through servlets, how many maximum concurrent users that a website can support? or by any other means we can get to know this..As per my understanding there must be a saturation level that a website can support so how can we get to know this. Does servlet container can give some info on this?

Yes there is a limit. I guess it is limited by the resources - memory, threads , hardware etc. I dont know think servlet container can provide you any info on this ... may be some other tool will.

3. we always use Request & response objects in servlets... so does that means we do have some concept of these objects pooling as well like we have database connection pooling.

Containers can reuse the request and response objects.. I dont think any container provides you an oprion of configuring the pool size.. You cannot compare it with database connection..connection objects are costly to create.

4. Any way of checking the max number of DB connections that a DB can support through servlets? Though this is immaterial as almost all app servers support Connection pooling, but then no harm in discussing about this?

Try creating connections in a for loop and you will know when the program crashes.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. How can we check the number of sesions that a webapplication currently executing? is there any way by which we can check this through servlet specifications or we will have to take place of counter variable.

Yes, we have to count by ourself, using HttpSessionListener.

2. Can we check through servlets, how many maximum concurrent users that a website can support? or by any other means we can get to know this..As per my understanding there must be a saturation level that a website can support so how can we get to know this. Does servlet container can give some info on this?

That's server-specific... We can set the maximum sessions allowed by configuring the server... You might want to view the following thread, in which we discussed about that as well...
http://www.coderanch.com/t/357396/Servlets/java/session


3. we always use Request & response objects in servlets... so does that means we do have some concept of these objects pooling as well like we have database connection pooling.

No no, they are destroyed when a certain kind of processing and reponding to the client is done... They are not pooled...

4. Any way of checking the max number of DB connections that a DB can support through servlets? Though this is immaterial as almost all app servers support Connection pooling, but then no harm in discussing about this?

This question should be asked to a DBA... Frankly, I am not able to answer this question...
I guess maximum number of DB connections will be different in different DBs...
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No no, they are destroyed when a certain kind of processing and reponding to the client is done... They are not pooled...

Yes, I agree. Sorry for my mistake in my post.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!