How to set the minimum size of the cache file

Hi,

How to set the minimum size of the cache file ?

2009-09-16

Chancey

On Wed, Sep 16, 2009 at 01:07:05PM +0800, Chancey wrote:

How to set the minimum size of the cache file ?

Currently there is no way.
Could you tell why do you want to set this limit ?

Back-end to provide search suggest services .

Example:

Two request url:
a . http://xxx/a?q=a
b . http://xxx/a?q=b

Response results :
a. xxxxxxxxxx
b. null

The results of a need to be cached , b don’t need.
Because there are a large number of fruitless requests , If b is the
cache will appear the following situations :

1 . Caching a lot of useless information, resulting in a waste of disk
space
2 . Very high Disk IO load cause the system to slow

Search services have their own caching mechanism , but I would like to
omit the PHP parsing process, will get better performance

Sorry,my english is so poor that i don’t know whether a clear
expression.

2009-09-16

Chancey

发件人: Igor S.
发送时间: 2009-09-16 17:15:32
收件人: nginx
抄送:
主题: Re: How to set the minimum size of the cache file

On Wed, Sep 16, 2009 at 01:07:05PM +0800, Chancey wrote:

How to set the minimum size of the cache file ?
Currently there is no way.
Could you tell why do you want to set this limit ?

Igor S.
Igor Sysoev

It’s a good idea, I have set it successful.

Thank you very much!

2009-09-16

Chancey

发件人: Mirosław Jaworski
发送时间: 2009-09-16 18:41:17
收件人: nginx
抄送:
主题: Re: Re: How to set the minimum size of the cache file

On Wed, 2009-09-16 at 17:56 +0800, Chancey wrote:

a. xxxxxxxxxx
b. null

The results of a need to be cached , b don’t need.
You can run nginx without caching enforcement ( don’t use
proxy_cache_valid ) and modify() “search suggest service” so it will
return headers allowing caching for responses other that null.
(
) very likely modification is adding single line of code setting
“Expire:” header before returning result.


MirosÅ‚aw “Psyborg” Jaworski
GCS/IT d- s+:+ a C++$ UBI++++$ P+++$ L- E— W++(+++)$ N++ o+ K- w-- O-
M- V- PS+ PE++ Y+ PGP t 5? X+ R++ !tv b++(+++) DI++ D+ G e* h++ r+++ y?
“Never let your sense of morals get in the way of doing what’s
right.”

On Wed, 2009-09-16 at 17:56 +0800, Chancey wrote:

a. xxxxxxxxxx
b. null

The results of a need to be cached , b don’t need.

You can run nginx without caching enforcement ( don’t use
proxy_cache_valid ) and modify(*) “search suggest service” so it will
return headers allowing caching for responses other that null.

(*) very likely modification is adding single line of code setting
“Expire:” header before returning result.

Igor S. wrote:

On Wed, Sep 16, 2009 at 01:07:05PM +0800, Chancey wrote:

How to set the minimum size of the cache file ?

Currently there is no way.
Could you tell why do you want to set this limit ?

Hi Igor,
I have the same question.
nginx is my reverse proxy cache servers, web page nginx cached was
generated by backend php program, sometime when php fetch data from db
server failed, it will generate the wrong page.
the wrong page’s size always much smaller than the right page. if I can
set the minimum size of the cache file, nginx will not cache the wrong
page.

thaks a lot.

                 yangchunyu

On Tue, Apr 13, 2010 at 4:18 AM, Yahwist Y. [email protected]
wrote:

page.

thaks a lot.

          yangchunyu

If something went wrong, shouldn’t your PHP be generating a 40x or 50x
error code? Nginx doesn’t cache these by default.

A third-party web application which returns a 20X code on errors is
currently the bane of my existence. It just plain stinks for
monitoring, log analysis, and just about anything else. If you have
any influence over the back-end PHP code at all, I would change it to
return proper error codes.

RPM

On Tue, Apr 13, 2010 at 4:18 AM, Yahwist Y. [email protected]
wrote:

page.

thaks a lot.

          yangchunyu

If something went wrong, shouldn’t your PHP be generating a 50x error
code? Nginx doesn’t cache these by default.

A webapplications that returns a 20X code on error are the bane of my
existence at the moment. Do you control the back-end PHP code at all?

RPM

Ryan M. wrote:

On Tue, Apr 13, 2010 at 4:18 AM, Yahwist Y. [email protected]
wrote:

page.

thaks a lot.

          yangchunyu

If something went wrong, shouldn’t your PHP be generating a 50x error
code? Nginx doesn’t cache these by default.

A webapplications that returns a 20X code on error are the bane of my
existence at the moment. Do you control the back-end PHP code at all?

RPM

I have forwarded your good solutions to our programmer.
the wrong page never be cached.

thanks a lot

         yangchunyu