Forum: NGINX Problem in nginx with proxy_cache on

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Qiu Linfeng (Guest)
on 2009-05-26 06:19
(Received via mailing list)
hi,all
Recently, I used nginx and found a problem. The problem is at the memory
pool while I turn on the proxy_cache.
Here is how I found it.
I use a tool to test nginx (with proxy_cache on) and found that  CPU
idle is
zero while the IO  didn't get to 100%.
So, I think there must have performance problem  in nginx with
proxy_cache
on. I used VTune to find the problem. The VTune Report shows 98% of CPU
run
at the fuction ngx_palloc() in  ngx_palloc.c.
I read the code and I think while nginx alloc memory from a pool,  there
is
a cycle to get the free memory of the pool, the cycle do a lot of times.
At
last, I get rid of the do...while, just let each memory alloc  from the
function ngx_palloc_block(). Obviously, I get rid of the "for" cycle in
ngx_palloc_block() too. And the performance is improved a lot, while the
CPU
idle is not zero and the IO utils get to 100%.
Can this problem be resolved in a good way?
thanks for all
Igor S. (Guest)
on 2009-05-26 15:34
(Received via mailing list)
On Tue, May 26, 2009 at 10:08:57AM +0800, Qiu Linfeng wrote:

> a cycle to get the free memory of the pool, the cycle do a lot of times. At
> last, I get rid of the do...while, just let each memory alloc  from the
> function ngx_palloc_block(). Obviously, I get rid of the "for" cycle in
> ngx_palloc_block() too. And the performance is improved a lot, while the CPU
> idle is not zero and the IO utils get to 100%.
> Can this problem be resolved in a good way?
> thanks for all

Try to change NGX_ALIGNMENT to 16.
Qiu Linfeng (Guest)
on 2009-05-27 06:47
(Received via mailing list)
hi,
thanks for your reply, I used your method and this problem didn't
re-appear.
Another question.
Does proxy_cache support LRU? I read the code and find the die out of
the
cache item is freed by the expire time. That is, when the cache add does
not
succeed, it will check the expire queue and free the expired item? Am I
right?

2009/5/26 Igor S. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.