Ahmed tot
Ahmed tot

Reputation: 25

limit concurrent sessions to Apache tomcat web application

I am using a web application based on Apache Tomcat. How can I limit the number of concurrent connections to this application in order to prevent more than a specific number of users from accessing it?

I am not a programmer, so if there is a way without a code it will be perfect.

Upvotes: 2

Views: 15798

Answers (1)

Christopher Schultz
Christopher Schultz

Reputation: 20837

To limit the number of simultaneous connections, modify your <Connector> configuration in conf/server.xml:

<Connector ...
  maxConnections="10"
  />

You can set that value to almost anything. But that doesn't limit the number of users that can "use" the system at any given time. If you are using HTTP sessions to track "logged-in users", then you can limit the number of simultaneous sessions by modifying your application's META-INF/context.xml file to include:

<Manager ...
  maxActiveSessions="10"
  />

You can set that to just about anything you want.

https://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Implementation https://tomcat.apache.org/tomcat-8.0-doc/config/manager.html

Upvotes: 2

Related Questions