Медленно раздается статика

Alexey Bobok alexey.bobok at ukrhome.net
Fri Nov 20 17:32:00 MSK 2009


Здравствуйте.
В пик посещения юзеров картинки и flv-файлы отдаются очень медленно.
Файлы есть как маленькие (превьюшки картинок) так и большие (видео
файлы), пока все на одном сервере.
Тема заезженная, но не могу найти  рассылке пару тредов, где было
подробное обсуждение вопроса. Киньте ссылкой, плиз, если есть под
рукой или прокомментируйте мою ситуацию.
sysctl в системе дефольтный.
Необходимо ли использовать sendfile на AMD64 и включать в конфиге nginx?

Описание сервера:
Раздача статики
FreeBSD 7.0-RELEASE-p3 amd64

st1# nginx -V
nginx version: nginx/0.8.20
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
--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_flv_module
--with-http_realip_module --with-http_stub_status_module --with-pcre

RAID-контроллер:
    vendor     = 'Areca Technology Corporation'
    device     = 'ARC-1210 4-Port PCIe to SATA RAID Controller'
HDD:
    2 шт WDC WD6400AAKS-22A7B0
Конфигурация RAID:
    Volume Set Name 	uh.stor1-r1
    Raid Set Name 	Raid Set # 00
    Volume Capacity 	640.0GB
    SCSI Ch/Id/Lun 	0/0/0
    Raid Level 	Raid 1
    Stripe Size 	64KBytes
    Block Size 	512Bytes
    Member Disks 	2
    Cache Mode 	Write Back
    Tagged Queuing 	Enabled
    Volume State 	Normal

Примонтированный раздел:
/dev/da0s1f             /1              ufs     rw,noatime
 2       2

st1# iostat -w1
      tty             da0            pass0            pass1             cpu
 tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
   0    5 49.54  76  3.70   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
   0  231 49.73 153  7.42   0.00   0  0.00   0.00   0  0.00   0  0  2  0 98
   0   77 51.35 154  7.71   0.00   0  0.00   0.00   0  0.00   0  0  2  0 98
   0   77 52.88 138  7.11   0.00   0  0.00   0.00   0  0.00   0  0  2  0 97
   0   77 54.94 158  8.46   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
   0   77 45.24 157  6.92   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
   0   77 51.54 187  9.39   0.00   0  0.00   0.00   0  0.00   0  0  1  0 98
   0   77 46.48 149  6.75   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
   0   77 48.10  83  3.89   0.00   0  0.00   0.00   0  0.00   0  0  0  0 100
   0   78 48.79 134  6.37   0.00   0  0.00   0.00   0  0.00   1  0  2  0 98
   0   77 48.83 173  8.23   0.00   0  0.00   0.00   0  0.00   0  0  3  0 96
   0   77 51.92 106  5.36   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
   0   77 50.48 124  6.10   0.00   0  0.00   0.00   0  0.00   0  0  1  0 99
^C
st1# iostat -x
                        extended device statistics
device     r/s   w/s    kr/s    kw/s wait svc_t  b
da0       74.1   2.3  3714.4    69.3    7  19.2  37
pass0      0.0   0.0     0.0     0.0    0   0.0   0
pass1      0.0   0.0     0.0     0.0    0   0.0   0

st1# vmstat
 procs      memory      page                    disks     faults      cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr da0 pa0   in   sy
cs us sy id
 0 4 0 1303320  68956    27  14   0   0    65  31   0   0  179  257
154  0  1 99

st1# vmstat -z
ITEM                     SIZE     LIMIT      USED      FREE  REQUESTS  FAILURES

