That sounds almost perfect, except that we don't want for the system to
behave that way except in very unusual circumstances.
So we need to be able to switch into using this mode only when either we
have a catastrophic database failure, or when we are suffering unusually
high load (such as 10 to 100 times our normal load).
Is there a way to disable / defer the processing of the static file until
after our servlet has had a chance to examine it, and to totally disable
that static file processing when we don't need it.
On 10/16/07, Dalen, Andre van <[EMAIL PROTECTED]> wrote:
> Hi Michael,
> Instead of mapping a servlet url to static content (I'm assuming that that
> is what you are trying to do) you can also
> get the client to request the url for what the static pages would be and
> map the servlet that generates the
> static content to the 404 error handler.
> In this setup the static file is always tried first, and when it doesn't
> exist the generating servlet gets the
> chance to built it from scratch in a on-demand basis.
> The servlet can generate the static file, save it in the web-app content
> folders and then stream the generated
> page to the client that triggered the servlet. All subsequent requests
> find the files in the content (cache) folders
> and resin will serve those.
> One issue to watch out for is multiple requests coming into the servlet
> for the same page, you can either keep
> a collection with generation jobs and synchronise threads on it picking up
> the generated page and streaming
> it when it is ready, or just generate the first few requests in paralel
> and making sure only the first gets to save it to
> the filesystem.
> Hope this helps, Andre
> -----Original Message-----
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] Behalf Of *Michael Brunton-Spall
> *Sent:* Tuesday 16 October 2007 11:32
> *To:* email@example.com
> *Subject:* [Resin-interest] Serving static files dynamically from resin
> Hi there,
> I've googled for this, and can't seem to find anyone who wants to do the
> same thing, so I figured you guys would be the best source of information.
> We run a very large website, which is generated dynamically from resin,
> and we are looking at technical failover solutions.
> We believe that there are certain cases where our workload could increase
> dramatically, and we believe that our application will not withstand such a
> large onslaught of requests.
> Looking at our architecture, we believe that serving static pages will be
> possible under very high traffic loads, so we are writing a system that will
> "press" copies of dynamic pages to an html cache when they are modified.
> Under these extreme circumstances we would like to have a module that
> instead of doing all of our processing and going to the database, instead
> looks in a static directory of html files, and if there is a static file
> present for the requested url, serves that instead.
> However, I am having difficulty finding how it is possible to get resin to
> serve a static file in response to a url, where we will have to do some
> mapping to translate the url to the file location.
> We could write our own file server, but given that resins performance is
> pretty good for serving static files, we would much rather hook into resins
> file serving capabilites.
> Michael Brunton-Spall
> resin-interest mailing list
resin-interest mailing list