16.2. コネクター設定

16.2.1. JBoss EAP 6 にて HTTP コネクターのスレッドプールを定義

概要

エクゼキューターモデルを使用すると JBoss EAP 6 のスレッドプールを異なるコンポーネント間で共有できます。これらのプールは異なる (HTTP) コネクターで共有できるだけでなく、エクゼキューターモデルをサポートする JBoss EAP 6 内の他のコンポーネントも共有できます。HTTP コネクターのスレッドプールを現在の Web パフォーマンスの要件に合わせることは容易ではなく、現在のスレッドプール、現在および予想される Web ロードの要求を綿密に監視する必要があります。このタスクでは、エクゼキューターモデルを使用して HTTP コネクターのスレッドプールを設定する方法について取り上げます。コマンドラインインターフェースを使用して設定する方法と、XML 設定ファイルを編集して設定する方法の両方を説明します。

手順16.1 HTTP コネクターのスレッドプールの設定

  1. スレッドファクトリーの定義

    設定ファイルを開きます (スタンドアロンサーバーに対して編集する場合は standalone.xml、ドメインベースの設定に対して編集する場合は domain.xml)。このファイルは EAP_HOME/standalone/configuration または EAP_HOME/domain/configuration フォルダーにあります。
    次のサブシステムエントリーを追加します。値はサーバーの環境に合わせて変更します。
    <subsystem xmlns="urn:jboss:domain:threads:1.0">
        <thread-factory name="http-connector-factory" thread-name-pattern="HTTP-%t" priority="9" group-name="uq-thread-pool"/>
    </subsystem>
    
    CLI を使用したい場合は、CLI コマンドプロンプトで次のコマンドを実行します。
    [standalone@localhost:9999 /] ./subsystem=threads/thread-factory=http-connector-factory:add(thread-name-pattern="HTTP-%t", priority="9", group-name="uq-thread-pool")
  2. エクゼキューターの作成

    6 つある組み込みエクゼキュータークラスの 1 つを使用して、このファクトリーのエクゼキューターとして動作させることができます。6 つのエクゼキューターは unbounded-queue-thread-poolbounded-queue-thread-poolblocking-bounded-queue-thread-poolqueueless-thread-poolblocking-queueless-thread-pool、および scheduled-thread-pool になります。
    この例では、unbounded-queue-thread-pool を使用してエクゼキューターとして動作させます。サーバーの環境に合わせて max-threads および keepalive-time パラメーターの値を編集します。
    <unbounded-queue-thread-pool name="uq-thread-pool">
      <thread-factory name="http-connector-factory" />
      <max-threads count="10" />
      <keepalive-time time="30" unit="seconds" />
    </unbounded-queue-thread-pool>
    
    CLI を使用する場合は、以下を実行します。
    [standalone@localhost:9999 /] ./subsystem=threads/unbounded-queue-thread-pool=uq-thread-pool:add(thread-factory="http-connector-factory", keepalive-time={time=30, unit="seconds"}, max-threads=30)
  3. HTTP Web コネクターがこのスレッドプールを使用するようにする

    同じ設定ファイルで、Web サブシステム下にある HTTP コネクター要素を見つけ、前の手順で定義したスレッドプールを使用するよう編集します
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" executor="uq-thread-pool" />
    CLI を使用する場合は、以下を実行します。
    [standalone@localhost:9999 /] ./subsystem=web/connector=http:write-attribute(name=executor, value="uq-thread-pool")
  4. サーバーの再起動

    変更を有効にするため、サーバー (スタンドアロンまたはドメイン) を再起動します。次の CLI コマンドを使用して、以前の手順で行った変更が有効になったことを確認します。
    [standalone@localhost:9999 /] ./subsystem=threads:read-resource(recursive=true)
    {                  
        "outcome" => "success",
        "result" => {
            "blocking-bounded-queue-thread-pool" => undefined,
            "blocking-queueless-thread-pool" => undefined,
            "bounded-queue-thread-pool" => undefined,
            "queueless-thread-pool" => undefined,
            "scheduled-thread-pool" => undefined,
            "thread-factory" => {"http-connector-factory" => {
                "group-name" => "uq-thread-pool",
                "name" => "http-connector-factory",
                "priority" => 9,
                "thread-name-pattern" => "HTTP-%t"
            }},
            "unbounded-queue-thread-pool" => {"uq-thread-pool" => {
                "keepalive-time" => {
                    "time" => 30L,
                    "unit" => "SECONDS"
                },
                "max-threads" => 30,
                "name" => "uq-thread-pool",
                "thread-factory" => "http-connector-factory"
            }}
        }
    }
    [standalone@localhost:9999 /] ./subsystem=web/connector=http:read-resource(recursive=true)
    {
        "outcome" => "success",
        "result" => {
            "configuration" => undefined,
            "enable-lookups" => false,
            "enabled" => true,
            "executor" => "uq-thread-pool",
            "max-connections" => undefined,
            "max-post-size" => 2097152,
            "max-save-post-size" => 4096,
            "name" => "http",
            "protocol" => "HTTP/1.1",
            "proxy-name" => undefined,
            "proxy-port" => undefined,
            "redirect-port" => 443,
            "scheme" => "http",
            "secure" => false,
            "socket-binding" => "http",
            "ssl" => undefined,
            "virtual-server" => undefined
        }
    }
    
結果

スレッドファクトリーとエクゼキューターが正常に作成され、このスレッドプールを使用するよう HTTP コネクターが編集されます。