Kevin Scaldeferri | 25 Mar 18:14

hybrid mode based on GET vs. POST

Has anyone attempted a hybrid mode based on the request method?

Currently, I have a fairly standard hybrid mode, where indexes are  
static and entry pages are dynamic:

     RewriteCond %{REQUEST_FILENAME} !-s
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ blosxom.cgi/$1 [L,QSA]

The problem with this is that if one gets slashdotted/reddited/dugg,  
the flood of dynamic requests kills your server (I saw loads of about  
50, and that was even with most requests being killed by my host for  
excessive CPU/memory usage).

My thought at this point is that the primary reason to have entry  
pages be dynamic is to a) be able to process comment submissions, and  
b) display new comments in a timely fashion.  It seems like (a) could  
be easily achieved by changing the rewrite condition to only do  
dynamic for POSTs:

     RewriteCond %{REQUEST_METHOD} =POST
     RewriteRule ^(.*)$ blosxom.cgi/$1 [L,QSA]

Then for (b) I would need to modify the feedback plugin to trigger a  
rebuild of the static page.  This might be trickier, since I don't  
think there's any way to get the static rendering system to regenerate  
only one page.

Has anyone gone down this road?  Any suggestions or warnings?

(Continue reading)

Axel Beckert | 26 Mar 10:37
Favicon

Re: hybrid mode based on GET vs. POST

Hi Kevin,

On Tue, Mar 25, 2008 at 10:15:22AM -0700, Kevin Scaldeferri wrote:
> Has anyone attempted a hybrid mode based on the request method?

Not really, but nice idea! Since I also have sometimes problems with
fast webcrawlers (my RESTful configuration of the tagging plugin
generates a lot of valid and linked URLs) I plan to make it capable
for static mode and the change over to some hybrid mode. I thought
about a flavour based approach (dynamic with comments, static
without), but basing it on the request method is far more elegant. :-)

> The problem with this is that if one gets slashdotted/reddited/dugg,
> the flood of dynamic requests kills your server (I saw loads of about  
> 50,

Oh yes! And even an Apache configured with reserves can bit hit from
that. :-)

> and that was even with most requests being killed by my host for  
> excessive CPU/memory usage).

Yeah. Blosxom without caches is very I/O demanding. Especially my
tagging plugin. (Gavin has rewritten tagging from scratch with
caching, but less features, if someone's interested.) One more reason
for me to go static...

> My thought at this point is that the primary reason to have entry  
> pages be dynamic is to a) be able to process comment submissions, and  
> b) display new comments in a timely fashion.
(Continue reading)

Jason Blevins | 25 Mar 23:50
Favicon

Re: hybrid mode based on GET vs. POST

Hi Kevin,

Kevin Scaldeferri wrote:
> My thought at this point is that the primary reason to have entry  
> pages be dynamic is to a) be able to process comment submissions, and  
> b) display new comments in a timely fashion.

I agree completely.  I hate making my server do the same work twice.
I had a hybrid setup like this for a while.  Everything was static and
regenerated only when something changed (primarily when a new comment
was added).

> It seems like (a) could  
> be easily achieved by changing the rewrite condition to only do  
> dynamic for POSTs:
> 
>      RewriteCond %{REQUEST_METHOD} =POST
>      RewriteRule ^(.*)$ blosxom.cgi/$1 [L,QSA]

That's exactly what I did except I also passed requests with query
strings to Blosxom in order to accommodate other plugins:

    RewriteCond %{QUERY_STRING} "!^$" [OR]
    RewriteCond %{REQUEST_METHOD} "POST" [NC]
    RewriteRule (.*) cgi-bin/blosxom.cgi/$1 [L]

You could also first check to see if the static file exists and have
Blosxom serve everything that's not a file.  I'm not completely sure if
this is correct, but something like this should do it:

(Continue reading)


Gmane