Melhorar Cache Squid

1. Melhorar Cache Squid

EduardoAlvarenga
ealvarenga_f

(usa Debian)

Enviado em 22/07/2015 - 11:50h

Estou testando a versão do Squid 3.4.13, compilado pelo código fonte.
Esta experiencia foi iniciada em face do Squid 2.7 que estou utilizando esta com uma utilização do Cache muito baixa, ou seja, praticamente 10% no Cache e 90% sem Cache; não estou falando do HTTPS.
Tendo configurado o Squid 3.4.13, em teste, vejo que também esta sendo pouco efetivo, considerando que como Cache esta sendo pouco utilizando, praticamente, que é o objetivo do próprio Squid.

Segue meu cenário de teste:

Hardware - Servidor Dell T300 - Processador Xeon 3.0 - 4Gb de RAM - HD SATA de 500Gb
OS: Microsoft Server Hyper-V

Host 1 - Servidor Proxy/Firewall
Memoria alocada: 780Mb
HD: 80Gb
OS: Debian 7.4
Rede: 2 Ethernet
Particionamento: Automático
Versão Squid 3.4.13

Host 2 - Cliente
Memoria alocada: 1024
HD: 100Gb
SO: Microsoft Windows 7
Navegador: Internet Explorer 11

Configuração do SQUID
### IP e Porta que escuta Squid 3.4
http_port 10.10.10.1:3128

### Ativando DEBUG com Detalhes
debug_options 28,1
#log_fqdn on

### Mostrar horario no LOG Legivel
#emulate_httpd_log on

### Configurando Idioma das mensagem
error_directory /usr/share/squid/errors/pt-br

### Registro LOG
cache_access_log /var/log/squid/access.log
access_log /var/log/squid/access.log
cache_log /var/cache/squid/cache.log
cache_store_log /var/cache/squid/store.log

### ACL Rede LAN
acl localnet src 10.10.10.0/24

### Configuracao de Memoria RAM
cache_mem 260 MB
memory_cache_mode always
maximum_object_size_in_memory 512 KB
memory_replacement_policy heap GDSF

### Configuracao de Memoria Swap
cache_swap_low 90
cache_swap_high 95
cache_replacement_policy heap LFUDA

### Configuracao Cache em HD
cache_dir aufs /var/cache/squid 16000 16 256
maximum_object_size 450 MB
minimum_object_size 0 KB

### Regra atualizacao Cache
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet
http_access allow localhost
http_access deny all

coredump_dir /var/cache/squid

mail_program mail
cache_effective_user squid
cache_effective_group squid
httpd_suppress_version_string off
visible_hostname fw001.redelocal.net
cache_mgr webmaster

Veja o LOG que me apresenta, estou pegando parte com casos diferente para facilitar e não ser massante

