aspose file tools
The moose likes Performance and the fly likes |Solved| How to throttle requests using standard java? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "|Solved| How to throttle requests using standard java?" Watch "|Solved| How to throttle requests using standard java?" New topic
Author

|Solved| How to throttle requests using standard java?

Taariq San
Ranch Hand

Joined: Nov 20, 2007
Posts: 189
Users are allowed a variable number of concurrent sessions, which rules out session beans.

I could read a byte from a stream before processing the request and write a byte to it when done processing. On login write a byte for as many requests they're allowed.
I could have a stream like that for each user, there won't be that many of this type, maybe a dozen or 2. Not that it would be such a big deal for the oter thousands but in this particular forum its a more serious consideration.

Anyhat, can you give any other option please?
[ August 17, 2008: Message edited by: Taariq San ]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3041
    
    4

What kind of application are we talking about, J2EE? Or Standard?

What is the definition of concurrent sessions? Are they separate user-specific data stores shared along multiple requests or just separate concurrent threads sharing the same data store? Does each request get a new session? How are sessions generated?

What should be the behavior when the user has no more concurrent sessions? Should new requests fail with an error, or should the requests block until a session becomes available?

How are sessions made available?

You may want to look into the java.util.concurrent.Semaphore. It may help you create a general framework, but it is hard to know if it would be applicable to your situation.


Steve
Taariq San
Ranch Hand

Joined: Nov 20, 2007
Posts: 189
Thanks Steve, that's just what I'm after.
This fits the bill perfectly so I won't bore you with the details.
Happy coding!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: |Solved| How to throttle requests using standard java?
 
Similar Threads
How can I read all objects in a file with ObjectInputStream?
regarding peer to peer network through java
servlet writes file that is sometimes corrupt
How to convert from stream to byte array?
How to use Servelet to pass binary data