[squid-users] How to cache <1KB content ? How to improve hit ratio in memory

Amos Jeffries squid3 at treenet.co.nz
Fri Mar 4 09:36:55 UTC 2016


On 4/03/2016 8:08 p.m., johnzeng wrote:
> 
> Hello Dear Sir
> 
> 
> I hope i can improve hit ratio of cache system recently , but i have two
> question .
> 
> first : whether maximum_object_size_in_memory can be writed ( other
> value less than 1KB)
> 
> maximum_object_size_in_memory 500 bytes ( whether it will be correct )
> 

Object size limits can go down as far as 0 bytes if you want/need that.

Squid currently understands the units: bytes, KB, MB, GB


> 
> Second :
> 
> When i set maximum_object_size_in_memory 4 KB and i found
> TCP_MEM_HIT/200 ( hit ratio )is very low based memory storage
> 
> When i set maximum_object_size_in_memory 1 KB and i found TCP_HIT/200 (
> hit ratio based disk storage )is
> 
> better than TCP_MEM_HIT/200( memory storage)
> 
> How to improve hit ratio in memory ?

I suggest you actually measure the traffic first. The best way to set
these ranges is to first measure a histogram of how many objects there
are passing through your proxy for each size.

When you do that you will see _bumps_ in the counts around certain
object sizes. I suggest setting the limits within a dip between two of
these bumps. Which position is up to you.


> 
> maximum_object_size_in_memory 1 KB
> 
> 04/Mar/2016:14:56:06 +0800.318 1 192.168.0.56 TCP_HIT/200 1113 GET
> http://image.sinajs.cn/newchart/small/t/sh000001.gif - HIER_NONE/- image/gif
> 04/Mar/2016:14:56:08 +0800.106 0 192.168.0.56 TCP_HIT/200 1113 GET
> http://image.sinajs.cn/newchart/small/t/sh000001.gif - HIER_NONE/- image/gif
> 04/Mar/2016:14:43:08 +0800.479 0 192.168.0.56 TCP_HIT/200 1656 GET
> http://www.swjtu.edu.cn/themes/12163/default494/images/bin_ico.png -
> HIER_NONE/- image/png
> 04/Mar/2016:14:43:08 +0800.485 1 192.168.0.56 TCP_HIT/200 3929 GET
> http://www.swjtu.edu.cn/themes/12163/default494/images/ico_arrow.png -
> HIER_NONE/- image/png
> 

How many bytes in 1 KB?  Compare it to the byte sizes above.


> maximum_object_size_in_memory 4 KB
> 
> 04/Mar/2016:11:35:24 +0800.708 0 192.168.0.56 TCP_MEM_HIT/200 2037 GET
> http://cpro.baidustatic.com/cpro/ui/noexpire/img/2.0.0/bd-logo5.png -
> HIER_NONE/- image/png
> 


Amos



More information about the squid-users mailing list