Reputation: 9
I tried to create 50000 tcp connection in single linux machine but i was not able to create 50000 connections only 10800 tcp connections were created.after that i got java.lang.OutOfMemoryError: unable to create new native thread.
I changed
ulimit -n 200000, nproc in /etc/security/limits.d/90-nproc.conf,
/etc/sysctl.confsysctl -w net.ipv4.tcp_mem='8388608 8388608 8388608'
sysctl -w net.ipv4.tcp_rmem='4096 87380 8388608'
sysctl -w net.ipv4.tcp_wmem='4096 65536 8388608
I changed statck size to ulimit -s 100000
Help me to create 50000 tcp connections in single linux machine
Upvotes: 0
Views: 500
Reputation: 25873
Not possible. Independently from your OutOfMemoryError
, which can be solved with more memory, each socket in Linux is actually a file descriptor, and a given process cannot have 50k open file descriptors.
Upvotes: 1