Arya
Arya

Reputation: 8995

Socket connection limit on Java?

I am running a Java multi threaded network application on my server and when I increase the thread count to more than 2000, I start seeing exceptions that it can not connect to an external server. "Connection refused" error. This is from the client side, I do not get errors when I do 1000 threads on different servers

Is there anyway to increase this limit?

Upvotes: 0

Views: 1500

Answers (2)

Adwait Patil
Adwait Patil

Reputation: 171

Using 'thread per connection' in Java is a bad idea when you are using 2000 connections. You might want to refer to Java NIO

Upvotes: 0

Andremoniy
Andremoniy

Reputation: 34920

No doubts: each server has limit of incoming connections. On occupying all of them DOS attacks are based.

Upvotes: 1

Related Questions