LOG 1 - TCP_MISS - pelo que entendi e quando esta buscando direto na fonte, ou na internet, isso ocorre mesmo acessando varias vezes o mesmo site
1437486497.868 299 10.10.10.3 TCP_MISS/200 2010 GET http://c.s-microsoft.com/pt-br/CMSImages/bing-search-logo.png? - HIER_DIRECT/104.79.255.150
1437486497.978 393 10.10.10.3 TCP_MISS/200 19479 GEThttp://c.s-microsoft.com/pt-br/CMSImages/bing-search-logo.png? - HIER_DIRECT/104.79.255.150 image/png
1437486497.978 393 10.10.10.3 TCP_MISS/200 19479 GET http://c.s-microsoft.com/pt-br/CMSImages/click-run_pt-br.jpg? - HIER_DIRECT/104.79.255.150 image/png
1437486498.098 531 10.10.10.3 TCP_MISS/200 57100 GET http://c.s-microsoft.com/pt-br/CMSImages/click-run_pt-br.jpg? - HIER_DIRECT/104.79.255.150 image/jpg
1437486498.098 531 10.10.10.3 TCP_MISS/200 57100 GET http://c.s-microsoft.com/pt-br/CMSScripts/script.jsx? - HIER_DIRECT/104.79.255.150 image/jpg
1437486498.202 636 10.10.10.3 TCP_MISS/200 91440 GET http://c.s-microsoft.com/pt-br/CMSScripts/script.jsx? - HIER_DIRECT/104.79.255.150 text/javascript
1437486498.202 636 10.10.10.3 TCP_MISS/200 91440 GET http://c.s-microsoft.com/pt-br/CMSStyles/style.csx? - HIER_DIRECT/104.79.255.150 text/javascript
1437486498.209 644 10.10.10.3 TCP_MISS/200 36562 GET http://c.s-microsoft.com/pt-br/CMSStyles/style.csx? - HIER_DIRECT/104.79.255.150 text/css
1437486498.209 644 10.10.10.3 TCP_MISS/200 36562 GET http://cdn.optimizely.com/js/1715500327.js - HIER_DIRECT/72.21.91.8 text/javascr text/css
1437486555.213 414 10.10.10.3 TCP_MISS/200 41692 GET http://www.googletagservices.com/tag/js/gpt.js - HIER_DIRECT/173.194.42.141 text/javascript 173.22
1437486555.213 414 10.10.10.3 TCP_MISS/200 17437 GET http://www.usadofacil.com.br/v2009/default.asp - HIER_DIRECT/173.194.42.141 text/javascript 173.22
1437486555.823 82 10.10.10.3 TCP_MISS/300 17437 GET http://www.googletagservices.com/tag/js/gpt.js - HIER_DIRECT/173.194.42.141 text/javascript 173.22
1437486555.823 82 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/banners/citavelpromo.swf - HIER_DIRECT/94.42.141 text/javascript 173.22
1437486555.958 56623 10.10.10.3 TCP_MISS/200 10164 CONNECT www.facebooacil.com.br/banners/citavelpromo.swf - HIER_DIRECT/186.202.128.40 -
1437486555.958 56623 10.10.10.3 TCP_MISS/200 10164 CONNECT www.facebook.com:443 - HIER_DIRECT/31.13.85.8 -
1437486555.960 56279 10.10.10.3 TCP_MISS/200 7085 CONNECT www.facebook.com:443 - HIER_DIRECT/31.13.85.8 -
1437486555.960 56279 10.10.10.3 TCP_MISS/200 70854 CONNECT www.facebook.com:443 - HIER_DIRECT/31.13.85.8 -
1437486555.962 55788 10.10.10.3 TCP_MISS/200 87346 CONNECT fbstatic-a.akamaihd.net:443 RECT/31.13.85.8 -
1437486555.962 55788 10.10.10.3 TCP_MISS/200 87346 CONNECT fbstatic-a.akamaihd.net:443 - HIER_DIRECT/173.223.53.24 -
BHIER_DIREC980 55945128.40 text/htmlMISS/200 87346 CONNECT fbstatic-a.akamaihd.net:443 - HIER_DIRECT/173.223.53.24 -
1437486555.980 55945 10.10.10.3 TCP_MISS/200 87346 CONNECT fbstatic-a.akamaihd.net:443 - HIER_DIRECT/173.223.53.24 -
1437486555.983 55945 10.10.10.3 TCP_MISS/200 7818 CONNECT vortex.data.microsoft.com:443 - HIER_DIRECT/64.423.53.24 -
1437486555.983 57092 10.10.10.3 TCP_MISS/200 87346 CONNECT fbstatic-a.akamaihd.net:443 - HIER_DIRECT/173.2.54.254 -
1437486556.051 99 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.bcom:443 - HIER_DIRECT/64.4.54.254 --
ogletagse6.051 99ag/js/gpt.jsTCP_MISS/304 372 GET http://www.usadofacil.com.br/fotosnews/jatomayvw.jpg - HIER_DIRECT/186.202.128.40 -
K437486556.098 99 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotosnews/carononovo15ja.jpg - HIER_DIRECT/186.202.128.40 -
8 CONNECT6.098 145.microsoft.com:443 - 304 372 GET http://www.usadofacil.com.br/fotosnews/caronayvw.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.102 145 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotosnews/carononovo15ja.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.102 14--More--10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotos/fotos_claonovo15ja.jpg - HIER_DIRECT/186.202.128.40 -
m 6.102 140 304 372 GET http://www.usadofacil.com.br/fotos/fotos_class/3701450.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.102 149 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotosnews/bdb.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.102 149 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotosnews/bdb.jpg - HIER_DIRECT/186.202.128.40 -
mhttp://w6.104 149l.com.br/ - HIER_DIRE304 371 GET http://www.usadofacil.com.br/fotosnews/s10highcountry.jpg - HIER_DIRECT/186.202.128.40
- 6.102 149 304 371 GET http://www.usadofacil.com.br/fotosnews/s10highcountry.jpg - HIER_DIRECT/186.202.128.40 -
2mGET htt6.112 152ofacil.com.br/banners304 372 GET http://www.usadofacil.com.br/fotos/fotos_class/3701451.jpg - HIER_DIRECT186.202.128.40 -
1437486556.112 152 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotos/fotos_class/3701451.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.122 141 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotos/fotos_class/3701360.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.122 141 10.10.10.3 TCP_MISS/304 372 GET http://www.usadofacil.com.br/fotos/fotos_class/3701360.jpg - HIER_DIRECT/186.202.128.40 -
BHIER_DIR6.125 72128.40 text/htmlMISS/304 371 GET http://www.usadofacil.com.br/fotos/fotos_class/3701360.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.125 72 10.10.10.3 TCP_MISS/304 371 GET http://www.usadofacil.com.br/fotos/fotos_class/3701152.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.130 147 10.10.10.3 TCP_MISS/304 371 GET http://www.usadofacil.com.br/fotos/fotos_class/3689267.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.130 147 10.10.10.3 TCP_MISS/304 371 GET http://www.usadofacil.com.br/fotos/fotos_class/3689267.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.183 82 10.10.10.3 TCP_MISS/304 370 GET http://www.usadofacil.com.br/fotos/fotos_class/3701355.jpg - HIER_DIRECT/186.202.128.40 -
1437486556.183 82 10.10.10.3 TCP_MISS/304 370 GET http://www.usadofacil.com.br/fotos/fotos_class/3701355.jpg - HIER_DIRECT/186.202.128.40 -
6.183 79 304 370 GET http://www.usadofacil.com.br/fotos/fotos_class/3622639.jpg - HIER_DIRECT/186.202.128.40 -

