MartinJoo
MartinJoo

Reputation: 2872

How to accept many requests from client

I am developing a struts2 project in Tomcat server.

I try to post 6000 request from client to my server API. but my server API only accept about more than 2000 requests. 4000 other are failed.

i got message from client like below:

 java.net.ConnectException: Connection refused

my server.xml have config:

    <Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="1000000" maxThreads="50000"  keepAliveTimeout="3200000"     minSpareThreads="10000" acceptCount="13000" maxIdleTime="1000000"
           redirectPort="8443" />

Does any one have a solution to allow my server API can get all client requests?

Please help me! Thanks

Upvotes: 0

Views: 80

Answers (2)

Aaron Digulla
Aaron Digulla

Reputation: 328556

This is probably due to some error on the server which you can see when you look into the server's error log.

One simple reason could be the database: If you create one database transaction per thread, then you need to configure the connection pool (and probably the database itself) to allow 6000 concurrent transactions.

Upvotes: 0

isnot2bad
isnot2bad

Reputation: 24444

I don't know if this causes your problem, but your configuration values seems to be far too high!

  • maxThreads=50000 means more than 15 GB memory (win32) when all threads are used!
  • minSpareThreads=10000 means about 3 GB memory consumption on startup (win32)!
  • keepAliveTimeout=3200000 means a connection stays open for >53 hours if not used/closed by the client!
  • maxIdleTime=1000000 means unused threads continue to exist for up to 16 hours before they are destroyed!

Upvotes: 2

Related Questions