How to measure network speed between two machines

The network speed is really important performance parameter when it comes to microservice architecture, because most of the services running on separate machines even on separate networks. If you measure the performance, you have to be sure that the network link between services are fast enough.

I made a short research about the tools to measure network speed and found that there is a really cool and simple command line tool called iperf. It is cross platform and completely open source with BSD licence. So you can download it from its official website or install directly with your package manager (if you are using unix based or mac operating system). On MacOS i installed it with homebrew.

sudo brew install iperf

After installing iperf on both ends we can start to measuring.

On first machine you have to start iperf as server, so that it listens incoming transfer requests:

iperf -s

On the other machine we can start iperf as a client and put the ip address of server machine as argument

iperf -c 192.168.1.6

The measurement takes only few seconds and then you can see the results on both machine.

------------------------------------------------------------
Client connecting to 192.168.1.6, TCP port 5001
TCP window size: 129 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.1.66 port 62284 connected with 192.168.1.6 port 5001
[ ID] Interval      Transfer     Bandwidth
[ 4]  0.0-10.0 sec  1.09 GBytes  938 Mbits/sec

 

How to show memory usage status of eclipse in status bar

These days I evaluate IntelliJ and compare its features and competencies with my favorite IDE Eclipse. IntelliJ seems really full-fledged, but it will probably take a while to familiarize with its usage.

One of its features that I immediately noticed was the memory usage (heap size) indicator in the status bar.

I’d like to have this feature in Eclipse too and I made some research how to enable it. I thought it is only possible with plugin installation but Eclipse has this feature built-in. Unfortunately it is not enabled by default. To enable memory usage bar, go to Window > Preferences > General and check the option ‘Show heap status’.

Voilà! The memory usage bar is now visible in the progress bar.

SSH login with authentication key (without using password)

If you have a remote server accessible via SSH and you often want to connect to this server, then typing password each time is very inefficient. Especially if you have multiple servers with different passwords (I hope they are different). To solve this problem you can use another authentication method called authentication by key.

To enable this first you have to create a public/private key pair on your local host. (I assume you are on a *nix system or use at least an emulator like cygwin and installed openssh already) This step is only necessary for one time and the public key can be used for multiple servers.

Creating these keys is very easy type following command on command line.

ssh-keygen

You will be asked for path where you want to store your key. You can let the defaults and press enter to continue.

And then you can type a passphrase for extra protection. Even if someone gain access to your private key without your permission (actually no one else except you should access your private keys) it is not enough to access your servers with this private key unless knowing your passphrase. If you don’t want extra protection, you can let passphrase emtpy and press enter.

Your public and private keys are generated already. (You can see them on the path you selected, by default  under ~/.ssh/ .File named id_rsa is your private key and id_rsa.pub is the public key)

Now you have to register your public key to the remote server.

ssh-copy-id username@servername

Change the username and servername (hostname or IP adress of the target server) and execute the above command. It will ask you your password and then copy your public key to target server. If it successful you can now login your remote server without password. Just try to connect in the usual way.

ssh username@servername

And that’s it.