0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

tomcat 10.1。同時接続数の設定変更

Posted at

Tomcat 10.1で同時接続数(同時処理できるリクエスト数)の設定を変更するには、server.xmlファイルでコネクタの設定を調整する必要があります。具体的には、要素の属性を変更します。

1. server.xml ファイルの場所

通常、server.xmlファイルはTomcatのインストールディレクトリの以下のパスにあります。

$TOMCAT_HOME/conf/server.xml

2. コネクタの設定

HTTPコネクタの場合、以下のような設定が含まれています:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           maxThreads="200"
           minSpareThreads="10"
           acceptCount="100"
           ...
           />

ここで、調整すべき主なパラメータは以下の通りです。

maxThreads: 同時に処理できる最大スレッド数(デフォルトは200)。この値を増やすことで同時接続数を増やすことができます。
minSpareThreads: 最低限確保しておくスレッド数。システムが低負荷時にでもこの数だけのスレッドが常に待機状態になります。
acceptCount: リクエストがmaxThreadsに達した後に、キューに入れることができるリクエストの数。これが超えると、新しいリクエストは拒否されます。

3. 設定の例

例えば、同時接続数を増やすためにmaxThreadsを300に設定し、キューに入れられるリクエスト数を200に増やす場合、以下のように設定します。

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           maxThreads="300"
           minSpareThreads="10"
           acceptCount="200"
           ...
           />

4. Tomcatの再起動

設定を変更した後、Tomcatを再起動する必要があります。これにより、設定が反映されます。

# Tomcatの停止
$TOMCAT_HOME/bin/shutdown.sh

# Tomcatの起動
$TOMCAT_HOME/bin/startup.sh

これで、Tomcatの同時接続数の設定が変更され、設定した通りに動作するようになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?