Samsung SSD causes wifi speed crash weirdness

Soldato
Joined
18 Aug 2007
Posts
9,689
Location
Liverpool
No, really. This has been killing me for days, and I honestly can't believe the 'solution'. I'm only really posting this in case it ever randomly helps someone else in the future, probably finding this by searching/Google, as the problem and solution are so damn weird.

I have a MacBook Pro mid-2012, i5 2.5GHz, upgraded to 16GB RAM and a Samsung Evo 850 SSD. Apart from annoyingly old wifi (2x2 wireless N) it works perfectly and is still very snappy indeed.

It's connecting to a Ubiquiti Unifi UAP AC PRO using the Airport card. I get a link rate of 450Mbps (the card's max), and throughput over around 30MB/sec. Great. It's been working flawlessly like this for as long as I can remember; at least a year, since I upgraded my local network equipment (APU2C4 running pfSense, the Unifi AC PRO, PoE switches, etc).

I do remember back when we moved into this house and I upgraded the MBP, I had awful strange connection issues on the wifi. I'd be getting full wifi speed rock solid, then after a random period of time it'd crash to almost 0MB/sec and then recover. Rinse and repeat. I pulled the local network to pieces, reset every piece of equipment, reinstalled OSs, you name it - it consumed me for weeks. I eventually gave up on fixing it and the problem was 'miraculously' cured seemingly overnight a couple of months later.

This week, the nightmare came back after upgrading to VM 350Mbps internet. I'd be downloading happily on the MBP (from Usenet with NZBVortex), then the speed would crash to near zero and recover for another minute or two. Rinse and repeat. Oh God, not again...

Once again I tore the local network and the house to pieces, no improvements. I tried everything I could think of and then some. I even downgraded from High Sierra beta 4 to Sierra, with no improvement, after initially blaming the beta. I tried eliminating possible local interference but found nothing of note, and again no changes. I was close to giving up again.

Just half an hour ago or so, I was at the desktop PC with the MBP also on the desk, trying various things. I had tried connecting the MBP via ethernet to the switch and it was rock solid - no speed crashes. So, it's not the OS, the download app, the Usenet server or similar. I tried connecting the desktop with a temporary USB wifi dongle to the same AP and downloading the same NZB as the MBP. Rock solid. WTH? So it's not the wifi AP itself either.

I was falling asleep and close to giving up, while watching pfSense's status page. The CPU usage on the firewall box was consistent, no spikes in NIC buffer or cache sizes that might explain the crash, nothing. Then it hit me... Wait a minute. Buffers... hard drives...?? I'd upgraded to HS beta and not re-enabled TRIM on my Samsung Evo 850 SSD on the MBP. Nothing to do with the wifi issues, but I'll have to turn it back on at some point, I thought.

I didn't dream it was related, but carried out the tweak before I slept and forgot again. One final test of the wifi. Wait... wut? Perfect. A rock solid 32MB/sec down with not one single speed crash on a 5GB file (normally there had been several, approximately every 1.5GB or so). Try again, it must be a fluke. Nope, rock solid again.

I had rebooted the machine multiple times even just this evening/early morning, so it wasn't the reboot that followed the TRIM enable (sudo trimenforce enable) that fixed it. However, now, thinking about it, I hadn't re-enabled TRIM on the drive after upgrading to HS beta either. That's when the speed crashes started, come to think of it. The issue wasn't fixed - as I thought it would be - by downgrading to Sierra. That'll be because I forgot to re-enable TRIM then as well (clean wipe and install).

WTH. How does TRIM affect wifi throughput or file saving? Especially when the same machine works flawlessly on ethernet downloading the same file. It's a coincidence. Surely? So I disable TRIM and reboot... and the speed issues are back. W. T. H?! I can only imagine that somehow the way wifi receives packets for downloads is overwhelming the SSD or the macOS driver for it. Usenet is very many small bits of files, reassembled into larger files locally after receipt. So, having no TRIM could be overwhelming the SSD with garbage files being constantly written then deleted after the OS re-combines them into RARS. Maybe. I dunno, but I do know TRIM has fixed it.

So, TLDR: if you have wifi speed drop weirdness and an SSD, try force enabling TRIM and trying again. It's weird, it shouldn't be a factor, but it is. As I said, this is just a bleary-eyed tired ramble for that one person in a million this might help via Google in the future.
 
Man of Honour
Joined
20 Sep 2006
Posts
33,887
Is the CPU/memory usage on the MacBook between using LAN, Wifi with and without TRIM? Have you looked in activity monitor and looked at the disk activity in there at all?
 

Deleted member 138126

D

Deleted member 138126

TRIM is only an issue if the drive is almost full. If the drive has plenty of spare capacity, TRIM is irrelevant.

You should be testing wifi throughput using something that is not disk dependent, like iperf (I'm making a wild guess, but I bet pfsense has an iperf server, or something similar).

I'm not saying it can't be the drive -- the drive could be generating electro-magnetic interference that is messing up the wifi. And enabling trim could be triggering something that changes the drive's behaviour vis-a-vis generating the interference. Seems like a bit of a stretch, but not impossible (I've seen some pretty crazy and weird things, too).
 
Back
Top Bottom