aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Throttling requests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Throttling requests" Watch "Throttling requests" New topic
Author

Throttling requests

Nikhil Joshi
Greenhorn

Joined: Jun 28, 2008
Posts: 7
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

Joined: May 26, 2003
Posts: 30780
    
157

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nikhil Joshi
Greenhorn

Joined: Jun 28, 2008
Posts: 7
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

Joined: May 26, 2003
Posts: 30780
    
157

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

Joined: Jun 28, 2008
Posts: 7
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

Joined: May 26, 2003
Posts: 30780
    
157

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Throttling requests