Salt Rate Limiting

Salt is able to run commands in parallel on a large number of clients. This can potentially create large amounts of load on your infrastructure. You can use these rate-limiting parameters to control the load in your environment.

These parameters are all configured in the /etc/rhn/rhn.conf configuration file.

Salt commands that are executed from the command line are not subject to these parameters.

1. Batching

There are two parameters that control how actions are sent to clients, one for the batch size, and one for the delay.

When the SUSE Manager Server sends a batch of actions to the target clients, it will send it to the number of clients determined in the batch size parameter. After the specified delay period, commands will be sent to the next batch of clients. The number of clients in each subsequent batch is equal to the number of clients that have completed in the previous batch.

Choosing a lower batch size will reduce system load and parallelism, but might reduce overall performance for processing actions.

The batch size parameter sets the maximum number of clients that can execute a single action at the same time. Adjust the java.salt_batch_size parameter. Defaults to 200.

Increasing the delay increases the chance that multiple clients will have completed before the next action is issued (more clients are grouped together in subsequent batches), resulting in fewer overall commands, and reducing load.

The batch delay parameter sets the amount of time, in seconds, to wait after a command from the previous batch is processed before beginning to process the command on the next client. Adjust the java.salt_batch_delay parameter. Defaults to 1.0 seconds.

2. Salt Mineの無効化

以前のバージョンでは、SUSE ManagerはSalt mineというツールを使用してクライアントの利用可否を確認していました。Salt mineでは、クライアントが1時間ごとにサーバに接続するため、多大な負荷が発生していました。SUSE Manager 3.2ではより効率的なメカニズムが導入されたため、Salt mineは必要なくなりました。代わりに、SUSE ManagerサーバはTaskomaticを使用して、12時間以上オフラインになっていると思われるクライアントに対してのみpingを送信し、デフォルトで少なくとも24時間ごとに1回、すべてのクライアントに接続します。これを調整するには、rhn.confweb.system_checkin_thresholdパラメータを調整します。この値は日単位で、デフォルト値は1です。

新しく登録されたSaltクライアントでは、Salt mineはデフォルトで無効になっています。ご使用のシステムでSalt mineが実行されている場合は、無効にすると負荷を削減できます。これは特に、大量のクライアントがある場合に効果的です。

サーバで次のコマンドを実行してSalt mineを無効にします。

salt '*' state.sls util.mgr_mine_config_clean_up

クライアントが再起動され、Saltイベントがいくつか生成されてサーバで処理されます。大量のクライアントがある場合は、これらのイベントを処理する際に過剰な負荷が発生する可能性があります。これを避けるには、バッチモードで次のコマンドを実行できます。

salt --batch-size 50 '*' state.sls util.mgr_mine_config_clean_up

このコマンドが終了するまで待つ必要があります。Ctrl+Cを使用して処理を終了しないでください。