LOG 2 - TCP_IMS_HIT - Parece que este esta pegando do Cache no HD do Servidor
1437486560.312 0 10.10.10.3 TCP_IMS_HIT/304 315 GET http://crl.geotrust.com/crls/secureca.crl HIER_DIREC/23.4.181.163 application/pkix-crl
0;1mHIER60.312 094.42.154 - TCP_IMS_HIT/304 315 GET http://crl.geotrust.com/crls/secureca.crl - HIER_NONE/- application/pkix-crl
m490tags60.312 0ore--e--t.jsTCP_IMS_HIT/304 315 GET http://crl.geotrust.com/crls/secureca.crl - HIER_NONE/- application/pkix-crl
1437486568.312 1 10.10.10.3 TCP_IMS_HIT/304 315T http://crl.geotrust.com/crls/secureca.crl - - HIER_NONE/- application/pkix-crl
8.jpg - 60.338 086.202.128.4TCP_IMS_HIT/304 315 GET http://crl.geotrust.com/crls/secureca.crl - HIER_NONE/- application/pkix-crl
1437486568.338 1 10.10.10.3 TCP_IMS_HIT/304 GET http://crl.geotrust.com/crls/secureca.crl -l - HIER_NONE/- application/pkix-crl

LOG 3 - TCP_MEM_HIT - Parece que este esta pegando do Cache no MEMORIA do Servidor
1437486562.621 0 10.10.10.3 TCP_MEM_HIT/200 1021 ication/ocsp-response
trtiGrpagS8CCFMD4rDXS1eX.10.10.3 TCP_MEM_HIT/200 1021 GET http://clients1.google.com/ocsp/MEkwRzBFMEMwQTAJBgUrDgMCGgUABBTy4Gr5hYodjXCbSRkjeqm1Gih%2BZAQUSt0GFh...
1437486562.621 0 10.10.10.3 TCP_MEM_HIT/200 1021 p-response
trtiGrpagS8CCFMD4rDXS1eX.10.10.3 TCP_MEM_HIT/200 1021 GET http://clients1.google.com/ocsp/MEkwRzBFMEMwQTAJBgUrDgMCGgUABBTy4Gr5hYodjXCbSRkjeqm1Gih%2BZAQUSt0GFh...
1437486562.622 0 10.10.10.3 TCP_MEM_HIT/200 1021 p-response
trtiGrpagS8CCFMD4rDXS1eX.10.10.3 TCP_MEM_HIT/200 1021 GET http://clients1.google.com/ocsp/MEkwRzBFMEMwQTAJBgUrDgMCGgUABBTy4Gr5hYodjXCbSRkjeqm1Gih%2BZAQUSt0GFh...
1437486562.622 0 10.10.10.3 TCP_MEM_HIT/200 1021 p-response
trtiGrpagS8CCFMD4rDXS1eX.10.10.3 TCP_MEM_HIT/200 1021 GET http://clients1.google.com/ocsp/MEkwRzBFMEMwQTAJBgUrDgMCGgUABBTy4Gr5hYodjXCbSRkjeqm1Gih%2BZAQUSt0GFh...
1437486563.070 5894 10.10.10.3 TCP_MISS/200 4268 CONNECT ponse

