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

    CoDel - How to use

    Scheduled Pinned Locked Moved Traffic Shaping
    206 Posts 30 Posters 112.7k 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.
    • N
      Nullity
      last edited by

      @Harvy66:

      I'm not sure the best way to measure the affects of CoDel as a simple test. You'd probably need to use something to load a rate limited connection(not line rate), like iperf, then doing pings. My expectation is there should be a measurable difference between avg ping, and std-dev of ping.

      You may need to be careful doing this test on a LAN where the latency can be measured in microseconds. All TCP implementations have a minimum 2 segments sent when streaming data. 0.1ms ping at 1500byte segments sizes puts a lower limit of 120Mb/s. All known TCP congestion algorithms will not backoff below this speed for that latency. That's per stream. If you have 8 streams, that's 960Mb/s.

      0.1ms is actually a high latency for a LAN. I measure as low as 0.014ms using a high resolution ping program, but my switch is rated for 2.3 microseconds. It really depends on how often the kernel scheduling.

      Network measurements are not what we want. We only care about the time before packets are on the wire. All CoDel controls is the scheduling of the local buffers, so that is what we would want to measure, right?

      CoDel has relatively zero influence over a packet's latency once the packet hits the wire.

      Please correct any obvious misinformation in my posts.
      -Not a professional; an arrogant ignoramous.

      1 Reply Last reply Reply Quote 0
      • H
        Harvy66
        last edited by

        I was thinking of a simple test that indirectly measures CoDel by the characteristics of the network. If you want a more direct measurement, one would need to implement some wrapper code that acts like the network stack and OS and simulates the network pushing packets through. More direct, much more work.

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

          I just got fiber to my home (pfSense WAN plugged into an optical network terminal/modem) with symmetrical gigabit service.

          With the default pfSense install where there was no traffic shaping, I was receiving an F for BufferBloat and my speeds were only in the 600's Mbps on the DSLReports speed tests.  I found this thread and started to play with the codelq.

          So far, I have found that just enabling codelq without specifying any other values works great.  It got me from an F rating to A for BufferBloat.  I also played with the Queue Limit (target) by specifying 5 (pfSense defaults to 50).  The value of 5 resulted in more packet drops but no performance gain.  I also noticed that I get more BufferBloat on my downloads so I specified a bandwidth of 980Mbps on my LAN interface.  This seems to give me the best results.  In my speed tests, I see spikes above 1000Mbps and so I think my ISP fiber connection is faster than my gigabit LAN and that is why I needed to limit my LAN bandwidth to 980Mbps to get better overall performance.

          I am just running codelq on the WAN and LAN with no sub-queues.

          | | |

          SuperMicro Atom C2758 A1SRI-2758F 16GB
          2.7.2 (amd64)

          1 Reply Last reply Reply Quote 0
          • H
            Harvy66
            last edited by

            @mifronte:

            I see spikes above 1000Mbps and so I think my ISP fiber connection is faster than my gigabit LAN

            You shouldn't be able to see bursts above your LAN speed because that would require transferring data faster than your LAN. There are ways things may seem to burst, but it's probably just timing issues. The overall average should be fairly accurate.

            Cake will be awesome ones it comes out. I plan on dropping HFSC+codel and just using Cake.

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

              @mifronte:

              I just got fiber to my home (pfSense WAN plugged into an optical network terminal/modem) with symmetrical gigabit service.

              With the default pfSense install where there was no traffic shaping, I was receiving an F for BufferBloat and my speeds were only in the 600's Mbps on the DSLReports speed tests.  I found this thread and started to play with the codelq.

              So far, I have found that just enabling codelq without specifying any other values works great.  It got me from an F rating to A for BufferBloat.  I also played with the Queue Limit (target) by specifying 5 (pfSense defaults to 50).  The value of 5 resulted in more packet drops but no performance gain.  I also noticed that I get more BufferBloat on my downloads so I specified a bandwidth of 980Mbps on my LAN interface.  This seems to give me the best results.  In my speed tests, I see spikes above 1000Mbps and so I think my ISP fiber connection is faster than my gigabit LAN and that is why I needed to limit my LAN bandwidth to 980Mbps to get better overall performance.

              I am just running codelq on the WAN and LAN with no sub-queues.

              | | |

              Based on my (many) tests - I think this is working properly for you because your ports are physically limited to 1Gbps.  If your internet upload speed is lower than your port speed, you need (in my experience) to limit your bandwidth speed in the traffic shaper to 95% of your upload speed for codel to properly work.

              Thanks for posting this!

              1 Reply Last reply Reply Quote 0
              • N
                Nullity
                last edited by

                So, 2.3's CODELQ (and assumedly the sub-discipline "CoDel Active queue" check-box version) have a CoDel with proper "interval" & "target" values (rather than reversed and/or wrong);```
                [2.3-RELEASE][admin@pfsense.wlan]/root: pfctl -vsq | grep codel
                altq on pppoe1 codel( target 5 interval 100 ) bandwidth 640Kb tbrsize 1492

                
                Hmm… anyone got some stats to share?

                Please correct any obvious misinformation in my posts.
                -Not a professional; an arrogant ignoramous.

                1 Reply Last reply Reply Quote 0
                • H
                  Harvy66
                  last edited by

                  What kind of stats? I did a DSLReport speedtest after 2.3 and the bufferbloat part looks the same. Still A+.

                  1 Reply Last reply Reply Quote 0
                  • K
                    kpa
                    last edited by

                    In 2.3 it seems you have to enter a bandwidth value to enable CODELQ. Just to verify that I've understood correctly the information, I have a DSL connection with theoretical maximum of 24Mbs/2Mbs down/up and that is in actuality something like 20Mbs/1.4Mbs down/up. Based on what I read here I should set the WAN bandwidth to about 95% of that 1.4Mbs, is that right?

                    1 Reply Last reply Reply Quote 0
                    • H
                      Harvy66
                      last edited by

                      Correct. Good that it forces you to fill out your bandwidth, because it's useless if you just forward the packets at max rate.

                      1 Reply Last reply Reply Quote 0
                      • V
                        vesikk
                        last edited by

                        I'm trying to enter 5.3 Mbps as the bandwidth value but I get a popup box saying "please enter a valid value. the two nearest values are 5 and 6" please help.

                        1 Reply Last reply Reply Quote 0
                        • B
                          bodosom
                          last edited by

                          @vesikk:

                          I'm trying to enter 5.3 Mbps …

                          Change the multiplier from Mbit/s to Kbit/s.

                          1 Reply Last reply Reply Quote 0
                          • B
                            bodosom
                            last edited by

                            I have a nominal 30/5 link that runs at ~ 40/6.
                            I've tried a variety of bandwidth settings on the WAN link and I still get a C-D grades on the DSLreports "bufferbloat" grade and see high echo RTT when the link is loaded.

                            What settings result in a DSLreports A grade?

                            My previous experience was with Linux and fq_codel which worked perfectly.

                            1 Reply Last reply Reply Quote 0
                            • K
                              kpa
                              last edited by

                              Test your upstream speed a few times without any shaping and set the upstream bandwidth in the CODELQ settings to about 90-95% of the average value you got from the tests.

                              1 Reply Last reply Reply Quote 0
                              • N
                                Nullity
                                last edited by

                                @bodosom:

                                I have a nominal 30/5 link that runs at ~ 40/6.
                                I've tried a variety of bandwidth settings on the WAN link and I still get a C-D grades on the DSLreports "bufferbloat" grade and see high echo RTT when the link is loaded.

                                What settings result in a DSLreports A grade?

                                My previous experience was with Linux and fq_codel which worked perfectly.

                                As the other poster said, 90-95% is a safe choice. You can go even higher if your connection is stable.
                                You might try doing your own tests, since they will likely be more accurate. Simply upload a file to an ftp (or any other service) and check the Quality graph in the Monitoring section of the pfSense GUI to see what your latency was during upload saturation.

                                (FYI, fq_codel/codel only helps upload.)

                                Please correct any obvious misinformation in my posts.
                                -Not a professional; an arrogant ignoramous.

                                1 Reply Last reply Reply Quote 0
                                • H
                                  Harvy66
                                  last edited by

                                  @bodosom:

                                  I have a nominal 30/5 link that runs at ~ 40/6.
                                  I've tried a variety of bandwidth settings on the WAN link and I still get a C-D grades on the DSLreports "bufferbloat" grade and see high echo RTT when the link is loaded.

                                  What settings result in a DSLreports A grade?

                                  My previous experience was with Linux and fq_codel which worked perfectly.

                                  Settings on the WAN link only affect upload, not download. If your download is causing bloat, then you will need to also shape your LAN interface. DSLReports does give separate graphs for up and down, but a single grade that represents both.

                                  1 Reply Last reply Reply Quote 0
                                  • V
                                    vesikk
                                    last edited by

                                    I have tried using codelq and it works but as soon as I start an upload to google drive I get about 50% packetloss and then the gateways appear offline according to pfsense but ping stays low.

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      Harvy66
                                      last edited by

                                      CoDel does not work well below 1Mb/s. If you have less than this, you may be better off trying FairQ. The problem is the 1500mtu is too large for such a slow link.  At 1Mb/s, a single 1500 byte packet will take about 12ms, which quickly triggers codel's drop mode.

                                      1 Reply Last reply Reply Quote 0
                                      • B
                                        bodosom
                                        last edited by

                                        @bodosom:

                                        I've tried a variety of bandwidth settings on the WAN link and I still get a C-D grades on the DSLreports "bufferbloat" grade and see high echo RTT when the link is loaded.

                                        What settings result in a DSLreports A grade?

                                        It seems I was unclear.  Ideally I'd like to get back to getting an A or B on the DSLR test which I suspect means having an average latency of 100-200 ms. in both directions.  I can get a B by carefully tweaking the test parameters after setting the WAN speed to ~90% of my uplink speed.  I guess I was hoping for something both simpler and better.

                                        1 Reply Last reply Reply Quote 0
                                        • DerelictD
                                          Derelict LAYER 8 Netgate
                                          last edited by

                                          OK, look.

                                          pfSense does not have a problem with buffer bloat.

                                          CoDel locally does practically nothing.

                                          People are likely seeing buffer bloat improvement by simply setting the bandwidth lower than their expected upload so buffer bloat does not occur in the ISP gear.

                                          CoDel is for transit, not for the edge.

                                          If you were to start increasing queue length in local shapers AND enabling CoDel you might derive some benefit. But the only reason you would derive benefit from CoDel is because you increased the queue length so just don't.

                                          Chattanooga, Tennessee, USA
                                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                          1 Reply Last reply Reply Quote 0
                                          • N
                                            Nullity
                                            last edited by

                                            @bodosom:

                                            @bodosom:

                                            I've tried a variety of bandwidth settings on the WAN link and I still get a C-D grades on the DSLreports "bufferbloat" grade and see high echo RTT when the link is loaded.

                                            What settings result in a DSLreports A grade?

                                            It seems I was unclear.  Ideally I'd like to get back to getting an A or B on the DSLR test which I suspect means having an average latency of 100-200 ms. in both directions.  I can get a B by carefully tweaking the test parameters after setting the WAN speed to ~90% of my uplink speed.  I guess I was hoping for something both simpler and better.

                                            Like Harvy66 said, the grading score is a combination of your upload and download bufferbloat. You have not yet told us whether the majority of your bufferbloat is occurring during upload or download saturation. The test should show you specifically what your upload and download bufferbloat is in millisecond measurements.

                                            Also, like I already mentioned, you will get a more accurate measurement if you look at the pfSense Quality graphs (or you could simply run a ping test yourself…). The dslreports test is a program within a browser, so it is not always accurate. dslreports says my latency is ~5x worse than it actually is...

                                            We need more info from you. For example, what is your latency is (in milliseconds) during idle, upload saturation, and download saturation, with codel & without?

                                            @vesikk:

                                            I have tried using codelq and it works but as soon as I start an upload to google drive I get about 50% packetloss and then the gateways appear offline according to pfsense but ping stays low.

                                            Where are you recording 50% packet loss? tcpdump? Queue Drops? ?

                                            Please correct any obvious misinformation in my posts.
                                            -Not a professional; an arrogant ignoramous.

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