R
R
roman012016-02-20 09:43:12
Squid
roman01, 2016-02-20 09:43:12

How to properly optimize Squid 3 for better performance?

Good afternoon!
Please help in optimizing squid to speed up Internet access.
There is an Internet access channel with average throughput characteristics and approximately 300 users.
The server where the proxy is located has 8Gb RAM, RAID-5, gigabit network adapters. I plan to use it only for distribution of the Internet.
Version squid - 3.4.8
I need a small disk cache (about 20 gigs)
Here is the config I got:
(I give only important settings), I don’t have regulars yet, only standard ones, while it’s important to achieve maximum performance
#
Memory_pools memory usage settings on
memory_pools_limit 0
# RAM cache settings
cache_mem 6024 MB
Download now maximum_object_size_in_memory 512 KB Download now
memory_replacement_policy lru
# Setting the disk cache
cache_replacement_policy heap LFUDA
cache_dir ufs / var / cache / the squid 20,000
48,256 maximum_object_size 20024 KB Download now
minimum_object_size 0.5 KB Download now
# Automatic resuming small files
range_offset_limit 1024 KB Download now
# Caching IP-addresses
ipcache_size 8192
# Configure logging
cache_store_log none
client_db off
# Close half closed connections
half_closed_clients off
# Hard caching for some static file types
refresh_pattern -i \.bz2$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.exe$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.gif$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.gz$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.ico$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.jpg$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.mid$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.mp3$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.mp4$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.pdf$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.swf$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.svg$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.tar$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.tgz$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.zip$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.rar$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.msi$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
refresh_pattern -i \.png$ 43200 100% 43200 override-lastmod override-expire ignore-reload ignore-no-cache
# Basic caching options
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
I do not give other settings, for example, pool settings, since this is not important yet.
Here is my plan for myself:
1) maximum use of RAM
2) cache on disk for storing larger files - installers, pictures, etc. .d
3) store small and frequently occurring files in RAM
First ambush:
originally used the
minimum_object_size 1024 KB parameter - with the expectation that only files larger than or equal to this size will get to the disk cache.
As a result, only TCP_MISS is in the logs - objects were not found in the cache. Removed.
Second:
now the probability of hitting the cache is quite low 1-2% of daily traffic
Third:
not all files, even those that meet the conditions, get into the cache. For example, I'm trying to download a pdf file (5 Mb) from here www.niva-club.net/downloads.php?view=detail&df_id=19. It is not cached in any.
Fourth:
the return of the Internet is somehow wrong, some pages do not download to the end for a long time, the browser may not open the page for 3-5 seconds, etc.
In general, I feel that somewhere I am very wrong in the settings. Maybe someone will tell you something.
Yes, I almost forgot: after trial and error, memory_replacement_policy left lru, since with it the cache hit percentage is still higher. TCP_MISS / 200 TCP_MISS / 302 and rarely TCP_MEM_HIT / 200 prevail
in the logs

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai, 2017-07-02
@nevzorofff

If the server is used only for squid, then why not make a normal disk cache? 20 gigs is not enough for 300 users? With six gigs of RAM, you can make 60 cache.
Your usage has not risen above 1-2%?
Now I'm a little puzzled by the same question, tk. clients appeared on expensive and slow channels (3G and satellite). But it seems that because of the ubiquitous https, there will be no sense in squid :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question