4 ms·
When doing web development I will occasionally connect my local code base to a remote SQL server via SSH. This adds enough latency to be noticeable and I’ve fo
by nvahalik 1y ago
When doing web development I will occasionally connect my local code base to a remote SQL server via SSH.
This adds enough latency to be noticeable and I’ve found pages that were “OK” in prod that were unbearable in my local environment. Most of the time it was N+1 queries. Sometimes it was a cache that wasn’t working as intended. Sometimes it simply was a feature that “looked cool” but offered no value.
I’m not sure if there is a proxy that would do this locally but I’ve found it invaluable.
- enlyth 1y agoI'm a big fan of Toxiproxy for these kinds of things: https://github.com/Shopify/toxiproxy https://github.com/Shopify/toxiproxy
- calebh 1y agoI do networked game development on Windows and I've found the clumsy program to be very valuable to simulate adverse network conditions. You can set it up to simulate arbitrary network latency, packet loss and so forth. https://jagt.github.io/clumsy/ https://jagt.github.io/clumsy/
- DrillShopper 1y agoYou can use the tc command from the netem package for those wondering how to achieve this on Linux. https://man7.org/linux/man-pages/man8/tc-netem.8.html https://man7.org/linux/man-pages/man8/tc-netem.8.html
- emmelaich 1y agoI've used `tc` about three times in the last 15 years. Every time I have to relearn it.
- raisedbyninjas 1y ago+1 for clumsy On Windows I've also used Heavy Load, Netlimiter for more fine-grained control and Microsoft's Driver Verifier.
- nvahalik 1y agoThis looks interesting. I'll check it out, thank you!
- pseudocomposer 1y agoI do this with a Makefile that calls “kubectl port-forward.”
- nawgz 1y agoI’m not sure if you’re saying the latency was introduced in client <-> server hops or server <-> db hops, but chrome dev tools (I’m sure all browsers too) can simulate different network conditions with a few clicks! Useful for something similar to what you’ve said, but in the end I think you meant server <-> db latency is what you want to inject
- MetaWhirledPeas 1y agoThis was the first thing I thought of. Dev Tools in any browser have a boatload of great stuff like this.
- sitkack 1y agoOn FreeBSD I have used https://man.freebsd.org/cgi/man.cgi?dummynet https://man.freebsd.org/cgi/man.cgi?dummynet for this exact thing.
- overfeed 1y ago> I’m not sure if there is a proxy that would do this locally but I’ve found it invaluable. If you're on Linux, you can use iptables to randomly drop a fraction of packets to simulate bad connections - even for localhost. The TCP retransmits will induce a tunable latency. You have to be careful with this on a remote host or you may find yourself locked out, unless you can reboot out of band
- pvtmert 1y agomacOS has embedded feature that allows slowing down network calls. Similar to the IP/netfilter suite Linux has. PF handles most of the magic behind the scenes. Even better because there is an UI to configure it. You just need to download Xcode additional tools package, there is a NetworkConditioner.prefpane inside. Install that and various settings will show up in the regular System Settings/Preferences...