Squid Maximum Object Size



  • Hi,

    In Squid there is an option that I really don't understand it, or it is actually wrong !

    Maximum object size
    Objects larger than the size specified (in kilobytes) will not be saved on disk. If you wish to increase speed more than you want to save bandwidth, this should be set to a low value.

    Since the bigger the size, the more Squid caches files in disk, thus, fast download and browsing for end clients ! thats the way I see it should be !

    Isn't the other way around should be in the description ? Am being an idiot or what ?



  • I think what the description is saying is that;
    If you cache a bigger file, the first time you download it, the download will be slower. The reason maybe that it has to write to the pfsense hard disk first. This would definitely save a lot of bandwidth the second time a user request that object, as it will be served from cache and it will be faster this time. But when the description says "If you wish to increase speed more than you want to save bandwidth" it means the first time download of the object.



  • @zoro_2009:

    Since the bigger the size, the more Squid caches files in disk, thus, fast download and browsing for end clients ! thats the way I see it should be !

    Isn't the other way around should be in the description ? Am being an idiot or what ?

    I believe you understand it wrong… let me use more words to explain the maximum object size example.

    Bigger size objects does not equal to more files in the cache.

    The objects should be read as "file", so caching one big file won't help bandwidth saving as much as more smaller files / objects.
    So if the object you want to cache is larger than the chosen maximum object size it won't be stored and served from the cache.

    But if your object cache size is large, you can run into memory problems quickly.
    The same is also true with a very small object size (and storing serving many objects) it will cause the index, to serve all the small objects, to become large and you will also have memory / performance issues.

    You need to find the "best" maximum file size for your use case. And find the size you can live with, middle ground between speed and bandwidth saving.

    For example my average mean file (object) size is ~170kilobytes, my max size is 8192kilobytes, but i'm storing and serving over 500,000 files/objects from the cache.
    Websites (scripts, pictures) load snappy and it won't have to cache and serve larger files (zip files, downloads etc.)



  • Ok I got you !

    I have a server with 3 HDDs configured as RAID 0, I've set up my server to 40 MBytes for the Maximum Object Size to cache all files under 40 MBytes, and it didn't show any sign of slowness nor a sign of saturated Disk … so I guess that's an almost optimal configuration for my server :)