Strona 1 z 2

Squid - działał i praktycznie przestał

: 14 października 2010, 12:33
autor: LordRuthwen
Witam.
Mam trzy maszyny pracujące jako proxy. Dwie uruchamiane przeze mnie około rok temu, jedna odziedziczona.
Ostatnimi czasy dzwonią do mnie ludzie, że bardzo wolno wszystko działa i faktycznie, przez chwilkę działa jak należy a potem 10 minut czekania aż się jakakolwiek strona otworzy.
W procesach mam niby squida uruchomionego:

Kod: Zaznacz cały

2511 ?        Ss     0:00 /usr/sbin/squid -D -YC
 2514 ?        S      0:34 (squid) -D -YC
Pliki konfiguracyjne na obu maszynach wyglądają tak samo.

Kod: Zaznacz cały

auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
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 a80 src xxx.xxx.xxx.0/20
acl a85 src xxx.xxx.xxx.0/18
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access allow a80
http_access allow a85
http_access deny all
http_reply_access allow all
icp_access allow all
ident_lookup_access allow a80 a85 SSL_ports Safe_ports
http_port 8080
cache_peer xxx.xxx.xxx.yyx sibling 8080 3130 proxy-only
cache_peer xxx.xxx.xxx.yyy sibling 8080 3130 proxy-only
hierarchy_stoplist cgi-bin ?
cache_mem 96 MB
maximum_object_size 40960 KB
access_log /var/log/squid/access.log
emulate_httpd_log on
ftp_user Squid@xxx.xxx.pl
ftp_passive off
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern (Release|Package(.gz)*)$    0    20%    2880
refresh_pattern .        0    20%    4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
cache_mgr admin@xxx.xxx.pl
hosts_file /etc/hosts
coredump_dir /var/spool/squid
Jest jeszcze trzecia, która po prostu nie wyrabia, a działa - z tym, że uruchamiana była kilkanaście lat temu przez kogoś innego.

Teraz pytanie, o co chodzi i jak sobie z tym poradzić?

: 15 października 2010, 09:16
autor: bzyk
Sprawdz logi squida, czy nie ma jakis errorow produkowanych przez windowsowe wormy. Ja za czasow uzywania squidow pelno tego mialem. Robactwo bylo w stanie zarznac squida nietypowymi wywolaniami...

: 15 października 2010, 10:04
autor: LordRuthwen
Właśnie nie widzę tam nic dziwnego, jedyne co mnie zastanawia to takie coś w /var/log/messages:

Kod: Zaznacz cały

Oct 15 09:52:43 cache0 squid[2514]: Squid Parent: child process 2517 started
Oct 15 09:52:44 cache0 squid[2577]: Squid Parent: child process 2579 started
Oct 15 09:52:44 cache0 squid[2577]: Squid Parent: child process 2579 exited due to signal 6
Oct 15 09:52:47 cache0 squid[2577]: Squid Parent: child process 2591 started
Oct 15 09:52:47 cache0 squid[2577]: Squid Parent: child process 2591 exited with status 1
Oct 15 09:52:50 cache0 squid[2577]: Squid Parent: child process 2615 started
Oct 15 09:52:50 cache0 squid[2577]: Squid Parent: child process 2615 exited with status 1
Oct 15 09:52:53 cache0 squid[2577]: Squid Parent: child process 2617 started
Oct 15 09:52:53 cache0 squid[2577]: Squid Parent: child process 2617 exited with status 1
Oct 15 09:52:56 cache0 squid[2577]: Squid Parent: child process 2619 started
Oct 15 09:52:56 cache0 squid[2577]: Squid Parent: child process 2619 exited with status 1
Ale z tego co wyczytałem to nie jest związane z moim problemem.

//edycja
Zmieniłem jednej z maszyn adres IP, obecnie tylko ja z niej korzystam więc o innych zapytaniach nie ma mowy.
W logach mam takie coś:

Kod: Zaznacz cały

xxx.xxx.xxx.xxx - - [15/Oct/2010:10:39:57 +0200] "GET http://app.ceneostatic.pl/common/image/back/headers-sprite.png HTTP/1.0" 200 909 TCP_MISS :D IRECT
Efekt jest taki, że jak próbuję otworzyć kilka stron jedna po drugiej w osobnych zakładkach to pierwsze 2 otwierają się w całości a reszta już nie.

: 15 października 2010, 13:38
autor: bzyk
Może jakiś problem z dnsami? Z jakich squid korzysta? Zobacz squidclientem czy wszystko jest w porządku. Uruchom squida z przełącznikami:

Kod: Zaznacz cały

squid -N -d 1 -D
i zobacz czy log czegoś brzydkiego (DIRTY) nie wyświetli.

: 15 października 2010, 13:58
autor: LordRuthwen

Kod: Zaznacz cały

