тормозня при включённом кэшировании

Михаил Монашёв postmaster at softsearch.ru
Sun Nov 8 01:43:13 MSK 2009


Здравствуйте.

При включении кэширования вот такая картина:

last pid: 29642;  load averages: 459.45, 178.48, 75.93 up 124+06:59:13 01:28:38
757 processes: 680 running, 77 sleeping
CPU: 94.7% user,  0.0% nice,  5.3% system,  0.0% interrupt,  0.0% idle
Mem: 1139M Active, 25G Inact, 2688M Wired, 648M Cache, 399M Buf, 1944M Free
Swap:

  PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
29447 www         1  68    0 87948K  2604K RUN    1   0:02 16.55% nginx
29436 www         1  99    0 87948K  2668K RUN    0   0:03 14.79% nginx
29491 www         1  68    0 87948K  2296K RUN    7   0:02 14.70% nginx
29511 www         1  69    0 87948K  2408K RUN    5   0:02 14.36% nginx
29554 www         1  68    0 87948K  2324K RUN    2   0:02 14.06% nginx
29519 www         1  99    0 87948K  2432K RUN    0   0:02 13.67% nginx
29463 www         1  68    0 87948K  2464K RUN    7   0:02 13.57% nginx
29373 www         1  69    0 87948K  2484K RUN    6   0:02 13.38% nginx
29398 www         1  69    0 87948K  2176K RUN    4   0:02 13.09% nginx
29452 www         1  68    0 87948K  2368K RUN    1   0:02 12.89% nginx
29378 www         1  60    0 87948K  2340K CPU6   6   0:01 12.50% nginx
29541 www         1  68    0 87948K  2176K RUN    3   0:02 12.26% nginx
29431 www         1  69    0 87948K  2340K RUN    5   0:02 12.06% nginx
29533 www         1  69    0 87948K  2176K RUN    6   0:02 11.47% nginx
29393 www         1  69    0 87948K  2676K RUN    3   0:03 10.99% nginx
29423 www         1  58    0 87948K  2228K CPU3   3   0:02 10.99% nginx
29585 www         1  68    0 87948K  2472K RUN    4   0:03 10.79% nginx
29384 www         1  68    0 87948K  2360K RUN    4   0:02 10.69% nginx
29444 www         1  57    0 87948K  2176K CPU4   4   0:02 10.60% nginx
29394 www         1  69    0 87948K  2276K RUN    1   0:02 10.35% nginx
29368 www         1  69    0 87948K  2528K RUN    5   0:02  9.86% nginx
29515 www         1  69    0 87948K  2192K RUN    7   0:03  9.57% nginx
29432 www         1  68    0 87948K  2416K RUN    2   0:02  9.57% nginx
29559 www         1  98    0 87948K  2332K RUN    0   0:02  9.38% nginx
29484 www         1  69    0 87948K  2568K RUN    6   0:02  9.18% nginx
29454 www         1  98    0 87948K  2464K RUN    0   0:02  8.69% nginx
29438 www         1  69    0 87948K  2324K RUN    4   0:02  8.69% nginx
29525 www         1  54    0 87948K  2508K CPU5   5   0:02  8.69% nginx
29483 www         1  68    0 87948K  3064K RUN    1   0:02  8.50% nginx
29443 www         1  68    0 87948K  2376K RUN    3   0:02  8.15% nginx
29453 www         1  68    0 87948K  2272K RUN    2   0:02  7.86% nginx
29477 www         1  68    0 87948K  2236K RUN    6   0:02  7.86% nginx
29462 www         1  68    0 87948K  2300K RUN    7   0:02  7.86% nginx
29468 www         1  97    0 87948K  2512K RUN    0   0:02  7.28% nginx
29568 www         1  68    0 87948K  2176K RUN    5   0:02  7.18% nginx
29580 www         1  68    0 87948K  2176K RUN    4   0:02  6.98% nginx
28972 www         1  97    0 87948K 81868K RUN    0   0:02  6.88% nginx
29544 www         1  68    0 87948K  2192K RUN    7   0:02  6.88% nginx
29505 www         1  52    0 87948K  2404K CPU2   2   0:01  6.88% nginx
29336 www         1  68    0 87948K  2504K RUN    3   0:03  6.59% nginx
29476 www         1  69    0 87948K  2384K RUN    6   0:03  6.59% nginx
29566 www         1  68    0 87948K  2176K RUN    2   0:02  6.40% nginx
29482 www         1  69    0 87948K  2412K RUN    5   0:03  6.30% nginx
29487 www         1  68    0 87948K  2576K RUN    4   0:02  6.05% nginx
29564 www         1  50    0 87948K  2364K CPU0   0   0:01  6.05% nginx

Если закоментарить строчки
proxy_cache_path   /opt1/favicons  levels=1:1      keys_zone=favicons:1m   max_size=1G;

proxy_cache     favicons;
proxy_cache_key $proxy_host;
proxy_temp_path /opt1/favicons/proxy_tmp_path;

то всё работает нормально. кусок конфига такой:

    proxy_cache_path   /opt1/favicons  levels=1:1      keys_zone=favicons:1m   max_size=1G;
    
    server {
        listen 1.2.3.4:80;
        server_name xxx.ru;

        proxy_intercept_errors  on;
        error_page      400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 422 423 424 425 426 449 500 501 502 503 504 505 506 507 509 510 = /zero;

        proxy_cache     favicons;
        proxy_cache_key $proxy_host;
        proxy_temp_path /opt1/favicons/proxy_tmp_path;

        proxy_hide_header       Location;

        location / {
                return 204;
        }

        location = /zero {
                return 204;
        }

        # aa.ru
        location ~ "^/([a-z0-9-]{1,50}\.[a-z]{2,4})$" {
                proxy_set_header        Host    $1;
                proxy_pass              http://$1/favicon.ico;
        }

        # bb.aa.ru
        location ~ "^/([a-z0-9-]{1,50\}.[a-z0-9-]{1,50}\.[a-z]{2,4})$" {
                proxy_set_header        Host    $1;
                proxy_pass              http://$1/favicon.ico;
        }

        # cc.bb.aa.ru или 111.222.33.44
        location ~ "^/([a-z0-9-]{1,50}\.[a-z0-9-]{1,50}\.[a-z0-9-]{1,50}\.[a-z0-9]{1,4})$" {
                proxy_set_header        Host    $1;
                proxy_pass              http://$1/favicon.ico;
        }

    }

nginx version: nginx/0.8.22 собран из портов

configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --with-debug --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-log-path=/var/log/nginx-access.log --with-http_dav_module --with-http_realip_module --with-http_stub_status_module --with-pcre

FreeBSD 7.2 amd64

--

С уважением,
Михаил Монашёв, SoftSearch.ru
mailto:postmaster at softsearch.ru
ICQ# 166233339
http://michael.mindmix.ru/
Без бэкапа по жизни.






More information about the nginx-ru mailing list