Cache purge

Hi,

I’m investigating cache purge in nginx and currently we have some
success with this patch: FRiCKLE Labs / nginx / cache_purge.
The reason I said “some” is the patch works normally but blows out (the
message was like “the file to purge is too small…”)when the nginx
process has been restarted and the cache to purge was created by the
previous nginx process. The patch is also a little out of of sync with
the latest nginx.

My question is if there is a roadmap for nginx to add an official
support for a purge mechanism.

If the feature is still far in the future, I’d appreciate that people
could share their ways of accomplishing the goal in practice.

Thanks!

Bing

I’m investigating cache purge in nginx and currently we have some success
with this patch: FRiCKLE Labs / nginx / cache_purge. The reason I
said “some” is the patch works normally but blows out (the message was
like “the file to purge is too small…”)when the nginx process has been
restarted and the cache to purge was created by the previous nginx
process.

It’s a shame that you didn’t report it, because I was unaware of this
until
now.

Anyway, I’m unable to reproduce this bug (purging files from cache after
restarting nginx works as expected, at least with nginx-0.8.8, so maybe
you
introduced some bugs while syncing it on your own?)

Also, the message you are referring to (“cache file "%s" is too
small”) is
produced by nginx when it’s trying to open cached file (which is also
done
before purging it), so it looks like something is wrong… It would be
great
if you could produce debug log and send it either on- or off-list.

The patch is also a little out of of sync with the latest nginx.

Actually, I was going to sync it with the latest nginx and push the
release
yesterday, together with ngx_supervisord-1.1, but something came up and
I
didn’t do it…

But I’m gonna do it in next few days (maybe even today), stay tuned! :wink:

Best regards,
Piotr S. < [email protected] >

Thanks Piotr!

One of my developers did the patch manually and she might have
introduced
some bugs during the process.

Would it be easier to make it a standalone module rather than a patch
for
users?

I’m waiting for your new patch to the latest nginx and I’ll test it out
and
report back.

Regards,

Bing


From: “Piotr S.” [email protected]
Sent: Tuesday, November 17, 2009 1:09 PM
To: [email protected]
Subject: Re: cache purge

One of my developers did the patch manually and she might have introduced
some bugs during the process.

I doubt that she introduced any, because patch for nginx-0.8.8 applies
cleanly (without any modifications) against latest nginx.

Anyway, this “bug” you were seeing appeared when original patch was
applied
against nginx-0.8.11 or newer (long story short: r->cache->body_start
was
never set and nginx tried to read 0 bytes). This is fixed now.

Would it be easier to make it a standalone module rather than a patch for
users?

It was created as a patch, because we (Johan Bergstr?m from yo.se, who
funded this patch and me) hoped that it would be imported to nginx’s
base
someday.

I’m waiting for your new patch to the latest nginx and I’ll test it out
and report back.

Patch against nginx-0.8.26 is available at:
http://labs.frickle.com/nginx_cache_purge/

In the future, please report when you find bugs :wink:

Best regards,
Piotr S. < [email protected] >

Hey,
while you’re patching - please update the example as well. We found (a
while ago, sorry for not letting you know) that since location matches
“omits” args from $1, we need to add it again. proper example should be:
location ~ /purge(/.*) {
allow 127.0.0.1;
deny all;
proxy_cache_purge tmpcache $1$is_args$args;
}

Hey,
while you’re patching - please update the example as well.

Thanks! Fixed.

Best regards,
Piotr S. < [email protected] >

In case it matters, here is the error I received in the error log:

2009/11/17 15:03:52 [crit] 1553#0: *1 cache file
“/data/nginx_cache/etwebservice/a/2b/b3a2527b6f3a38d63663ee436e7d82ba”
is
too small, client: 222.66.142.29, server: localhost, request: “HEAD
/purge/RestTakeoutServer/dish/B10I24R57547/list?commentCount=5
HTTP/1.1”,
host: “222.66.142.29”


From: “Ƚ±ø” [email protected]
Sent: Tuesday, November 17, 2009 2:16 PM
To: [email protected]
Subject: Re: cache purge

The new patch works great.

Thanks Piotr


From: “Piotr S.” [email protected]
Sent: Tuesday, November 17, 2009 3:23 PM
To: [email protected]
Subject: Re: cache purge