In-depth discussion of Varnish cache hit rate

  

Perhaps you are still excited about the throughput rate of 7336.76 reqs /s for the dynamic content, etc., there is a gap between ideal and reality, you have to endure the cruelty of reality, don't forget The dynamic content in our stress test is in full cache, that is, each request hits the cache, which is often impossible in reality. First of all, the size of the buffer space is limited, and our site may have a large amount of content to be cached, unlike the previous stress test only one content. Once the cache is full, the Cache Manager will eliminate some cached content that it deems unnecessary, such as LRU (least recently used algorithm) to eliminate the less frequently cached content, but here to judge “ The standard of infrequent use is not strict, and the content that may be eliminated is the next content you will visit, which affects its hit rate. Secondly, the expiration time of the cache also affects its hit rate. If the validity period is very short, it is 10 seconds, then there will be one miss at least 10 seconds. Also, some content may not be cached by the proxy server at all. For example, the content contains non-cacheable HTTP header information such as set-cookie, which causes the reverse proxy to not cache them, and will not go when the browser requests them. Cache lookup. This is an important factor affecting the hit rate, but it is often overlooked by us. Fortunately, we can easily solve these problems, provided that we need to understand the real-time working state of the reverse proxy cache. For example, Varnish provides a command-line status monitor varnishstat. We open it and see the current The status of the moment is as follows:

client_conn 9908723 94.05 Client connections acceptedclient_drop 0 0.00 Connection dropped, no sess/wrkclient_req 16433490 155.99 Client requests receivedcache_hit 8751732 83.07 Cache hitscache_hitpass 42592 0.40 Cache hits for passcache_miss 7573389 71.89 Cache missesbackend_conn 3889845 36.92 Backend conn Successbackend_unhealthy 220 0.00 Backend conn. not attemptedbackend_busy 0 0.00 Backend conn. too manybackend_fail 4536 0.04 Backend conn. failuresbackend_reuse 3780212 35.88 Backend conn. reusesbackend_toolate 3866687 36.70 Backend conn. was closedbackend_recycle 7646677 72.58 Backend conn. recyclesbackend_unused 0 0.00 Backend conn. unusedfetch_head 57 0.00 Fetch Headfetch_length 155097 1.47 Fetch with Leng thfetch_chunked 7508522 71.27 Fetch chunkedfetch_eof 0 0.00 Fetch EOFfetch_bad 0 0.00 Fetch had bad headersfetch_close 3982 0.04 Fetch wanted closefetch_oldhttp 0 0.00 Fetch pre HTTP /1.1 closedfetch_zero 0 0.00 Fetch zero lenfetch_failed 0 0.00 Fetch failedn_sess_mem 1033. N struct sess_memn_sess 633. N struct sessn_object 1016443. N struct objectn_vampireobject 0. N unresurrected objectsn_objectcore 1017564. N struct objectcoren_objecthead 982903. N struct objectheadn_smf 2647421. N struct smfn_smf_frag 622470. N small free smfn_smf_large 3. N large free smfn_vbe_conn 12. N struct vbe_connn_wrk 8000. N worker threadsn_wrk_create 8000 0.08 N worker threads createdn_wrk_failed 0 0.00 N worker threads not createdn_wrk_max 11021 0.10 N worker threads limitedn_wrk_queue 0 0.00 N queued work requestsn_wrk_overflow 2441 0.02 N overflowed work requestsn_wrk_drop 0 0.00 N dropped work requestsn_backend 4. N backendsn_expired 6344546. N expired objectsn_lru_nuked 183957. N LRU nuk ed objectsn_lru_saved 0. N LRU saved objectsn_lru_moved 3692170. N LRU moved objectsn_deathrow 0. N objects on deathrowlosthdr 84 0.00 HTTP header overflowsn_objsendfile 0 0.00 Objects sent with sendfilen_objwrite 15466812 146.81 Objects sent with writen_objoverflow 0 0.00 Objects overflowing workspaces_sess 9906155 94.03 Total Sessionss_req 16433490 155.99 Total Requestss_pipe 37 0.00 Total pipes_pass 108252 1.03 Total passs_fetch 7667658 72.78 Total fetchs_hdrbytes 7187255662 68221.35 Total header bytess_bodybytes 111592032839 1059230.32 Total body bytessess_closed 1905544 18.09 Session Closedsess_pipeline 0 0.00 Session Pipelinesess_readahead 0 0.00 Session Read Aheadsess_linger 15277717 145.02 Session Lingersess_herd 13547370 128.59 Session herdshm_records 1028855796 9765.89 SHM recordsshm_writes 77957008 739.97 SHM Writesshm_flushes 131005 1.24 SHM flushes due to overflowshm_cont 144281 1.37 SHM MTX contentionshm_cycles 427 0.00 SHM cycles through buffersm_nreq 15306717 145.29 allocator requestssm_nobj 2024948. outstanding allocationssm_balloc 13595295744. bytes allocatedsm_bfree 40091795456. bytes freesma_nreq 0 0.00 SMA allocator requestssma_nobj 0. SMA outstanding allocationssma_nbytes 0. SMA outstanding bytessma_balloc 0. SMA bytes allocatedsma_bfree 0. SMA bytes freesms_nreq 14062 0.13 SMS allocator requestssms_nobj 0. SMS outstanding allocationssms_nbytes 487 SMS bytes bytes msmsms_ball 6844837 . SMS bytes allocatedsms_bfree 6846298 . SMS bytes freedbackend_req 7668789 72.79 Backend requests maden_vcl 1 0.00 N vcl totaln_vcl_avail 1 0.00 N vcl availablen_vcl_discard 0 0.00 N vcl discarded

Copyright © Windows knowledge All Rights Reserved