UMA Kegs:                 216,        0,       96,        6,       96,        0
UMA Zones:                280,        0,       96,        8,       96,        0
UMA Slabs:                128,        0,     1824,      438, 12271461,        0
UMA RCntSlabs:            128,        0,      804,      356, 56276857,        0
UMA Hash:                 256,        0,        4,       11,        8,        0
16 Bucket:                152,        0,       60,       40,      115,        0
32 Bucket:                280,        0,       40,       44,       90,        0
64 Bucket:                536,        0,       58,       82,      165,       14
128 Bucket:              1048,        0,     1225,      173,   309517,     8865
VM OBJECT:                208,        0,    27749,    43009, 91969046,        0
MAP:                      248,        0,        7,       23,        7,        0
KMAP ENTRY:               112,    87780,       47,      316,  2682422,        0
MAP ENTRY:                112,        0,     2978,      751, 95588337,        0
DP fakepg:                120,        0,        0,        0,        0,        0
mt_zone:                 1024,        0,      240,       16,      240,        0
16:                        16,        0,     1780,      740,
2684135083,        0
32:                        32,        0,     2748,      585, 50690802,        0
64:                        64,        0,     1870,      482,
5494175947,        0
128:                      128,        0,     5450,      611, 120296343,        0
256:                      256,        0,      546,      459, 44224366,        0
512:                      512,        0,      953,      846,  6847663,        0
1024:                    1024,        0,      110,      418,  1049162,        0
2048:                    2048,        0,       88,      466,  8977673,        0
4096:                    4096,        0,      416,      248,  3481252,        0
Files:                    120,        0,     2720,      938,
1927677275,        0
TURNSTILE:                152,        0,      345,       87,     1225,        0
umtx pi:                   96,        0,        0,        0,        0,        0
PROC:                    1128,        0,      107,      178,  2373809,        0
THREAD:                   824,        0,      295,       49,     3643,        0
UPCALL:                    88,        0,        5,       33,       15,        0
SLEEPQUEUE:                64,        0,      345,      215,     1225,        0
VMSPACE:                  416,        0,       52,      353,  2373750,        0
audit_record:             984,        0,        0,        0,        0,        0
mbuf_packet:              256,        0,      622,      218,
29064024536,        0
mbuf:                     256,        0,     3434,      781,
65376786337,        0
mbuf_cluster:            2048,    25600,      840,      202,
3450400849,        0
mbuf_jumbo_pagesize:     4096,    12800,       14,      269, 262822445,        0
mbuf_jumbo_9k:           9216,     6400,        0,        0,        0,        0
mbuf_jumbo_16k:         16384,     3200,        0,        0,        0,        0
mbuf_ext_refcnt:            4,        0,     3401,     1303,
11294880419,        0
ACL UMA zone:             388,        0,        0,        0,        0,        0
g_bio:                    216,        0,       30,      456,
2360621307,        0
ata_request:              312,        0,        0,        0,        0,        0
ata_composite:            352,        0,        0,        0,        0,        0
VNODE:                    496,        0,    39547,    52293, 342102667,        0
VNODEPOLL:                128,        0,        1,       28,        1,        0
NAMEI:                   1024,        0,        1,      395,
1496218681,        0
S VFS Cache:              104,        0,    20336,    32476, 171271190,        0
L VFS Cache:              327,        0,    21816,      768, 172126882,        0
DIRHASH:                 1024,        0,     1853,      271,  6220805,        0
NFSMOUNT:                 568,        0,        0,        0,        0,        0
NFSNODE:                  664,        0,        0,        0,        0,        0
pipe:                     744,        0,        2,      483,  1224454,        0
ksiginfo:                 112,        0,      237,      126,      243,        0
itimer:                   360,        0,        0,        0,        0,        0
KNOTE:                    120,        0,     3018,      733,
5583447958,        0
socket:                   696,    12330,     3315,     2495, 500428285,        0
ipq:                       56,      819,        0,      315,    13964,        0
udpcb:                    288,    12337,       12,      300,   360433,        0
inpcb:                    288,    12337,     4335,     3400, 499598711,        0
tcpcb:                    728,    12330,     3275,     2460, 499598711,        0
tcptw:                     88,     2478,     1060,     1418, 69955251,    11464
syncache:                 120,    15376,       11,      640, 500785736,        0
hostcache:                136,    15372,     8781,      571,  8160098,        0
tcpreass:                  40,     1680,        3,      921,  4688019,        0
sackhole:                  32,        0,       51,     1060, 893668765,        0
sctp_ep:                 1208,    12330,        0,        0,        0,        0
sctp_asoc:               2160,    40000,        0,        0,        0,        0
sctp_laddr:                48,    80064,        0,      144,        2,        0
sctp_raddr:               584,    80003,        0,        0,        0,        0
sctp_chunk:               136,   400008,        0,        0,        0,        0
sctp_readq:               104,   400032,        0,        0,        0,        0
sctp_stream_msg_out:       88,   400008,        0,        0,        0,        0
sctp_asconf_ack:           48,   400032,        0,        0,        0,        0
ripcb:                    288,    12337,        0,       52,      108,        0
unpcb:                    248,    12330,       28,      287,   469032,        0
rtentry:                  240,        0,       14,       66,     1938,        0
pfsrctrpl:                152,        0,        0,        0,        0,        0
pfrulepl:                 912,        0,        0,        0,        0,        0
pfstatepl:                392,    10000,        0,        0,        0,        0
pfaltqpl:                 240,        0,        0,        0,        0,        0
pfpooladdrpl:              88,        0,        0,        0,        0,        0
pfrktable:               1296,        0,        0,        0,        0,        0
pfrkentry:                216,        0,        0,        0,        0,        0
pfrkentry2:               216,        0,        0,        0,        0,        0
pffrent:                   32,     5050,        0,        0,        0,        0
pffrag:                    80,        0,        0,        0,        0,        0
pffrcache:                 80,    10035,        0,        0,        0,        0
pffrcent:                  24,    50022,        0,        0,        0,        0
pfstatescrub:              40,        0,        0,        0,        0,        0
pfiaddrpl:                120,        0,        0,        0,        0,        0
pfospfen:                 112,        0,        0,        0,        0,        0
pfosfp:                    40,        0,        0,        0,        0,        0
SWAPMETA:                 288,   116519,       37,      782,   149708,        0
Mountpoints:              808,        0,        5,       10,        5,        0
FFS inode:                192,        0,    39509,    15491, 342098565,        0
FFS1 dinode:              128,        0,        0,        0,        0,        0
FFS2 dinode:              256,        0,    39508,    11582, 342098564,        0

st1# netstat -m
3315/1680/4995 mbufs in use (current/cache/total)
721/323/1044/25600 mbuf clusters in use (current/cache/total/max)
721/128 mbuf+clusters out of packet secondary zone in use (current/cache)
14/266/280/12800 4k (page size) jumbo clusters in use (current/cache/total/max)
0/0/0/6400 9k jumbo clusters in use (current/cache/total/max)
0/0/0/3200 16k jumbo clusters in use (current/cache/total/max)
2326K/2130K/4456K bytes allocated to network (current/cache/total)
0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters)
0/0/0 requests for jumbo clusters denied (4k/9k/16k)
0/0/0 sfbufs in use (current/peak/max)
0 requests for sfbufs denied
0 requests for sfbufs delayed
269010557 requests for I/O initiated by sendfile
0 calls to protocol drain routines

-- 
С уважаением,
Алексей Бобок, Ukrhome.net
icq# 205349854
mailto: alexey.bobok at ukrhome.net
http://www.ukrhome.net/





More information about the nginx-ru mailing list