LOG 4 - Outros com menos registro
1437486631.332 26067 10.10.10.3 TCP_MISS/200 1147CONNECT tpc.googlesyndication.com:443 - HIER_DIRECT/173.194.42.139 -
1437486631.406 74 10.10.10.3 TCP_MISS_ABORTED/404 5401 GET googlesyndication.com:443 - HIER_DIRECT/173.194.42.139 -

1437487917.378 72 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548 GET http://www.clickjogos.com.br/fee/173.223.53.42 image/gif
1437488019.457 144 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548 0d65/bxk-premium-games/home/4/ - HIT/173.223.53.42 image/gif
ER_7488019.457 144 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548 GET http://www.clickjogos.com.br/feeds/1ff5774796573f3285f879ba12fc0d65/bxk-premium-games/home/4/">http://www.clickjogos.com.br/feeds/1ff5774796573f3285f879ba12fc0d65/bxk-premium-games/home/4/ - H
1437488034.431 74 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548 GET http://www.clickjogos.com.br/feeds/1ff57747965 image/gif
ER_DIRECT/173.223.53.42 application/jCLIENT_REFRESH_MISS/200 3548 GET.com.br/loading.gifHIER_DIRECT/74.173.223.53.4273f3285f879ba12fc0d65/bxk-premium-games/home/4/ - HI
1437488034.431 62 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548
ER_7488034.431 62 10.10.10.3 TCP_CLIENT_REFRESH_MISS/200 3548 GET http://www.clickjogos.com.br/feeds/1ff5774796573f3285f879ba12fc0d65/bxk-premium-games/home/4/">http://www.clickjogos.com.br/feeds/1ff5774796573f3285f879ba12fc0d65/bxk-premium-games/home/4/ - HI
1437488034.525 10314 10.10.10.3 TCP_MISS/200 6064 CONNECT

Pela minha analise, acredito que mais de 50% do LOG deveria ser servido pelo Cache, pois é pagina HTTP e foram acessadas mais de 3 vezes.





  






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts