squid problemas com cache

1. squid problemas com cache

Jerônimo Mozer
jmozer

(usa KUbuntu)

Enviado em 27/09/2010 - 17:34h

Pessoal, tenho um servidor com squid 2.7.STABLE3 e proxy (transparente), o problema que estou tendo é que tudo fica em cache, eu sei... eu sei... é o intuito da coisa... na verdade o único propósito de ter instalado o squid foi pra resolver um problema da GVT (conexão/modem) que não era possível liberar a navegação em alguns sites, então acabamos resolvendo através da instalação do squid e um proxy transparente, o problema é que como trabalhamos com desenvolvimento e muita coisa fica diretamente no servidor as versões dos sites acabam ficando em cache e por isso não conseguimos visualiza-las assim que salvamos os arquivos no servidor... Pra resolver isso criamos um script (shell) pra limpar o cache... ocasiona uma certa lentidão no processo porque o script finaliza o squid, limpa o diretório com cache e executa novamente o squid... (aproximadamente uns 2 a 3 minutos são perdidos pra executar esse script), acabamos executando esse script umas 100 vezes por dia... perdemos muito tempo nisso... então alguém tem ideia de como fazer com que não seja criado cache de nada?

O meu squid.conf é esse (removi a maioria das linhas comentadas):

#Recommended minimum configuration:
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 192.168.1.0/24 # RFC1918 possible internal network
#
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

#Recommended minimum configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Only allow purge requests from localhost
http_access allow purge localhost
http_access deny purge
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

#Allow ICP queries from local networks only
icp_access allow localnet
icp_access deny all

#
# Squid normally listens to port 3128
http_port 3128 transparent

#We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?


# MEMORY CACHE OPTIONS
# -----------------------------------------------------------------------------

#
#Default:
cache_mem 8 MB

# TAG: maximum_object_size_in_memory (bytes)
# Objects greater than this size will not be attempted to kept in
# the memory cache. This should be set high enough to keep objects
# accessed frequently in memory to improve performance whilst low
# enough to keep larger objects from hoarding cache_mem.
#
#Default:
maximum_object_size_in_memory 8 KB

# TAG: memory_replacement_policy
# The memory replacement policy parameter determines which
# objects are purged from memory when memory space is needed.
#
# See cache_replacement_policy for details.
#
#Default:
# memory_replacement_policy lru


# DISK CACHE OPTIONS
# -----------------------------------------------------------------------------
minimum_object_size 0 KB

maximum_object_size 4096 KB

cache_swap_low 90
cache_swap_high 95


access_log /var/log/squid/access.log squid

# -----------------------------------------------------------------------------


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 apache rep_header Server ^Apache
broken_vary_encoding allow apache


extension_methods REPORT MERGE MKACTIVITY CHECKOUT


ignore_expect_100 on


# CACHE DIGEST OPTIONS
# -----------------------------------------------------------------------------

# TAG: digest_generation
# This controls whether the server will generate a Cache Digest
# of its contents.
#
#Default:
# digest_generation on

# TAG: digest_bits_per_entry
# This is the number of bits of the server's Cache Digest which
# will be associated with the Digest entry for a given HTTP
# Method and URL (public key) combination. The default is 5.
#
#Default:
# digest_bits_per_entry 5

# TAG: digest_rebuild_period (seconds)
# This is the wait time between Cache Digest rebuilds.
#
#Default:
# digest_rebuild_period 1 hour

# TAG: digest_rewrite_period (seconds)
# This is the wait time between Cache Digest writes to disk.
#
#Default:
# digest_rewrite_period 1 hour

# TAG: digest_swapout_chunk_size (bytes)
# This is the number of bytes of the Cache Digest to write to
# disk at a time. It defaults to 4096 bytes (4KB), the Squid
# default swap page.
#
#Default:
# digest_swapout_chunk_size 4096 bytes

# TAG: digest_rebuild_chunk_percentage (percent, 0-100)
# This is the percentage of the Cache Digest to be scanned at a
# time. By default it is set to 10% of the Cache Digest.
#
#Default:
# digest_rebuild_chunk_percentage 10


hosts_file /etc/hosts


coredump_dir /var/spool/squid

obrigado!


  


2. Re: squid problemas com cache

Renato Carneiro Pacheco
renato_pacheco

(usa Debian)

Enviado em 27/09/2010 - 17:40h

Poste o seu squid.conf aki q falaremos quais linhas vc deve remover.


3. Re: squid problemas com cache

Jerônimo Mozer
jmozer

(usa KUbuntu)

Enviado em 27/09/2010 - 18:09h

Renato, obrigado por sua ajuda, atualizei a minha pergunta, inseri o conteúdo do squid.conf.


4. Re: squid problemas com cache

Perfil removido
removido

(usa Nenhuma)

Enviado em 27/09/2010 - 18:27h

Duas maneira:

1- Zerando o tamanho de espaço de cache:
maximum_object_size_in_memory 0 KB
maximum_object_size 0 KB

2- Não usar cache em determinados endereços
# Url que não deve ser cacheada
acl semcache urlpath_regex "/etc/squid/semCache"

e depois a invoque:

#cache
no_cache deny semcache

Crie o arquivo semCache:
# touch /etc/squid/semCache

Coloque nele os endereços e depois aplique as mudanças no squid:
# squid -k reconfigure



  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts