Temporary Major Lag While Gaming



  • i've been using pfsense now for around 3 months. And ever since I've converted from a standard consumer router I've noticed that while gaming.

    Specifically playing games like rocket league or Counter-Strike GO using Steam.

    That I get major lag spikes from time to time. It's completely random. My ping will jump to around 400 to 600. It lasts around 5-8 seconds. And then it will go back to normal. I'm hardwired.

    The pfsense router CPU usage is always around 3-4%
    Ram is around 20%.

    Packages installed:
    RRD Summary
    squid3

    What can i do to pin point what exactly is going on here.



  • Every hop between you and your game server can be a potential bottleneck. Get the MTR package for PFSense and have it run something like 3600 samples against your desired game server. It will take an hour because of one sample per second, but it will return you loss and jitter for every hop, assuming they respond to probes.

    Otherwise you question reads like "Sometimes when driving from New York to LA, it takes longer. Where's the problem?"



  • Bufferbloat maybe? Quick, momentary, spikes of lag while sending large amounts of data over your internet connection.

    What kind of ISP do you have?



  • @Harvy66:

    Every hop between you and your game server can be a potential bottleneck. Get the MTR package for PFSense and have it run something like 3600 samples against your desired game server. It will take an hour because of one sample per second, but it will return you loss and jitter for every hop, assuming they respond to probes.

    Otherwise you question reads like "Sometimes when driving from New York to LA, it takes longer. Where's the problem?"

    I did a test of 1800. I'm running another test as we speak to a chicago server for 3600.

    @virgiliomi:

    Bufferbloat maybe? Quick, momentary, spikes of lag while sending large amounts of data over your internet connection.

    What kind of ISP do you have?

    Charter Communications. I consider them top notch in my area. This problem only started after I started using Pfsense.

    Not sure if it's related to Pfsense or not, but the coincidence is def something to consider.



  • 3600 seconds to a Chicago server



  • @SickestGuy:

    3600 seconds to a Chicago server

    Prepare to be incorrect. (Whitch is more than human.)

    "Snt" is the number of packets sent, not the RTT or percent of returned packets.



  • Is it possible you proxy is the chock point since it is trying ram all traffic through a single port for inspection. May not seem restrictive for normal web use but when trying push an online multiplayer game through it, than you may be pushing the bandwidth limit or memory set by your proxy configuration.



  • The "worst" values seem to be relative to your first hop. You have a base 17ms avg with a 128ms worst, and your last hop has a 99ms avg with a 209ms worst.

    128 - 17 = 111ms ping spike
    209 - 99 = 110ms ping spike

    It seems to me that whatever reason your spike is, it's probably caused by your first hop or by PFSense. Probably first hop. virgiliomi mentioned bufferbloat, which sounds plausible because the issue starts very early, and I don't see any packet loss, only ping spikes, and even extremely fleeting at that.

    You could try doing some simple traffic shaping if you don't already. Assuming you don't, setup CoDel as your shaper, and set it to 80% of your effective bandwidth for both upload and download. WAN is your upload and LAN is your download.



  • Run a speed test at www.dslreports.com/speedtest. It's a non-Flash based speed test that also tests for bufferbloat. Watch the bufferbloat meter throughout the test, and you'll likely see the exact issue you're describing - momentary latency while your connection is under full load. If you do see bufferbloat spikes during the test, follow Harvy66's steps to enable traffic shaping with CODEL. That will really help smooth things out. Your speed might be slightly lower than your ISP can provide, but any latency spikes will be due to internet issues, not your internet connection.



  • @Nullity:

    Prepare to be incorrect. (Whitch is more than human.)

    "Snt" is the number of packets sent, not the RTT or percent of returned packets.

    I'm confused? Are you saying I ran the tests incorrectly?
    I entered the IP, and put 1800 and 3600 in the count section and pressed Run mtr and those were the results I got.

    @virgiliomi:

    Run a speed test at www.dslreports.com/speedtest. It's a non-Flash based speed test that also tests for bufferbloat. Watch the bufferbloat meter throughout the test, and you'll likely see the exact issue you're describing - momentary latency while your connection is under full load. If you do see bufferbloat spikes during the test, follow Harvy66's steps to enable traffic shaping with CODEL. That will really help smooth things out. Your speed might be slightly lower than your ISP can provide, but any latency spikes will be due to internet issues, not your internet connection.

    I ran 2 tests. With and without squid.

    Without (No proxy warning (1.1 localhost (squid/3.4.10))

    With (Proxy Warning)



  • DSLReports bufferbloat grading scale

    Less than 5ms (average of down bloat and up bloat) - A+
    Less than 30ms - A
    Less than 60ms - B
    Less than 200ms - C
    Less than 400ms - D
    400ms+ - F

    You seem to be between 70ms-400ms. Probably closer to 400ms. You need to use CoDel or a mixture of traffic shaping to fix this. Another issue is if you're using SQUID. You can only shape traffic leaving an interface, and SQUID downloads do not leave any interfaces because SQUID runs directly on the box.



  • @Harvy66:

    DSLReports bufferbloat grading scale

    Less than 5ms (average of down bloat and up bloat) - A+
    Less than 30ms - A
    Less than 60ms - B
    Less than 200ms - C
    Less than 400ms - D
    400ms+ - F

    You seem to be between 70ms-400ms. Probably closer to 400ms. You need to use CoDel or a mixture of traffic shaping to fix this. Another issue is if you're using SQUID. You can only shape traffic leaving an interface, and SQUID downloads do not leave any interfaces because SQUID runs directly on the box.

    SQUID, Ive recently uninstalled it.

    Codel? What is Codel? I don't see that in the list of packages? Is that the name of the pre-installed traffic shaper that is already in pfesense under firewall? If so, do you have any suggestions on what kind of settings I should be using to set this address this issue?

    I'm sorry to sound like a complete noob here. But I am when it comes to pfsense or advanced networking. I have a general knowledge of it. But this entire conversation, thus far, has been totally over my head.

    I've read up on what bufferbloat is but i'm really not grasping why this is happening. Is there something wrong with my hardware? Do people with out any packages also experience this? Or does pfsense just needs to be tweaked hence the suggestion to run a traffic shaper. I had this impression that by using pfsense over consumer routers, I would never run into any bandwidth or latency issues, and I haven't changed any of the networking habits before or after using pfsense.

    Can someone explain more thoroughly what exactly you guys think is happening here?

    Edit: I've spoken to another person that shares the same local ISP as me, that gets a bufferbloat rating of F, yet experiences no lag spikes while gaming.



  • You probably have network traffic that is happening on the side. Most people have more than one device in their network. You probably have a device that is periodically bursting down a bunch of data.

    Buffer bloat is caused by dumb network buffers in your ISP and even PFSense. The default buffers current and have worked like this since the beginning of time for networking. First in first out.

    Packet 1 enters the buffer
    Packet 2 enters the buffer
    Packet 1 leaves the buffer
    Packet 2 leaves the buffer

    If data comes in too fast, the buffer fills up. If the buffer is too large, you get buffer bloat because you may have 400ms of packets buffered. If your buffer is too small, your bandwidth goes to crap. This is an age old problem. Networks naturally are bursty, but a network that plays well with burst traffic does not like sustained non-burst traffic.

    CoDel is part of the first generation of Active Buffer Managers(AQMs) that attempt to solve this issue. Simply put, instead of a hard cut off of "I'm full", the buffer instead has a target backlog of data. If that threshold is met, the buffer will start dropping packets at an increasing rate. Packet drops signal TCP to back-off. In practice, a greedy TCP flow is much more likely to get its packets dropped.

    In practice, this typically means that even if your connection is fully saturated, you will still keep a low ping. The problem is if you're not traffic shaping, your router is not the bottleneck, it's your ISP. Bufferbloat is a side effect of congestion. You don't want congestion to occur in your ISP, you want it to occur in your router where you can control it.



  • Ok that makes sense.

    I've gone ahead and watched a few traffic shaping tutorials and finally set it up. And ran a few test.

    Results:

    I haven't tested it thoroughly enough yet, but I've yet to see any gaming lag or ping spikes either.

    So it looks like the issue is solved for now.



  • Nice change. Looks like you lost a little bit of upload bandwidth, but your bloat is much less. You can play around with setting your bandwidth higher, but it will make it less effective if your ISP's effective bandwidth ever dips. But a good start.



  • Harvey-

    Do you have a link to your codel guide? I would like to look at implementing some traffic shaping in my network.



  • Nothing to it. Just set the "Scheduler Type" to CoDel and set your bandwidth.



  • I am doing P2P and the wife is watching Netflix while this is all going on. The bufferbloat test uses websockets for the pings. Because I use HFSC, my web traffic is isolated from my other traffic. My Quality Graph shows a perfectly unaffected link. CoDel will get you most of that with out all of the work.








  • have you checked the wan drivers ? Idk, I have never experienced anything like that. I am playing a lot of CS GO and everything is fine. I am sure that there is a software problem, maybe you should reinstall the drivers. By the way, when you will solve that problem, we could play together a couple of games. If you have a very low rank it's not a problem, you can always use a rank boosting service like eloboss.net. If you are interested, leave me a message! It's going to be really cool! I am waiting for your message, dude!


Log in to reply