[B]# squidclient -p 8080 cache_object://localhost/info[/B]
HTTP/1.0 200 OK
Server: squid/2.7.STABLE3
Date: Fri, 15 Oct 2010 12:47:35 GMT
Content-Type: text/plain
Expires: Fri, 15 Oct 2010 12:47:35 GMT
X-Cache: MISS from cache2.xxx.xxx.pl
X-Cache-Lookup: MISS from cache2.xxx.xxx.pl:8080
Via: 1.0 cache2.xxx.xxx.pl:8080 (squid/2.7.STABLE3)
Connection: close

Squid Object Cache: Version 2.7.STABLE3
Start Time:     Fri, 15 Oct 2010 12:42:10 GMT
Current Time:   Fri, 15 Oct 2010 12:47:35 GMT
Connection information for squid:
        Number of clients accessing cache:      35
        Number of HTTP requests received:       2377
        Number of ICP messages received:        7634
        Number of ICP messages sent:    7634
        Number of queued ICP replies:   0
        Number of HTCP messages received:       0
        Number of HTCP messages sent:   0
        Request failure ratio:   0.00
        Average HTTP requests per minute since start:   439.8
        Average ICP messages per minute since start:    2825.2
        Select loop called: 152180 times, 2.131 ms avg
Cache information for squid:
        Request Hit Ratios:     5min: 11.9%, 60min: 11.9%
        Byte Hit Ratios:        5min: 0.5%, 60min: 0.5%
        Request Memory Hit Ratios:      5min: 25.4%, 60min: 25.4%
        Request Disk Hit Ratios:        5min: 25.7%, 60min: 25.7%
        Storage Swap size:      91764 KB
        Storage Mem size:       3360 KB
        Mean Object Size:       15.45 KB
        Requests given to unlinkd:      182
Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   0.03622  0.03622
        Cache Misses:          0.04047  0.04047
        Cache Hits:            0.00179  0.00179
        Near Hits:             0.05633  0.05633
        Not-Modified Replies:  0.00379  0.00379
        DNS Lookups:           0.00094  0.00094
        ICP Queries:           0.00075  0.00075
Resource usage for squid:
        UP Time:        324.247 seconds
        CPU Time:       2.732 seconds
        CPU Usage:      0.84%
        CPU Usage, 5 minute avg:        0.84%
        CPU Usage, 60 minute avg:       0.84%
        Process Data Segment Size via sbrk(): 8204 KB
        Maximum Resident Size: 0 KB
        Page faults with physical i/o: 1
Memory usage for squid via mallinfo():
        Total space in arena:    8204 KB
        Ordinary blocks:         7735 KB     22 blks
        Small blocks:               0 KB      0 blks
        Holding blocks:           280 KB      1 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:     468 KB
        Total in use:            8015 KB 94%
        Total free:               468 KB 6%
        Total size:              8484 KB
Memory accounted for:
        Total accounted:         5225 KB
        memPoolAlloc calls: 500214
        memPoolFree calls: 464171
File descriptor usage for squid:
        Maximum number of file descriptors:   1024
        Largest file desc currently in use:    150
        Number of file desc currently in use:  110
        Files queued for open:                   0
        Available number of file descriptors:  914
        Reserved number of file descriptors:   100
        Store Disk files open:                   1
        IO loop method:                     epoll
Internal Data Structures:
          5989 StoreEntries
           732 StoreEntries with MemObjects
           727 Hot Object Cache Items
          5939 on-disk objects

Kod: Zaznacz cały

[B]# squidclient -p 8080 onet.pl[/B]
HTTP/1.0 400 Bad Request
Server: squid/2.7.STABLE3
Date: Fri, 15 Oct 2010 12:53:02 GMT
Content-Type: text/html
Content-Length: 1177
Expires: Fri, 15 Oct 2010 12:53:02 GMT
X-Squid-Error: ERR_INVALID_URL 0
X-Cache: MISS from cache2.xxx.xxx.pl
X-Cache-Lookup: NONE from cache2.xxx.xxx.pl:8080
Via: 1.0 cache2.xxx.xxx.pl:8080 (squid/2.7.STABLE3)
Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="onet.pl">onet.pl</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Invalid URL
</STRONG>
</UL>

