リクエストの素早い処理を助けるために、NGINXはハッシュテーブルを使います。
During startup and with each reconfiguration, NGINX selects the smallest possible size for the hash tables, taking into account the size of basket, where keys with the coinciding hashed values fall, would not exceed the assigned parameter (hash bucket size).
選択はパラメータ ハッシュの最大サイズをテーブルサイズが超えるまで運用されます。ハッシュの大多数についてディレクティブがあり、それらはこれらのパラメータを変更することができます。例えば、サーバの名前を持つハッシュは server_names_hash_max_size と server_names_hash_bucket_size によって制御されます。パラメータのハッシュバケットサイズは常にサイズに等しくされ、プロセッサーキャッシュの行のサイズの倍数になります。This makes it possible to accelerate the search for key in hash on processors, after decreasing the number of turnings to memory. If hash bucket size is equal to the size of one line of processor cache, then during the search for key the number of turnings to memory in the worst case will be equal to two - for the first time for determining the address of basket, and the second - with the search for key inside the basket. Accordingly, if NGINX gave out communication about the need for increasing hash max size or hash bucket size, then it is first necessary to increase the first parameter.
NGINXは以下の接続を扱うメソッドをサポートします。これは use
ディレクティブによって割り当てられることができます。
--with-select_module
と --without-select_module
を使うことで、このモジュールを有効または無効にすることができます。--with-poll_module
と --without-poll_module
を使うことで、このモジュールを有効または無効にすることができます。/proc/sys/kernel/rtsig-max
を使ってキューサイズを増加する必要があります。しかし、Linux 2.6.6-mm2以降は、このパラメータはもう利用できません。そして、各プロセスのために、RLIMIT_SIGPENDINGによって割り当てられるサイズの個別のシグナルのキューがあります。キューが混んでくると、NGINXはそれを無視し、状況が正常になるまでpoll
メソッドを使って接続処理を開始します。