• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Throttling requests

 
Nikhil Joshi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have one service which takes xml as input and returns pdf as output.
we want to throttle the requests to this service and queue up the subsequent request(In short we'll limit number of concurrent requests).

What can be the best approach for this solution? we are using websphere 6.ov application server.

we are thinking to use JMS with Websphere's default messaging service Queues (we don't want to use MQ)but challenge is to send the returned PDF to the respective requests. (To send response like we do in synchronous communication).

can some expert give any better suggestion/solution?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nikhi,
Welcome to JavaRanch!

What about putting the service behind a stateless session bean facade? You could set the max pool size for this session bean to the number of concurrent requests you are trying to throttle to.
 
Nikhil Joshi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne !

I thought on your suggestion.

Actually, I need to maintain the client's identity/state, as service need to send a PDF back to respective client. I guess that won't be possible the stateless bean, Isn't it?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nikhi Joshi:
Actually, I need to maintain the client's identity/state, as service need to send a PDF back to respective client. I guess that won't be possible the stateless bean, Isn't it?

Why not? A session bean is synchronous. The caller would know which client to send the response to.
 
Nikhil Joshi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok..you are right..

So here is my understanding of entire scenario , please correct me if i goes wrong...

So Lets say I set bean pool size min to 20 and max to 200.....

1. Till 20 concurrent requests will be served directly without any pooling.
[ that many instances of bean create, right? ]

2. In case of say 50 concurrent requests ....... 30 requests/bean instances will be pooled while serving 20 directly.

3. what will happen if more than 200 concurrent requests occurs?

Sorry for too many questions javascript: x()
Smile

Thanks
Nikhil
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I'm not sure what you mean by "without pooling." There are still 20 in the pool; just that they are all going at the same time. 20 beans are created
2) The pool grows to 50. All 50 are pooled and going at the same time.
3) The pool grows to 200. The first 200 go at the same time and the rest wait for a bean to return to the pool.

If you want 20 at a time, you use a maximum pool size of 20. In your example, you are throttling to 200 at a time.

And questions are good! They help clarify understanding.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic