Search squid archive

Re: Are there benefits increasing read_ahead_gap in reverse proxy with collapsed_forwarding?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Think of read_ahead_gap as a maximum buffer size for incoming data from origin sites to squid.

The main benefit of read_ahead_gap is that if your origin is burst or prone to stalling, squid will buffer more of the incoming data stream in order to deliver content more smoothly to clients. If you set read_ahead_gap to a value larger than the maximum object size, then upon a cache miss squid will download the entire file as quickly as it can, then hold it in memory while it serves it to the client. It will swap it to disk as soon as it's finished downloading, but any part of the file that has been retrieved by squid, but not sent to a client yet, will stay in memory until that transfer is complete.

Setting this to 500MB is IMO overkill and will lead to memory starvation issues (remember, this is the maximum buffer size *per object*) if you hit a decent number of simultaneous cache misses of large objects.

If the origin servers are fairly close to the proxy, then I'd say you'd do better with a read_ahead_gap value in the single MB range, depending on your total memory available.

HTH,

-Chris

On Mar 23, 2009, at 6:08 PM, Charlie Killian wrote:

Is there any benefit to changing the read_ahead_gap when running squid as a
reverse proxy?

I'm running squid as a reverse proxy pointing at several origin servers. The
average filesize is 300 MB.

From the documentation, I gather that the default read_ahead_gap 16 kb would keep the connection from squid to the origin server open for the duration of
the client request.

If I increase the read_ahead_gap to 500 MB, will squid slurp up the entire
file in one read from the origin server?

Also, does the file stay in memory as it's being sent to the client or is it
written to the squid cache? i.e. do I need to worry about memory?

Here's part of the configs:

maximum_object_size_in_memory 100 MB
collapsed_forwarding on
http_port 80 accel defaultsite=origin.example.com
read_ahead_gap 500 MB


I'm running: 2.7.STABLE2 on RHEL5.2 64bit

Thanks,

Charlie



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux