Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to introduce fake latency in Java RMI calls?

In want to diagnose a bottleneck which happens when my client is talking to a server on the other side of the world. I'd like to run the server on my local machine and simulate the latency. Is there a way I can inject a brief thread-sleep in all remote calls? I'm not sure which remote call is the bottleneck, so I need to delay them all.

Second attempt to clarify: I don't want to copy-paste thread sleeps into every single remote method, because there are lots and lots of remote methods. I'm trying to find a way to inject a sleep into the RMI subsystem so all calls over RMI will be delayed.

like image 918
Neil Traft Avatar asked Jul 19 '11 13:07

Neil Traft


2 Answers

WANem is designed to do just that. It works at the network level so isn't Java- or RMI-specific.

like image 121
NPE Avatar answered Nov 20 '22 02:11

NPE


The Charles Proxy server has a feature where it can add throttling/latency to a connection:

http://www.charlesproxy.com/documentation/proxying/throttling/

I have been very pleased with Charles -- well worth the $50 for a license.

like image 1
ShabbyDoo Avatar answered Nov 20 '22 04:11

ShabbyDoo