0

There's a couple of questions with answers on tools or settings to simulate slow network conditions on different OSes, like

Unfortunately, the answers don't mention a solution for my case, so it's not redundant or a duplicate.

I'm developing a web application (locally, with Node.js / Express on macOS, but that doesn't matter much) using a Redis cache and a MySQL database.

In order to do some (performance) testing on my local machine, I want to put load on that application (for example with ab or JMeter). Obviously, because the Redis cache and the MySQL database are running on the same machine as the web application, I have a stellar network connection (as in: none) between these three components.

I want to simulate different network connections between these components - as would be the case in a production setup with multiple servers - by downgrading the virtual 'connections' to Redis and MySQL (but with different latency and bandwidth settings per connection). The connections can be distinguished by the port numbers, but not by the hostname (which is localhost for all three).

How can I simulate different network connection conditions for specific port numbers on the same machine?

Jochem Schulenklopper
  • 6,452
  • 4
  • 44
  • 62
  • If 'wrapping' the Redis cache and the MySQL data store in Docker containers provides a solution -- can network conditions between containers be set or downgraded? -- that could be valid as well. The question then migrates to "where / how to specify those settings?" – Jochem Schulenklopper Mar 22 '18 at 21:52

1 Answers1

1

Maybe this will help you: http://intrarts.com/throttledcli.html

Actually what you are asking about is more or less QoS functionality.

But... in my opinion, it's not a very efficient way of testing network applications. What I do prefer in the first place is to mock the network interfaces in the application. This way you can control much more precisely all kind of timeouts, downtimes, connections breaks, synchronizations.

Vicctor
  • 803
  • 6
  • 13
  • "it's not a very efficient way of testing network applications" - I know. I'm just trying to get a feel of it, comparing some strategies for caching logic. "mock the network interfaces in the application" - Yes, but then I need to implement all kind of networking logic (timeouts, latency, dropped packets) in code. I want to configure that 'outside' my code, as I won't need that code in production setup neither. – Jochem Schulenklopper Mar 22 '18 at 21:47
  • "Actually what you are asking about is more or less QoS functionality." True, I want an easy way to specify QoS characterics (related to network) _outside_ my application and _on just one machine_. – Jochem Schulenklopper Mar 22 '18 at 21:49