Macbook is lagging and freezing when connected to WiFi

Everything was working fine and suddenly I am facing my MacBook is lagging and apps keep on bouncing in the dock when I try to open them.

I tried resetting SMC, NVRAM/PRAM but the problem still exists. I tried restarting shut it down for sometimes but no luck.

I turned off WiFi and everything was working fine, no lag and no freeze but as I turned WiFi on, it started lagging again.

Any ideas what's causing this issue?


Solution 1:

I figured out the problem was with my network cache. None of the online help worked for me.

The problem was occurring only for my home WiFi. I connect with the VPN and noticed everything was working smoothly as earlier.

I cleared my DNS cache, and reset the network configurations. I deleted the directory /Library/Preferences/SystemConfiguration/ and run the commands to flush the DNS cache

$ sudo dscacheutil -flushcache
$ sudo killall -HUP mDNSResponder
$ sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

Make sure to take the backup of the SystemConfiguration just incase. Your system can generate the files later.

Hopefully, this will help anyone else who seems to be having freezing issues when connected to the internet.