• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Intelligentes laden aus dem Cache

Hallo Leute,

um in meinem Netzwerk häufig anstehende Downloads zu beschleunigen (v.a. Windows Updates, Updates von Firefox, etc..) habe ich auf meinem sowieso immer laufenden Fileserver einen Squid eingerichtet.

Die Größe der zu cachenden Objekte habe ich entsprechend hoch gestellt, so das er eigentlich alles cacht, was aus dem Netz kommt und über Port 80 läuft.

Nun ist aber das Problem, das die meiste Software heute nicht mehr von einem Server sondern über Content Delivery Netzworks ala Akamai kommt.

Mein Squid erkennt dann nicht, das die Datei eigentlich schon im Cache liegt und lädt sie erneut aus dem Netz.
Gibt es für dieses Problem eine Lösung? Oder kann ich das Projekt an dieser Stelle schon abhacken?

Viel Grüße
Henri
 

spoensche

Moderator
Teammitglied
Wenn der Squid nur auf Port 80 auf Anfragen wartet und ein Programm aber einen anderen Port verwendet kann der Squid nichts cachen, weil der Verkehr an ihm vorbei läuft.

http://www.linupedia.org/opensuse/Squid
 
OP
H

HenriMaddox

Newbie
spoensche schrieb:
Wenn der Squid nur auf Port 80 auf Anfragen wartet und ein Programm aber einen anderen Port verwendet kann der Squid nichts cachen, weil der Verkehr an ihm vorbei läuft.

http://www.linupedia.org/opensuse/Squid

Das Problem besteht auch bei Port 80.
Als einfaches Beispiel habe ich Firefox auf 2 unterschiedlichen PCs heruntergeladen - der Cache ist dabei angewachsen - der Download wurde nicht beschleunigt.

Um eine Gegenprobe zu machen habe ich auf meinen Websspace eine Datei hochgeladen und eben von beiden Rechnern geladen - und da wurde es beim PC der als zweites mit Downloaden dran war aus dem Cache geladen.
 

spoensche

Moderator
Teammitglied
Du musst schon mehr Informationen geben.


Poste mal deine Squid Konfiguration. (/etc/squid.conf)
 
OP
H

HenriMaddox

Newbie
Guten Morgen,

im Grunde habe ich so gut wie nichts verändert:
Code:
visible_hostname localhost
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 10.0.0.0/8	# RFC1918 possible internal network
acl localnet src 172.16.0.0/12	# RFC1918 possible internal network
acl localnet src 192.168.0.0/16	# RFC1918 possible internal network

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 allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

http_access allow localnet

http_access deny all


icp_access allow localnet
icp_access deny all

http_port 3128


hierarchy_stoplist cgi-bin ?


cache_mem 128 MB


#Default:
# cache_dir ufs /var/squid/cache 100 16 256
cache_dir ufs /rpool/squid/cache 102400 16 256


maximum_object_size 9 GB


access_log /var/squid/logs/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 shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast

acl apache rep_header Server ^Apache
broken_vary_encoding allow apache

cache_effective_user webservd

dns_testnames localhost

coredump_dir /rpool/squid/cache

Gibt's für mein Problem eine spezielle Einstellung?

Viele Grüße
Henri
 

spoensche

Moderator
Teammitglied
Was sagen die Logfiles vom Squid?

In den Browsern hast du in der Proxykonfiguration Port 3128 eingetragen oder? Wird jeglicher Verkehr an den Squid umgeleitet?
 
OP
H

HenriMaddox

Newbie
Vorweg: Ich weis nicht, ob das Board meinen letzten Eintrag gefressen hat, oder ob diese erst freigeschaltet werden müssen. Daher kann es sein, dass das selbe gleich 2x hier steht.

Hallo und vielen Dank für die Antworten,

ich habe das ganze mal anhand vom Firefox Download an einem Rechner mit 2 Browsern probiert.

Der Proxy ist eingetragen und wird auch genutzt (man sieht ganz klar, das der Cache des Proxys identisch zur Größe der geladenen Datei wächst).

Nun habe ich mal die Einträge, die auf den Firefox hinweisen aus den Logs herausgenommen:
Kann aber nicht einschätzen, ob das, was er da macht nun richtig oder falsch ist - rein vom Endergebnis her ist es definitiv falsch
Code:
[b]access.log[/b]

1265409842.511   2751 192.168.1.113 TCP_REFRESH_HIT/200 19277651 GET http://mozilla-mirror.3347.voxcdn.com/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg - DIRECT/208.122.31.22 application/x-apple-diskimage

1265410101.613  13828 192.168.1.113 TCP_MISS/200 843759 GET http://mozilla2.snt.utwente.nl//firefox/releases/3.6/mac/de/Firefox%203.6.dmg - DIRECT/130.89.149.26 application/x-apple-diskimage

1265410295.476 447075 192.168.1.113 TCP_MISS/200 19277713 GET http://jp-nii01.mozilla.org/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg - DIRECT/150.99.187.58 application/x-apple-diskimage

[b]store.log[/b]

1265409840.301 RELEASE -1 FFFFFFFF F4EDFD02D30489A8165F0ACB86E34C58  304 1265409833        -1        -1 unknown -1/0 GET http://mozilla-mirror.3347.voxcdn.com/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg

1265409840.922 SWAPOUT 00 00000018 02294F346E63FEDF8E8096E63E64F41E  200 1265409833 1263602018        -1 application/x-apple-diskimage 19277161/19277161 GET http://mozilla-mirror.3347.voxcdn.com/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg

1265409842.511 RELEASE 00 0000003D 9B9C658C4F50654C32BE9BD12EF1E834  200 1265409833 1263602018        -1 application/x-apple-diskimage 19277161/-382 GET http://mozilla-mirror.3347.voxcdn.com/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg

1265410101.613 RELEASE 00 00000030 55EFF3EB9B024E00A6E344F4D7A73110  200 1265409943 1263602018        -1 application/x-apple-diskimage 19277161/844823 GET http://mozilla2.snt.utwente.nl//firefox/releases/3.6/mac/de/Firefox%203.6.dmg

1265410295.476 SWAPOUT 00 0000001D 65E2AD8046F79FF760D6DFA84CBD7313  200 1265409843 1263602018        -1 application/x-apple-diskimage 19277161/19277161 GET http://jp-nii01.mozilla.org/pub/mozilla.org/firefox/releases/3.6/mac/de/Firefox%203.6.dmg
 

spoensche

Moderator
Teammitglied
Poste mal die cache.log vom Squid.

Sieh dir auch mal http://www.squid-handbuch.de/hb/ an.

Im Cache werden i.d.R. die Webseiten gespeichert, die sehr oft und von verschiedenen Rechnern aufgerufen werden. Das Caching kann aber auch vom Webserver, an den du die Anfrage richtest per HTTP- Header beeinflusst werden.
 
OP
H

HenriMaddox

Newbie
Das ist der Bereich aus dem cache.log, der zu den o.g. Werten passt.

Das Handbuch werde ich mir heute Abend zu Gemüte führen - ist zum Frühstück etwas umfangreich :D


Code:
2010/02/05 23:43:40| 
Starting Squid Cache version 2.7.STABLE6 for i386-pc-solaris2.11...
2010/02/05 23:43:40| Process ID 971
2010/02/05 23:43:40| With 256 file descriptors available
2010/02/05 23:43:40| Using poll for the IO loop
2010/02/05 23:43:40| Performing DNS Tests...
2010/02/05 23:43:40| Successful DNS name lookup tests...
2010/02/05 23:43:40| DNS Socket created at 0.0.0.0, port 42780, FD 6
2010/02/05 23:43:40| Adding nameserver 192.168.1.1 from /etc/resolv.conf
2010/02/05 23:43:40| User-Agent logging is disabled.
2010/02/05 23:43:40| Referer logging is disabled.
2010/02/05 23:43:40| logfileOpen: opening log /var/squid/logs/access.log
2010/02/05 23:43:40| Unlinkd pipe opened on FD 11
2010/02/05 23:43:40| Swap maxSize 104857600 + 131072 KB, estimated 0 objects
2010/02/05 23:43:40| Target number of buckets: 403802
2010/02/05 23:43:40| Using 524288 Store buckets
2010/02/05 23:43:40| Max Mem  size: 131072 KB
2010/02/05 23:43:40| Max Swap size: 104857600 KB
2010/02/05 23:43:40| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec
2010/02/05 23:43:40| logfileOpen: opening log /var/squid/logs/store.log
2010/02/05 23:43:40| Rebuilding storage in /rpool/squid/cache (CLEAN)
2010/02/05 23:43:40| Using Least Load store dir selection
2010/02/05 23:43:40| Set Current Directory to /var/squid/cache
2010/02/05 23:43:40| Loaded Icons.
2010/02/05 23:43:40| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD 13.
2010/02/05 23:43:40| commSetNoLinger: FD 14: (99) Option not supported by protocol
2010/02/05 23:43:40| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2010/02/05 23:43:40| commSetNoLinger: FD 15: (99) Option not supported by protocol
2010/02/05 23:43:40| Accepting HTCP messages on port 4827, FD 15.
2010/02/05 23:43:40| commSetNoLinger: FD 16: (99) Option not supported by protocol
2010/02/05 23:43:40| Accepting SNMP messages on port 3401, FD 16.
2010/02/05 23:43:40| WCCP Disabled.
2010/02/05 23:43:40| Pinger socket opened on FD 17
2010/02/05 23:43:40| Ready to serve requests.
2010/02/05 23:43:40| icmpRecv: recv: (131) Connection reset by peer
2010/02/05 23:43:40| Store rebuilding is 70.2% complete
2010/02/05 23:43:40| Done reading /rpool/squid/cache swaplog (5837 entries)
2010/02/05 23:43:40| Finished rebuilding storage from disk.
2010/02/05 23:43:40|      5837 Entries scanned
2010/02/05 23:43:40|         0 Invalid entries.
2010/02/05 23:43:40|         0 With invalid flags.
2010/02/05 23:43:40|      5837 Objects loaded.
2010/02/05 23:43:40|         0 Objects expired.
2010/02/05 23:43:40|         0 Objects cancelled.
2010/02/05 23:43:40|         0 Duplicate URLs purged.
2010/02/05 23:43:40|         0 Swapfile clashes avoided.
2010/02/05 23:43:40|   Took 0.6 seconds (9335.8 objects/sec).
2010/02/05 23:43:40| Beginning Validation Procedure
2010/02/05 23:43:40|   Completed Validation Procedure
2010/02/05 23:43:40|   Validated 5837 Entries
2010/02/05 23:43:40|   store_swap_size = 112313k
2010/02/05 23:43:41| storeLateRelease: released 0 objects
2010/02/05 23:43:58| icmpSend: send: (96) Destination address required
2010/02/05 23:43:58| icmpSend: send: (96) Destination address required
2010/02/05 23:43:59| icmpSend: send: (96) Destination address required
2010/02/05 23:44:00| icmpSend: send: (96) Destination address required
2010/02/05 23:44:09| icmpSend: send: (96) Destination address required
2010/02/05 23:44:14| icmpSend: send: (96) Destination address required
2010/02/05 23:48:08| icmpSend: send: (96) Destination address required
2010/02/05 23:48:56| icmpSend: send: (96) Destination address required
2010/02/05 23:50:39| icmpSend: send: (96) Destination address required
2010/02/05 23:50:41| icmpSend: send: (96) Destination address required
2010/02/05 23:50:42| icmpSend: send: (96) Destination address required
2010/02/05 23:50:46| icmpSend: send: (96) Destination address required
2010/02/05 23:50:51| icmpSend: send: (96) Destination address required
2010/02/05 23:51:00| icmpSend: send: (96) Destination address required
2010/02/05 23:51:02| icmpSend: send: (96) Destination address required
2010/02/05 23:51:03| icmpSend: send: (96) Destination address required
2010/02/05 23:51:05| icmpSend: send: (96) Destination address required
2010/02/05 23:51:06| icmpSend: send: (96) Destination address required
2010/02/05 23:51:07| icmpSend: send: (96) Destination address required
2010/02/05 23:51:12| icmpSend: send: (96) Destination address required
2010/02/05 23:51:17| icmpSend: send: (96) Destination address required
2010/02/05 23:51:22| icmpSend: send: (96) Destination address required
2010/02/05 23:51:28| icmpSend: send: (96) Destination address required
2010/02/05 23:52:25| icmpSend: send: (96) Destination address required
2010/02/05 23:52:30| icmpSend: send: (96) Destination address required
2010/02/05 23:52:31| icmpSend: send: (96) Destination address required
2010/02/05 23:52:36| icmpSend: send: (96) Destination address required
2010/02/05 23:52:39| icmpSend: send: (96) Destination address required
2010/02/05 23:52:41| icmpSend: send: (96) Destination address required
2010/02/05 23:55:01| icmpSend: send: (96) Destination address required
2010/02/05 23:56:27| icmpSend: send: (96) Destination address required
2010/02/05 23:58:41| icmpSend: send: (96) Destination address required
2010/02/05 23:58:44| icmpSend: send: (96) Destination address required
2010/02/05 23:58:50| icmpSend: send: (96) Destination address required
2010/02/05 23:58:56| icmpSend: send: (96) Destination address required
2010/02/05 23:58:58| icmpSend: send: (96) Destination address required
2010/02/05 23:58:58| icmpSend: send: (96) Destination address required
2010/02/06 00:00:00| icmpSend: send: (96) Destination address required
2010/02/06 00:00:01| icmpSend: send: (96) Destination address required
2010/02/06 00:00:34| icmpSend: send: (96) Destination address required
2010/02/06 00:01:06| icmpSend: send: (96) Destination address required
2010/02/06 00:01:07| icmpSend: send: (96) Destination address required
2010/02/06 00:01:07| icmpSend: send: (96) Destination address required
2010/02/06 00:01:17| icmpSend: send: (96) Destination address required
2010/02/06 00:04:21| icmpSend: send: (96) Destination address required
2010/02/06 00:04:23| icmpSend: send: (96) Destination address required
2010/02/06 00:04:25| icmpSend: send: (96) Destination address required
2010/02/06 00:04:25| icmpSend: send: (96) Destination address required
2010/02/06 00:04:28| icmpSend: send: (96) Destination address required
2010/02/06 00:04:29| icmpSend: send: (96) Destination address required
2010/02/06 00:06:16| Preparing for shutdown after 432 requests
2010/02/06 00:06:16| Waiting 30 seconds for active connections to finish
2010/02/06 00:06:16| FD 13 Closing HTTP connection
2010/02/06 00:06:16| Closing Pinger socket on FD 17
2010/02/06 00:06:47| Shutting down...
2010/02/06 00:06:47| FD 14 Closing ICP connection
2010/02/06 00:06:47| FD 15 Closing HTCP socket
2010/02/06 00:06:47| FD 16 Closing SNMP socket
2010/02/06 00:06:47| Closing unlinkd pipe on FD 11
2010/02/06 00:06:47| storeDirWriteCleanLogs: Starting...
2010/02/06 00:06:47|   Finished.  Wrote 6002 entries.
2010/02/06 00:06:47|   Took 0.0 seconds (1157569.9 entries/sec).
CPU Usage: 6.337 seconds = 1.958 user + 4.378 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 0
Memory usage for squid via mallinfo():
	total space in arena:    4070 KB
	Ordinary blocks:         4029 KB     37 blks
	Small blocks:               0 KB      0 blks
	Holding blocks:          2184 KB      2 blks
	Free Small blocks:          0 KB
	Free Ordinary blocks:      41 KB
	Total in use:            6213 KB 99%
	Total free:                41 KB 1%
2010/02/06 00:06:47| logfileClose: closing log /var/squid/logs/store.log
2010/02/06 00:06:47| logfileClose: closing log /var/squid/logs/access.log
2010/02/06 00:06:47| Squid Cache (Version 2.7.STABLE6): Exiting normally.
 
Oben