Linux tuning : Network performance

Here are few setting that can greatly improve network performance of your Linux machine:

# set OS max read & write buffers
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

#TCP Autotuning settings
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 87380 16777216

# disable slow start after idle
net.ipv4.tcp_slow_start_after_idle = 0

#enable TCP window scaling
net.ipv4.tcp_window_scaling = 1

With these settings in place, we stopped seeing all the Netty reconnect problems in the Storm topologies. Make sure to apply these settings to all Storm Supervisor nodes.

These settings can be applied at the run time using sysctl command as, but this will not persist between the system reboots:

$ sudo sysctl -w net.ipv4.tcp_rmem = "4096 87380 16777216"

To permanently save them update /etc/sysctl.conf or a file under /etc/sysctl.d, and run this command:
$ sudo sysctl -p /etc/sysctl.conf

 

Get current Epoch timestamp

#java:

System.currentTimeMIllis();
Note: the value is in milliseconds. Make sure to divide by 1000 if you need the value in seconds

#php:

time()

#objective-c:

NSDate now = [NSDate date];
NSTimeInterval nowEpochSeconds = [now timeIntervalSince1970];

# perl:

time

# python:

import

int(time.time())

#.NET C#

# MySQL:

SELECT unix_timestamp(now());

# Unix/Linux shell:

$ date +%s

#