Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Is cache really improve the connection speed?

    Scheduled Pinned Locked Moved pfSense Packages
    41 Posts 8 Posters 18.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      josey
      last edited by

      @jigpe:

      thanks for the quick reply**.i set 980970.**

      thanks,
      jigp
      Davao City

      you set 980970kb ? for object size ?

      1 Reply Last reply Reply Quote 0
      • J
        jigpe
        last edited by

        Yup for object size.

        jigp
        Davao City

        1 Reply Last reply Reply Quote 0
        • I
          iamthed
          last edited by

          i'm confuse about cache..
          cmiiw cache in this pfsense is it the same cache as the browser cache? e.g opera,mozzila or chrome?

          so tell me what is the best setting for minimum object size and maximum?
          my hdd only 20gb do u think it will last long ??
          what happen if my cache is overload?

          i'm dumb.. but i have a desire to learn

          1 Reply Last reply Reply Quote 0
          • M
            mhab12
            last edited by

            The cache is similar to a browser cache, except that it is stored on the server and not on the individual workstation - this way everyone benefits from data that has already been stored.  If you set the maximum object size to something like 256MB and min to zero, you will catch nearly all web traffic and most windows updates, application downloads, etc.  Just set your max cache size to 10 GB (you mentioned you have a 20GB HD) and it will never 'overload' or fill up completely.

            1 Reply Last reply Reply Quote 0
            • I
              iamthed
              last edited by

              @mhab12:

              The cache is similar to a browser cache, except that it is stored on the server and not on the individual workstation - this way everyone benefits from data that has already been stored.  If you set the maximum object size to something like 256MB and min to zero, you will catch nearly all web traffic and most windows updates, application downloads, etc.  Just set your max cache size to 10 GB (you mentioned you have a 20GB HD) and it will never 'overload' or fill up completely.

              thx for quick replay then if i'm using max cache size 10gb so the cache will stop working after 10gb right?
              and should i delete cache?
              or leave it behind?

              and one dumb question
              if i'm not enable the transparent proxy or proxy is the cache working?

              i'm dumb.. but i have a desire to learn

              1 Reply Last reply Reply Quote 0
              • J
                josey
                last edited by

                i finally get this….
                explanation in pfs is wrong then
                "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."

                ok i have 2gb ram, 120gb hdd, and i was playing this morning with cache,

                setup
                HDD cache size 1000MB
                Memory cache size 512MB
                Minimum object size 100kb
                Maximum object size 50 000kb

                and after test download, file od 40mb downloaded in 1 sec :)

                but, how to clean cache?
                is it automatic? oldest object deleted for new objects? or how ?

                thanks

                1 Reply Last reply Reply Quote 0
                • jahonixJ
                  jahonix
                  last edited by

                  @josey:

                  Minimum object size 100kb

                  Why don't you cache smaller objects as well?
                  The background image of this forum is: 1.14 KB (1169 Bytes) and isn't cached with your settings.

                  @josey:

                  but, how to clean cache?
                  is it automatic? oldest object deleted for new objects? or how ?

                  Yes. Just leave it alone and let it do it's magic.

                  1 Reply Last reply Reply Quote 0
                  • M
                    mhab12
                    last edited by

                    @josey:

                    oldest object deleted for new objects? or how ?

                    Go to the 'cache management tab' and read about Cache replacement policy and Memory replacement policy - it's more than you ever wanted to know.

                    1 Reply Last reply Reply Quote 0
                    • J
                      josey
                      last edited by

                      thnx guys i figure it up yesterday :)

                      set up
                      hard disck cache size 100GB
                      hard disk cache system UFS
                      memory cache size 1GB
                      minimum object size 0
                      maximum object size 1GB
                      memory replacement policy Heap LFUDA

                      now internet is "fast" like i have 100mbps instead 6mbps :D
                      it works just great

                      great product guys, keep up with good work

                      1 Reply Last reply Reply Quote 0
                      • J
                        jigpe
                        last edited by

                        Ok thanks. Is it okay to set 100000? 160GB HD

                        jigp
                        Davao City

                        1 Reply Last reply Reply Quote 0
                        • J
                          josey
                          last edited by

                          well, yes, you can put even 140gb,

                          pfs uses less than 1gb, and + swap is 1gb

                          1 Reply Last reply Reply Quote 0
                          • I
                            iamthed
                            last edited by

                            @josey:

                            i finally get this….
                            explanation in pfs is wrong then
                            "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."

                            ok i have 2gb ram, 120gb hdd, and i was playing this morning with cache,

                            setup
                            HDD cache size 1000MB
                            Memory cache size 512MB
                            Minimum object size 100kb
                            Maximum object size 50 000kb

                            and after test download, file od 40mb downloaded in 1 sec :)

                            why you set minimum object size to 100 kb
                            and max object size 50000 kb?

                            i think it's mean max object size per packet..
                            40mb file that u download it's consist of thousand packet i think

                            but, how to clean cache?
                            is it automatic? oldest object deleted for new objects? or how ?

                            thanks

                            i'm dumb.. but i have a desire to learn

                            1 Reply Last reply Reply Quote 0
                            • C
                              chudy
                              last edited by

                              First of all Squid is the most powerful and high performance cache.

                              The question is how you setup your squid…
                              If you only setup squid as default configuration then forget about squid. stick to your browsers cache.

                              When using squid:
                              1. you have to set your refresh pattern to override's servers content expiry(this way that content stays longer to your cache drive), reload-into-ims(check if modified)
                              2. Increase cache_dir(hdd is the limit), minimm object size to zero, maximum object size to 200MB(some porn has greater than 200MB;D)
                              This would only give you max saving around 25% you can see if you have mrtg to monitor your squid.

                              When using full potential it would give you max up to 100% or average of 60% (this includes contents html, php or alike which marked not to cache)
                              1. use StoreUrlRewrite feature (which you can cache youtube and any CDN servers)

                              1 Reply Last reply Reply Quote 0
                              • T
                                Tikimotel
                                last edited by

                                @josey:

                                thnx guys i figure it up yesterday :)

                                set up
                                hard disck cache size 100GB
                                hard disk cache system UFS
                                memory cache size 1GB
                                minimum object size 0
                                maximum object size 1GB
                                memory replacement policy Heap LFUDA

                                now internet is "fast" like i have 100mbps instead 6mbps :D
                                it works just great

                                great product guys, keep up with good work

                                I'm afraid your experience will degrade over time…
                                For every GB of HDD cache Squid will allocate approx. an extra 10MB of RAM. (like an index)

                                (my rig has 1GB ram minus some shared video ram)
                                Here is my cache setup:

                                Cache management page :
                                Hard disk cache size = 2000 MB (more HDD space uses more RAM becarefull not set it too big)
                                Memory cache size = 128 MB
                                Minimum object size = 0 KB

                                Maximum object size = 8192 KB (Squid default is 4096 KB)
                                set this larger if you want too (32MB maybe) it depends on how much files are how large and how often you download these types of files.
                                Read the squid visolve manual on caching policy (heap LFUDA). This not always stored in memory, it is the "cache" value!!! It can either be RAM or HDD.

                                Memory replacement policy = heap LFUDA (RAM cache object handling)
                                Cache replacement policy = heap LFUDA (HDD cache object handling)

                                General settings page:
                                Custom Options =
                                redirect_program /usr/local/libexec/adzap;redirect_children 10;maximum_object_size_in_memory 128 KB;

                                maximum_object_size_in_memory; I bumped that value up from the default 64KB because some sites (I visit often) use larger object than 64KB and so this raises the chance of objects being cached from RAM in stead of HDD cache. Play with this value a little in combination with the "Memory cache size" value, remember mine is set to 128MB ram being used. (128MB / 128KB = max. number of "large" objects cached directly from squid RAM. RAM is faster than HDD.) Don't over do these options it will do more harm than good over time…performance will suffer.

                                I also have "Snort package" running and these options balance my memory consumption nicely. (60 -70 percent average)

                                1 Reply Last reply Reply Quote 0
                                • T
                                  Tikimotel
                                  last edited by

                                  @josey:

                                  i finally get this….
                                  explanation in pfs is wrong then
                                  "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."

                                  ok i have 2gb ram, 120gb hdd, and i was playing this morning with cache,

                                  setup
                                  HDD cache size 1000MB
                                  Memory cache size 512MB
                                  Minimum object size 100kb
                                  Maximum object size 50 000kb

                                  and after test download, file od 40mb downloaded in 1 sec :)

                                  but, how to clean cache?
                                  is it automatic? oldest object deleted for new objects? or how ?

                                  thanks

                                  Cache is cleaned automatically.
                                  How depends on the caching policy that is chosen. (LRU, Heap GDSF, Heap LFUDA, Heap LRU)
                                  When is controlled by the high and low water mark options in the "Cache management" page.
                                  Low-water-mark in % = 90
                                  High-water-mark in % = 95
                                  If the total cache is BIG the 5 % difference between the low- and high-water-mark can be many MBs or GBs of cache (real data).
                                  (Worst case) Your system could be constantly cleaning older objects from cache at 100% HDD speed if the low-water-mark was reached. And caching speed would suffer greatly.

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    Tikimotel
                                    last edited by

                                    I forgot to mention, my browsers use very little local cache (temporary internet files).
                                    I set it around 32MB, the rest is cached by pfSense (squid) anyway.

                                    I remember IE used a setting of 10% of local HDD in the older versions, before HDD's were hundreds of GBs large.
                                    I believe the newer versions have setup a more sensible limit.

                                    1 Reply Last reply Reply Quote 0
                                    • I
                                      iamthed
                                      last edited by

                                      i don't understand why you ppl put a maximum object size very high..
                                      i think the definition maximum object is for the packet.. not for the overall file..
                                      one file that u download 1mb it maybe consist of hundred package..
                                      so why you setting to high??
                                      i think 1024 for maximum object is enough..

                                      and what is Low-water-mark and High-water-mark in % ?

                                      guys are you using bridge mode for transparent proxy? because i can filter anything in bridge mode using transparent proxy..  ???

                                      i'm dumb.. but i have a desire to learn

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        mhab12
                                        last edited by

                                        I set the max object size very high to cache windows updates.  There is nothing worse than watching people sit at their desk while a 150mb .NET service pack downloads at 300K.

                                        1 Reply Last reply Reply Quote 0
                                        • I
                                          iamthed
                                          last edited by

                                          @mhab12:

                                          I set the max object size very high to cache windows updates.  There is nothing worse than watching people sit at their desk while a 150mb .NET service pack downloads at 300K.

                                          u don't get it what i mean..
                                          cmiiw the file that u download 150mb.. it consist of a thousand packet..
                                          one packet maybe contain arround 256 kb

                                          what i mean is max object size is per packet.. not a whole file..

                                          i'm dumb.. but i have a desire to learn

                                          1 Reply Last reply Reply Quote 0
                                          • jahonixJ
                                            jahonix
                                            last edited by

                                            Hay, d-ifyouare, who told you squid would cache IP packets only? It is caching an entire object (aka file) from the likes of .html or .jpg or .png or.xml or …
                                            Looking at your squid cache folders you'll find objects of highly varying sizes. That's the size of the cached file. It wouldn't differ if its only packets.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.