针对同一个静态页面,squid、varnish、trafficserver性能以及命中率的比较

注:以下测试是在自己组装机器内进行

[root@www varnish]# cat /proc/cpuinfo  #cpu信息一个

processor       : 0

vendor_id       : GenuineIntel

cpu family      : 6

model           : 58

model name      : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz

stepping        : 9

cpu MHz         : 1600.000

cache size      : 3072 KB

physical id     : 0

siblings        : 4

core id         : 0

cpu cores       : 2

apicid          : 0

initial apicid  : 0

fpu             : yes

fpu_exception   : yes

cpuid level     : 13

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt xsave avx f16c lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms

bogomips        : 6584.86

clflush size    : 64

cache_alignment : 64

address sizes   : 36 bits physical, 48 bits virtual

[root@www varnish]# cat /proc/version  #内核信息

Linux version 2.6.32-220.el6.x86_64

[root@www varnish]# lsb_release -a    #操作系统信息

LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: CentOS

Description:    CentOS release 6.2 (Final)

Release:        6.2

Codename:       Final


[root@www varnish]# cat /proc/meminfo   #内存情况,共8G

MemTotal:        7736292 kB

MemFree:         4841624 kB

Buffers:          294216 kB

Cached:          2132408 kB

SwapCached:            0 kB

Active:          1340076 kB


测试详细结果:

[root@localhost ~]# webbench -c 500 -t 60 http://www.bbs.linuxblind.com/index.html

Webbench - Simple Web Benchmark 1.5

Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.


Benchmarking: GET http://www.bbs.linuxblind.com/index.html

500 clients, running 60 sec.


Speed=495622 pages/min, 2788085 bytes/sec.

Requests: 495167 susceed, 455 failed.

-----------------------------------------------------------------------------------------

[root@localhost ~]# /usr/local/squid/bin/squidclient -h 192.168.1.108 -p 80 mgr:info        

HTTP/1.1 200 OK

Server: squid/3.3.8

Mime-Version: 1.0

Date: Wed, 21 Aug 2013 08:28:44 GMT

Content-Type: text/plain

Expires: Wed, 21 Aug 2013 08:28:44 GMT

Last-Modified: Wed, 21 Aug 2013 08:28:44 GMT

X-Cache: MISS from linuxblind

X-Cache-Lookup: MISS from linuxblind:80

Via: 1.1 linuxblind (squid/3.3.8)

Connection: close


Squid Object Cache: Version 3.3.8

Start Time:     Wed, 21 Aug 2013 08:25:16 GMT

Current Time:   Wed, 21 Aug 2013 08:28:44 GMT

Connection information for squid:

       Number of clients accessing cache:      2

       Number of HTTP requests received:       495341

       Number of ICP messages received:        0

       Number of ICP messages sent:    0

       Number of queued ICP replies:   0

       Number of HTCP messages received:       0

       Number of HTCP messages sent:   0

       Request failure ratio:   0.00

       Average HTTP requests per minute since start:   142850.5

       Average ICP messages per minute since start:    0.0

       Select loop called: 610212 times, 0.341 ms avg

Cache information for squid:

       Hits as % of all requests:      5min: 100.0%, 60min: 100.0%

       Hits as % of bytes sent:        5min: 100.0%, 60min: 100.0%

       Memory hits as % of hit requests:       5min: 100.0%, 60min: 100.0%

       Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.0%

       Storage Swap size:      4220 KB

       Storage Swap capacity:   0.4% used, 99.6% free

       Storage Mem size:       224 KB

       Storage Mem capacity:    0.1% used, 99.9% free

       Mean Object Size:       26.38 KB

       Requests given to unlinkd:      0

Median Service Times (seconds)  5 min    60 min:

       HTTP Requests (All):   0.00000  0.00000

       Cache Misses:          0.00000  0.00000

       Cache Hits:            0.00000  0.00000

       Near Hits:             0.00000  0.00000

       Not-Modified Replies:  0.00000  0.00000

       DNS Lookups:           0.00000  0.00000

       ICP Queries:           0.00000  0.00000

Resource usage for squid:

       UP Time:        208.053 seconds

       CPU Time:       60.177 seconds

       CPU Usage:      28.92%

       CPU Usage, 5 minute avg:        33.42%

       CPU Usage, 60 minute avg:       33.42%

       Process Data Segment Size via sbrk(): 4492 KB

       Maximum Resident Size: 50624 KB

       Page faults with physical i/o: 0

Memory usage for squid via mallinfo():

       Total space in arena:    4624 KB

       Ordinary blocks:         4500 KB    179 blks

       Small blocks:               0 KB      0 blks

       Holding blocks:         10916 KB      5 blks

       Free Small blocks:          0 KB

       Free Ordinary blocks:     124 KB

       Total in use:             124 KB 1%

       Total free:               124 KB 1%

       Total size:             15540 KB

Memory accounted for:

       Total accounted:          942 KB   6%

       memPool accounted:        942 KB   6%

       memPool unaccounted:    14598 KB  94%

       memPoolAlloc calls:  40123090

       memPoolFree calls:   40124835

File descriptor usage for squid:

       Maximum number of file descriptors:   20480

       Largest file desc currently in use:     60

       Number of file desc currently in use:   26

       Files queued for open:                   0

       Available number of file descriptors: 20454

       Reserved number of file descriptors:   100

       Store Disk files open:                   0

Internal Data Structures:

          213 StoreEntries

           54 StoreEntries with MemObjects

           53 Hot Object Cache Items

          160 on-disk objects


-----------------------------------------------------------------------------------------

[root@www ats]# webbench -c 500 -t 60 http://www.bbs.linuxblind.com/index.html

Webbench - Simple Web Benchmark 1.5

Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.


Benchmarking: GET http://www.bbs.linuxblind.com/index.html

500 clients, running 60 sec.


Speed=1604781 pages/min, 8554361 bytes/sec.

Requests: 1604781 susceed, 0 failed.

---------------------------------------------------------------------------------------

[root@www ats]# echo "show:cache-stats" |traffic_shell                                      

Successfully Initialized MgmtAPI in /usr/local/ats/var/trafficserver

trafficserver> show:cache-stats


Bytes Used --- 0 GB

Cache Size --- 599 GB

--RAM Cache--

Total Bytes -- 2147483648

Bytes Used --- 16384

Hits --------- 1604521

Misses ------- 4

--Lookups--

In Progress -- 0

Hits --------- 0

Misses ------- 0

--Reads--

In Progress -- 0

Hits --------- 1604524

Misses ------- 751

--Writes--

In Progress -- 0

Hits --------- 4

Misses ------- 747

--Updates--

In Progress -- 0

Hits --------- 0

Misses ------- 0

--Removes--

In Progress -- 0

Hits --------- 0

Misses ------- 0


-----------------------------------------------------------------------------------------

[root@www varnish]# webbench -c 500 -t 60 http://www.bbs.linuxblind.com/index.html

Webbench - Simple Web Benchmark 1.5

Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.


Benchmarking: GET http://www.bbs.linuxblind.com/index.html

500 clients, running 60 sec.


Speed=1498734 pages/min, 8988399 bytes/sec.

Requests: 1498725 susceed, 9 failed.

---------------------------------------------------------------------------------------

[root@www vcache]# /usr/local/varnish/bin/varnishstat  -n /var/vcache


0+00:04:26                                                                                                   /var/vcache

Hitrate ratio:       10       61       61

Hitrate avg:     1.0000   1.0000   1.0000


    1498607         0.00      5633.86 client_conn - Client connections accepted

    1498855         0.00      5634.79 client_req - Client requests received

    1498854         0.00      5634.79 cache_hit - Cache hits

          1         0.00         0.00 cache_miss - Cache misses

          1         0.00         0.00 backend_conn - Backend conn. success

          1         0.00         0.00 backend_recycle - Backend conn. recycles

          1         0.00         0.00 fetch_length - Fetch with Length

        299          .            .   n_sess_mem - N struct sess_mem

          0          .            .   n_sess - N struct sess

          1          .            .   n_object - N struct object

        113          .            .   n_objectcore - N struct objectcore

        113          .            .   n_objecthead - N struct objecthead

        112          .            .   n_waitinglist - N struct waitinglist

          1          .            .   n_vbc - N struct vbc

        113          .            .   n_wrk - N worker threads

        113         0.00         0.42 n_wrk_create - N worker threads created

       1130         0.00         4.25 n_wrk_queued - N queued work requests

          1          .            .   n_backend - N backends

         30          .            .   n_lru_moved - N LRU moved objects

    1475441         0.00      5546.77 n_objwrite - Objects sent with write

    1498860         0.00      5634.81 s_sess - Total Sessions

    1498855         0.00      5634.79 s_req - Total Requests

          1         0.00         0.00 s_fetch - Total fetch

  519864531         0.00   1954377.94 s_hdrbytes - Total header bytes

   19485115         0.00     73252.31 s_bodybytes - Total body bytes

通过上图可以看出:

单位时间内,squid、varnish、ats性能呈现递增趋势,然而命中率却呈现出了下降趋势。


本文出自 “zhangdh开放空间” 博客,谢绝转载!

你可能感兴趣的:(性能,varnish,squid,命中率,ats)