Welcome! Log In Create A New Profile

Advanced

[nginx] Cache: fixed minimum cache keys zone size limit.

Maxim Dounin
October 31, 2018 10:44AM
details: http://hg.nginx.org/nginx/rev/de50fa05fbeb
branches:
changeset: 7374:de50fa05fbeb
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Oct 31 16:49:39 2018 +0300
description:
Cache: fixed minimum cache keys zone size limit.

Size of a shared memory zones must be at least two pages - one page
for slab allocator internal data, and another page for actual allocations.
Using 8192 instead is wrong, as there are systems with page sizes other
than 4096.

Note well that two pages is usually too low as well. In particular, cache
is likely to use two allocations of different sizes for global structures,
and at least four pages will be needed to properly allocate cache nodes.
Except in a few very special cases, with keys zone of just two pages nginx
won't be able to start. Other uses of shared memory impose a limit
of 8 pages, which provides some room for global allocations. This patch
doesn't try to address this though.

Inspired by ticket #1665.

diffstat:

src/http/ngx_http_file_cache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -2427,7 +2427,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t
s.data = p;

size = ngx_parse_size(&s);
- if (size > 8191) {
+ if (size >= (ssize_t) (2 * ngx_pagesize)) {
continue;
}
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Cache: fixed minimum cache keys zone size limit.

Maxim Dounin 306 October 31, 2018 10:44AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready