【Reactor.netty x Spring】 環境変数をコントロールする

【Reactor.netty x Spring】 環境変数をコントロールする

Category
Author
Description
Spring 5のWebFluxから導入されているReactor.nettyのWebサーバですが、環境変数でConnection数や接続待ち時間などをコントロールできます。
Published
July 24, 2020
Last Updated
Last Updated July 24, 2020
Writings
この記事は約3分で読めます

はじめに

Spring 5のWebFluxから導入されているReactor.nettyのWebサーバですが、環境変数でConnection数や接続待ち時間などをコントロールできます。

TR;TD

結論、Javaの実行引数の後ろにJava Opsを設定するとWebサーバに反映されます。
java hoge.jar -Dreactor.netty.pool.leasingStrategy=lifo -Dreactor.netty.pool.maxConnections=200 -Dreactor.netty.pool.maxIdleTime=60000
環境変数に反映したり、ymlに定義もしましたが、そちらでは反映されなかったです

設定されているか確認する

ReactorNetty.java の設定をデバッグで求めてもいいですが、設定されてるかどうかReactor.nettyのログを出して確認しましょう。
手順的にはreactor.nettyのログをDEBUGにしたら完了です
logging: level: root: INFO reactor.netty.resources: DEBUG
こんな感じのログが出るはずです。
2020-06-30 19:09:46.129 DEBUG 65391 --- [ioEventLoop-5-1] r.n.resources.PooledConnectionProvider : Creating a new client pool [PoolFactory {maxConnections=200, pendingAcquireMaxCount=-1, pendingAcquireTimeout=45000, maxIdleTime=60000, maxLifeTime=-1, metricsEnabled=false}] for [xxx.xxx.xxx:443]
参考になれば幸いです🤗

参考URL