I'm going to be building a simple financial calculator as a web-app. The underlying calculator logic takes 30ms to churn out its answer. My basic idea for the architecture was
JSP (where users input values to calculator) -> Servlet (grabs the request paramaters, does the calculation, places the answer on the request and does a forward to another JSP which displays the answer)
I was wondering how I can tweak this to manage high request rates - i.e. if a lot of requests are coming in, I want some kind of clever queuing mechanism that, say, will tell users to "Wait a while and try again" or something similar?
Is there a way to put together a framework like this using Apache or Tomcat?
Do you what is the response time ? and how many users you need to handle simultanously are you using any kind of frame works like struts or anything ?
Joined: Nov 03, 2008
Hi thanks for your response mate.
Other than the fact it takes 30ms to process a calculation, I don't really have any other numbers at hand unfortunately.
I do know that we want to guard against the same client hitting the website with too many multiple requests (something which can be programmatically achieved with a command line tool like curl).
We don't have a particular framework like Struts in mind, only because the site is otherwise very simple in its construction.
What about using Filters to intercept the requests and maintain a map of client IPs to the number of requests they have already sent? That way if a particular IP has already sent, say, X requests, we can deny processing any further ones until the current ones have been dealt with.