<P>
Some aspect of the requested URL is incorrect.  Possible problems:
<UL>
<LI>Missing or incorrect access protocol (should be `http://'' or similar)
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:admin@xxx.xxx.pl">admin@xxx.xxx.pl</A>.

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Fri, 15 Oct 2010 12:53:02 GMT by cache2.xxx.xxx.pl (squid/2.7.STABLE3)
</ADDRESS>
</BODY></HTML>

Kod: Zaznacz cały

[B]# squid -N -d 1 -D[/B]
2010/10/15 14:42:10| Starting Squid Cache version 2.7.STABLE3 for i386-debian-li                                                                             nux-gnu...
2010/10/15 14:42:10| Process ID 5394
2010/10/15 14:42:10| With 1024 file descriptors available
2010/10/15 14:42:10| Using epoll for the IO loop
2010/10/15 14:42:10| DNS Socket created at 0.0.0.0, port 55354, FD 6
2010/10/15 14:42:10| Adding domain xxx.xxx.pl from /etc/resolv.conf
2010/10/15 14:42:10| Adding nameserver xxx.xxx.xxx.xxx from /etc/resolv.conf
2010/10/15 14:42:10| Adding nameserver xxx.xxx.xxx.xxx from /etc/resolv.conf
2010/10/15 14:42:10| User-Agent logging is disabled.
2010/10/15 14:42:10| Referer logging is disabled.
2010/10/15 14:42:10| logfileOpen: opening log /var/log/squid/access.log
2010/10/15 14:42:10| Unlinkd pipe opened on FD 11
2010/10/15 14:42:10| Swap maxSize 102400 KB, estimated 7876 objects
2010/10/15 14:42:10| Target number of buckets: 393
2010/10/15 14:42:10| Using 8192 Store buckets
2010/10/15 14:42:10| Max Mem  size: 98304 KB
2010/10/15 14:42:10| Max Swap size: 102400 KB
2010/10/15 14:42:10| Local cache digest enabled; rebuild/rewrite every 3600/3600                                                                              sec
2010/10/15 14:42:10| logfileOpen: opening log /var/log/squid/store.log
2010/10/15 14:42:10| Rebuilding storage in /var/spool/squid (CLEAN)
2010/10/15 14:42:10| Using Least Load store dir selection
2010/10/15 14:42:10| Set Current Directory to /var/spool/squid
2010/10/15 14:42:10| Loaded Icons.
2010/10/15 14:42:11| Accepting proxy HTTP connections at 0.0.0.0, port 8080, FD                                                                              13.
2010/10/15 14:42:11| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2010/10/15 14:42:11| HTCP Disabled.
2010/10/15 14:42:11| WCCP Disabled.
2010/10/15 14:42:11| Configuring xxx.xxx.xxx.xxx Sibling xxx.xxx.xxx.xxx/8080/3130
2010/10/15 14:42:11| Configuring xxx.xxx.xxx.xxx Sibling xxx.xxx.xxx.xxx/8080/3130
2010/10/15 14:42:11| Ready to serve requests.
2010/10/15 14:42:11| Store rebuilding is 77.8% complete
2010/10/15 14:42:11| Done reading /var/spool/squid swaplog (5263 entries)
2010/10/15 14:42:11| Finished rebuilding storage from disk.
2010/10/15 14:42:11|      5263 Entries scanned
2010/10/15 14:42:11|         0 Invalid entries.
2010/10/15 14:42:11|         0 With invalid flags.
2010/10/15 14:42:11|      5263 Objects loaded.
2010/10/15 14:42:11|         0 Objects expired.
2010/10/15 14:42:11|         0 Objects cancelled.
2010/10/15 14:42:11|         0 Duplicate URLs purged.
2010/10/15 14:42:11|         0 Swapfile clashes avoided.
2010/10/15 14:42:11|   Took 0.3 seconds (17865.4 objects/sec).
2010/10/15 14:42:11| Beginning Validation Procedure
2010/10/15 14:42:11|   Completed Validation Procedure
2010/10/15 14:42:11|   Validated 5263 Entries
2010/10/15 14:42:11|   store_swap_size = 91844k
2010/10/15 14:42:11| storeLateRelease: released 0 objects
2010/10/15 14:43:17| temporary disabling (Not Found) digest from xxx.xxx.xxx.xxx
Żadnego DIRTY nie ma.
Natomiast dziwi mnie ten środkowy kod :)

: 15 października 2010, 14:25
autor: Pacek
A próbowałeś zacząć od najprostszej rzeczy - wyczyszczenia pamięci podręcznej? Może jest tam taki "burdello, bum, bum", że squid nie daje rady. Tu taki najszybciej znaleziony przez Google artykuł jak to zrobić: http://www.linuxquestions.org/questions ... xy-359346/

: 15 października 2010, 14:45
autor: LordRuthwen
Od tego zacząłem :)

: 15 października 2010, 14:50
autor: Pacek
Sprawdź, może coś jeszcze zużywa zasoby (CPU, pamięć) : Poza tym jak używasz Squida? Jako przezroczyste proxy, czy wprowadzasz proxy w przeglądarce?

: 15 października 2010, 14:57
autor: LordRuthwen
W przeglądarce i to nie jest wymagane, po prostu dla ludzi na radio dużo daje.
W top nie widać nic szczególnego, w zasadzie najwyżej jest squid, czasem przebija go vmware-questd.

: 15 października 2010, 15:02
autor: Pacek
A na pozostałych serwerach masz VMWare? Bo ja powiem Ci szczerze, że u mnie mam 3 maszyny wirtualne na serwerze odpalone i też potrafią przymulić serwer. Chodzi o to, że w momencie kiedy coś zapisują, to dysk się obciąża tak, że np. czasami podczas edycji w mc kilka razy wcisnę F2, żeby zapisać, to na 5 sekund mam przerwę bo wisi komunikat, że zapisuje. Czasami zdarza się, że serwer na chwile łapie sporego laga. Może coś w tym kierunku, bo może niekoniecznie przyczyną jest Squid sam w sobie.