[Seaside] Call for help: Seaside performances
avi at dabbledb.com
Thu Jan 11 23:34:02 UTC 2007
On 1/11/07, Ramon Leon <ramon.leon at allresnet.com> wrote:
> Yea... What he said! LOL, but seriously, anxiously awaiting that write-up...
> I have to get the kinks worked out before the travel season hits and the
> real load starts coming.
So, here's the basic idea. Each image has a unique port assigned to
it. When a request comes into apache, you do the following:
1. Map the URL (or for us, the HTTP_HOST) to the right port.
2. Check if that port is open.
3. If the port is open, proxy the request to that port.
4. If the port isn't open, start up the image, and keep watching the
port until it opens. Then proxy the request to it.
Steps 1 and 2 can be done using a program as a RewriteMap
(prg:/usr/bin/...). I have one that takes a hostname and returns,
say, "open123" or "closed345" or "none" depending on what port it
finds and whether it's open. This is easy to match in a subsequent
Step 3 is done by a RewriteRule that uses the [P] flag and the dynamic
port returned by the RewriteMap.
Step 4 is done by a CGI which shells out to start the image, does a
busywait loop for the port to open and then (in our case) uses the
Ruby HTTP library to do the final proxy (this is slow but only
necessary on the first request).
The specifics are pretty dependent on environment but the general
strategy works well.
More information about the Seaside