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

    Playing with fq_codel in 2.4

    Scheduled Pinned Locked Moved Traffic Shaping
    1.1k Posts 123 Posters 1.5m 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.
    • C
      csutcliff @uptownVagrant
      last edited by csutcliff

      @uptownvagrant

      Thanks for the reply, here is my limiter info. The 382.375/20.910 Mbit/s ones are my cable WAN, the 62.000/17.500Mbit/s is for my VDSL. First two queues are cable, last two are VDSL.

      Limiters:
      00001: 382.375 Mbit/s    0 ms burst 0 
      q131073  50 sl. 0 flows (1 buckets) sched 65537 weight 0 lmax 0 pri 0 droptail
       sched 65537 type FIFO flags 0x0 0 buckets 0 active
      00002:  20.910 Mbit/s    0 ms burst 0 
      q131074  50 sl. 0 flows (1 buckets) sched 65538 weight 0 lmax 0 pri 0 droptail
       sched 65538 type FIFO flags 0x0 0 buckets 0 active
      00003:  62.000 Mbit/s    0 ms burst 0 
      q131075  50 sl. 0 flows (1 buckets) sched 65539 weight 0 lmax 0 pri 0 droptail
       sched 65539 type FIFO flags 0x0 0 buckets 0 active
      00004:  17.500 Mbit/s    0 ms burst 0 
      q131076  50 sl. 0 flows (1 buckets) sched 65540 weight 0 lmax 0 pri 0 droptail
       sched 65540 type FIFO flags 0x0 0 buckets 0 active
      
      
      Schedulers:
      00001: 382.375 Mbit/s    0 ms burst 0 
      q65537  50 sl. 0 flows (1 buckets) sched 1 weight 0 lmax 0 pri 0 droptail
       sched 1 type FQ_CODEL flags 0x0 0 buckets 1 active
       FQ_CODEL target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ECN
         Children flowsets: 1 
      BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
        0 ip           0.0.0.0/0             0.0.0.0/0        7      470  0    0   0
      00002:  20.910 Mbit/s    0 ms burst 0 
      q65538  50 sl. 0 flows (1 buckets) sched 2 weight 0 lmax 0 pri 0 droptail
       sched 2 type FQ_CODEL flags 0x0 0 buckets 1 active
       FQ_CODEL target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ECN
         Children flowsets: 2 
        0 ip           0.0.0.0/0             0.0.0.0/0        4      218  0    0   0
      00003:  62.000 Mbit/s    0 ms burst 0 
      q65539  50 sl. 0 flows (1 buckets) sched 3 weight 0 lmax 0 pri 0 droptail
       sched 3 type FQ_CODEL flags 0x0 0 buckets 0 active
       FQ_CODEL target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ECN
         Children flowsets: 3 
      00004:  17.500 Mbit/s    0 ms burst 0 
      q00004  50 sl. 0 flows (1 buckets) sched 4 weight 1 lmax 0 pri 0 droptail
       sched 4 type FQ_CODEL flags 0x0 0 buckets 0 active
       FQ_CODEL target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ECN
         Children flowsets: 4 
      
      
      Queues:
      q00001  50 sl. 0 flows (1 buckets) sched 1 weight 0 lmax 0 pri 0 droptail
      q00002  50 sl. 0 flows (1 buckets) sched 2 weight 0 lmax 0 pri 0 droptail
      q00003  50 sl. 0 flows (1 buckets) sched 3 weight 0 lmax 0 pri 0 droptail
      q00004  50 sl. 0 flows (1 buckets) sched 4 weight 1 lmax 0 pri 0 droptail
      

      /tmp/rules.limiter

      pipe 1 config  bw 382375000b droptail
      sched 1 config pipe 1 type fq_codel target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ecn
      queue 1 config pipe 1 droptail
       
      
      pipe 2 config  bw 20909500b droptail
      sched 2 config pipe 2 type fq_codel target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ecn
      queue 2 config pipe 2 droptail
       
      
      pipe 3 config  bw 62000Kb droptail
      sched 3 config pipe 3 type fq_codel target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ecn
      queue 3 config pipe 3 droptail
       
      
      pipe 4 config  bw 17500Kb droptail
      sched 4 config pipe 4 type fq_codel target 5ms interval 100ms quantum 300 limit 10240 flows 20480 ecn
      queue 4 config pipe 4 droptail
      

      pfctl -vvsr | grep "FQ-CoDel"

      @66(1548714795) match in on igb0 inet all label "USER_RULE: VIRGIN_WAN_DL FQ-CoDel queue" dnqueue(1, 2)
      @67(1548714885) match out on igb0 inet all label "USER_RULE: VIRGIN_WAN_UL FQ-CoDel queue" dnqueue(2, 1)
      @71(1548715528) match in on pppoe0 inet all label "USER_RULE: AAISP_WAN_DL FQ-CoDel queue" dnqueue(3, 4)
      @72(1548722103) match out on pppoe0 inet all label "USER_RULE: AAISP_WAN_UL FQ-CoDel queue" dnqueue(4, 3)
      
      uptownVagrantU 1 Reply Last reply Reply Quote 0
      • uptownVagrantU
        uptownVagrant @csutcliff
        last edited by uptownVagrant

        @csutcliff Hmm, I don't have a VDSL2 PPPoE connection to test with but I'm wondering if the following thread may point you down the correct path.

        https://lists.freebsd.org/pipermail/freebsd-ipfw/2016-April/006161.html

        Also, why do you have your VDSL limiters set above what you are seeing in the speed test results when you don't have them enabled? Can you try setting both limiters to 80% or 85% of your speed test result and then work up from there - keeping an eye on buffering each subsequent test?

        C 1 Reply Last reply Reply Quote 0
        • uptownVagrantU
          uptownVagrant @chrcoluk
          last edited by

          @chrcoluk just a quick note after some additional testing. I believe I ran into what you were seeing when the number of active states passing through the limiter queues far exceeded the FQ-CoDel flows value and flows were not being separated any longer. Increasing the FQ-CoDel flows value allowed flow separation to be maintained and interactive flow packets were not being sent to sub-queues where non interactive flow packets were also being sent.

          1 Reply Last reply Reply Quote 0
          • C
            csutcliff @uptownVagrant
            last edited by csutcliff

            @uptownvagrant I'll have a read, thanks.

            Regarding the limiters settings, I obviously haven't been able to tune the upstream setting yet (I've got it at just under 95% of the sync speed) but I have tried it set at only 10Mbit/s and it makes no difference.

            For the dowstream, my sync is over 65Mbit/s and I've settled on 62Mbit/s after trial an error to see what value eliminated bufferbloat whilst keeping as much bandwidth available as possible. The reason you don't see 65+ on the speed test without the limiters is because my ISP allows me to set the sending rate on the download which I have set to 95% of sync, this is meant to help with bufferbloat and improve VOIP etc because the link is never 100% pegged and in theory stops the wholesale ISP (their supplier) buffers getting involved.

            Edit: had a read of the thread you linked. I don't think any of that applies here as I'm using plain PPPoE not PPPoA, I have a full 1500 MTU to the internet thanks to baby jumbo frames (1508 to the modem to account for the PPPoE header) and my upload speed is not restrictive like in the example, in fact it's only a couple of Mbit/s shy of the cable connection that works fine.

            uptownVagrantU 1 Reply Last reply Reply Quote 0
            • uptownVagrantU
              uptownVagrant @csutcliff
              last edited by uptownVagrant

              @csutcliff If you set quantum to 1508 and enable the limiter what is the result? Also, does FQ-CoDel perform as expected over the VDSL2 circuit without dual WAN in the mix?

              C 2 Replies Last reply Reply Quote 0
              • C
                csutcliff @uptownVagrant
                last edited by csutcliff

                @uptownvagrant no change in behaviour with 1508 quantum. I'll test just the VDSL limiters enabled later this evening.

                1 Reply Last reply Reply Quote 0
                • R
                  robnitro
                  last edited by robnitro

                  Limit could be lowered to help out:
                  https://www.bufferbloat.net/projects/codel/wiki/Best_practices_for_benchmarking_Codel_and_FQ_Codel/#tuning-fq-codel

                  When running it at 1GigE and lower, today it helps to change a few parameters given limitations in today’s Linux implementation and underlying device drivers.
                  
                  The default packet limit of 10000 packets is crazy in any other scenario. It is sane to reduce this to a 1000, or less, on anything running at gigE or below. The over-large packet limit leads to bad results during slow start on some benchmarks. Note that, unlike txqueuelen, CoDel derived algorithms can and DO take advantage of larger queues, so reducing it to, say, 100, impacts new flow start, and a variety of other things.
                  
                  We tend to use ranges of 800-1200 in our testing, and at 10Mbit, currently 600.
                  
                  C 1 Reply Last reply Reply Quote 0
                  • C
                    csutcliff @uptownVagrant
                    last edited by

                    @uptownvagrant Sorry for the delay, just got a chance to test it without the dual wan. No change in the result.

                    1 Reply Last reply Reply Quote 0
                    • C
                      csutcliff @robnitro
                      last edited by

                      @robnitro Thanks for the suggestion, It has seemingly improved my cable connection responsiveness slightly but doesn't make a difference to the upload problem on vdsl.

                      1 Reply Last reply Reply Quote 0
                      • L
                        lightsy
                        last edited by lightsy

                        I wanted to give a brief update - I actually am here about the issues with traceroutes showing the default destination addresses for every hop, caused by the Floating Firewall rule.

                        I fixed this on my side, initially, by only having the rule shape TCP/UDP - but some other clients do traceroute via UDP so I had this same issue. Instead, there's a firewall option to limit/scope it down to particular TCP flags - you can set the ones you wish, but I ultimately ended up targeting it to "Any" protocol, and "Any flags" - this fixed it for me. :)

                        EDIT: My pfSense randomly crashed... and... it rebooted... and... somehow now it isn't working.
                        Sigh. Guess I'm back to applying this to a non-floating rule. :(

                        1 Reply Last reply Reply Quote 1
                        • R
                          robnitro
                          last edited by

                          Hi, what rule did you use for non floating?
                          When I do tracert from windows, it shows only 2 hops. Router and then the destination.

                          From openwrt dumb access point, all hops show fine like From the router I get all of the hops. Floating rule instant match allow any IPV4 ICMP trace - and another rule icmp any at top of list. So that means it should skip using the codel limiters right? I just dont understand why my desktop client gets bad tracert info?

                          L 1 Reply Last reply Reply Quote 0
                          • L
                            lightsy @robnitro
                            last edited by

                            @robnitro

                            i actually just reverted to using a simple TCP/UDP floating rule, setting up the non-floating was a huge pain (I had it working before) but can't remember how.

                            I'm going to be creating exemptions / rules that exempt specific clients in the future - now that it's working fine (on my primary use case, Windows!)

                            Here is the exact rule I have (that is, somehow, letting pfSense UDP traceroute work - I am tired of messing with it / don't care). Anything that is missing means it's default.

                            Action: Pass
                            Interface: WAN
                            Direction: Out
                            Addr Family: IPv4
                            Protocol: TCP/UDP
                            Gateway: WAN_DHCP (my gateway selected)
                            In/Out Pipe: WANUpQ (my name) & WANDownQ (my name)

                            Here are the rules I have:
                            Firewall Rules > Traffic Shaper > "Limiters"

                            "CODEL_QMDown"
                            Limiter: Enabled
                            Bandwidth: 320 Mbit
                            Queue Management Algorithm: CoDel
                            Scheduler: FQ_CODEL

                            Subqueue, "WANDownQ"
                            Queue algorithm: CoDel

                            "CODEL_QMUp"
                            Limiter: Enabled
                            Bandwidth: 340Mbit (yes, I have higher upload than download)
                            Queue management algorithm: CoDel
                            Scheduler: FQ_CODEL

                            Subqueue, "WANUpQ"
                            Queue algorithm: CoDel


                            I know these are basically defaults - I'm not sure why these work? I simply re-created everything, and now everything works great... it's quite odd. I'm curious if there is an issue with pfSense and having the rules edited, or large changes made to the queues (I hit Save/Apply, particularly, after every single change / creation - no going back and editing for me!)

                            Quite odd. I've used FQ_CoDel in other devices/implementations and have never run into these nuances. It's working great, now, though - but the traceroute/etc was bothering me horribly. With these rules (no floating rule for 'any') it seems to be working great... for... whatever reason. 🦆

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

                              Hi all!
                              Configured limiters and now my traceroute always shows resolved IP address instead of actual hops.
                              I`ve read here this is common but just to be sure, is this supposed to be like this or is it a bug?

                              Thanks!

                              1 Reply Last reply Reply Quote 0
                              • VeldkornetV
                                Veldkornet
                                last edited by

                                Hi guys,

                                I’m also having an issue with my upload speed... So I have a 400Mbit down / 40 Mbit up connection, and I've followed the guide here to enable the limiters, filling in the 400 and 40 as my down and up speeds.

                                However when I do speedtests, while my bufferbloat is now gone... I no can no longer reach my maximum speeds.
                                Down I may get around 360Mbit max which I can live with butup is just pathetic, maybe between 2-8Mbit at most....

                                Is this known? Anything I can do to improve this? I played with the Queue Length value which helped a bit, but in the end didn't really have too much of an impact....

                                Limiters:
                                00001: 400.000 Mbit/s    0 ms burst 0 
                                q131073 10000 sl. 0 flows (1 buckets) sched 65537 weight 0 lmax 0 pri 0  AQM CoDel target 5ms interval 100ms ECN
                                 sched 65537 type FIFO flags 0x0 0 buckets 0 active
                                00002:  40.000 Mbit/s    0 ms burst 0 
                                q131074 1000 sl. 0 flows (1 buckets) sched 65538 weight 0 lmax 0 pri 0  AQM CoDel target 5ms interval 100ms ECN
                                 sched 65538 type FIFO flags 0x0 0 buckets 0 active
                                
                                
                                Schedulers:
                                00001: 400.000 Mbit/s    0 ms burst 0 
                                q65537  50 sl. 0 flows (1 buckets) sched 1 weight 0 lmax 0 pri 0 droptail
                                 sched 1 type FQ_CODEL flags 0x0 0 buckets 0 active
                                 FQ_CODEL target 5ms interval 100ms quantum 1514 limit 10240 flows 1024 ECN
                                   Children flowsets: 1 
                                00002:  40.000 Mbit/s    0 ms burst 0 
                                q65538  50 sl. 0 flows (1 buckets) sched 2 weight 0 lmax 0 pri 0 droptail
                                 sched 2 type FQ_CODEL flags 0x0 0 buckets 0 active
                                 FQ_CODEL target 5ms interval 100ms quantum 1514 limit 10240 flows 1024 ECN
                                   Children flowsets: 2 
                                
                                
                                Queues:
                                q00001  50 sl. 0 flows (1 buckets) sched 1 weight 0 lmax 0 pri 0  AQM CoDel target 5ms interval 100ms ECN
                                q00002  50 sl. 0 flows (1 buckets) sched 2 weight 0 lmax 0 pri 0  AQM CoDel target 5ms interval 100ms ECN
                                

                                Disabled:

                                Enabled:

                                1 Reply Last reply Reply Quote 0
                                • X
                                  xciter327
                                  last edited by xciter327

                                  You are supposed to set the limiters lower than your actual connection speed. I set mine to 95% of tested(not ISP advertised) speed.

                                  Also please use the guide posted a little while earlier. The one from the hangouts session is outdated and does not cover a bug workaround.

                                  https://forum.netgate.com/post/807490

                                  P.S - I am also on Ziggo NL 240/24 connection.

                                  VeldkornetV 1 Reply Last reply Reply Quote 0
                                  • VeldkornetV
                                    Veldkornet @xciter327
                                    last edited by

                                    @xciter327 Even at 95% of 400/40 which is 380/38, the upload speed is nowhere near that. The download at least comes in the vicinity.

                                    C X 2 Replies Last reply Reply Quote 0
                                    • C
                                      csutcliff @Veldkornet
                                      last edited by

                                      @Veldkornet I don't suppose it's a PPPoE connection? I had a similar problem.

                                      VeldkornetV 1 Reply Last reply Reply Quote 0
                                      • M
                                        maverick_slo
                                        last edited by

                                        Hi how did you resolve pppoe problem?
                                        Thanks!

                                        C 1 Reply Last reply Reply Quote 0
                                        • C
                                          csutcliff @maverick_slo
                                          last edited by

                                          @maverick_slo I didn't. I am only able to use the Download shaper for my PPPoE WAN. It works perfectly on my other WAN which is DHCP.

                                          1 Reply Last reply Reply Quote 0
                                          • VeldkornetV
                                            Veldkornet @csutcliff
                                            last edited by

                                            @csutcliff Nope, mine is just a DHCPv4 connection

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