PerfTestはRabbiitMQに対して圧力試験を行う.

14590 ワード

ダウンロード先:
公式サイトのアドレス:http://www.rabbitmq.com/java-tools.html
ダウンロードして解凍すればいいです.
PerfTest对RabbitMQ进行压力测试_第1张图片
使い方
runjava com.rabbitmq.perf.PerfTest --help
usage: 
 -?,--help                                   show usage
 -a,--autoack                                auto ack
 -A,--multi-ack-every                   multi ack every
 -ad,--auto-delete                      should the queue be
                                             auto-deleted, default is true
 -b,--heartbeat                         heartbeat interval
 -B,--body                              comma-separated list of files
                                             to use in message bodies
 -bc,--body-count                       number of pre-generated
                                             message bodies. Use with
                                             --json-body. Default is 100.
 -bfc,--body-field-count                number of pre-generated
                                             fields and values for body.
                                             Use with --json-body. Default
                                             is 1000.
 -c,--confirm                           max unconfirmed publishes
 -C,--pmessages                         producer message count
 -ca,--consumer-args                    consumer arguments as
                                             key/values pairs, separated
                                             by commas, e.g. x-priority=10
 -cri,--connection-recovery-interval    connection recovery interval
                                             in seconds. Default is 5
                                             seconds. Interval syntax,
                                             e.g. 30-60, is supported to
                                             specify an random interval
                                             between 2 values between each
                                             attempt.
 -ct,--confirm-timeout                  waiting timeout for
                                             unconfirmed publishes before
                                             failing (in seconds)
 -ctp,--consumers-thread-pools          number of thread pools to use
                                             for all consumers, default is
                                             to use a thread pool for each
                                             consumer
 -d,--id                                test ID
 -D,--cmessages                         consumer message count
 -dcr,--disable-connection-recovery          disable automatic connection
                                             recovery
 -e,--exchange                          exchange name
 -E,--exclusive                              use server-named exclusive
                                             queues. Such queues can only
                                             be used by their declaring
                                             connection!
 -env,--environment-variables                show usage with environment
                                             variables
 -f,--flag                              message flag(s), supported
                                             values: persistent and
                                             mandatory. Use the option
                                             several times to specify
                                             several values.
 -h,--uri                               connection URI
 -H,--uris                              connection URIs (separated by
                                             commas)
 -hst,--heartbeat-sender-threads        number of threads for
                                             producers and consumers
                                             heartbeat senders
 -i,--interval                          sampling interval in seconds
 -jb,--json-body                             generate a random JSON
                                             document for message body.
                                             Use with --size.
 -k,--routing-key                       routing key
 -K,--random-routing-key                     use random routing key per
                                             message
 -l,--legacy-metrics                         display legacy metrics
                                             (min/avg/max latency)
 -L,--consumer-latency                  consumer latency in
                                             microseconds
 -m,--ptxsize                           producer tx size
 -M,--framemax                          frame max
 -mh,--metrics-help                          show metrics usage
 -mp,--message-properties               message properties as
                                             key/value pairs, separated by
                                             commas, e.g. priority=5
 -ms,--use-millis                            should latency be collected
                                             in milliseconds, default is
                                             false. Set to true if
                                             producers are consumers run
                                             on different machines.
 -n,--ctxsize                           consumer tx size
 -na,--nack                                  nack and requeue messages
 -niot,--nio-threads                    number of NIO threads to use
 -niotp,--nio-thread-pool               size of NIO thread pool,
                                             should be slightly higher
                                             than number of NIO threads
 -o,--output-file                       output file for timing
                                             results
 -p,--predeclared                            allow use of predeclared
                                             objects
 -P,--publishing-interval               publishing interval in
                                             seconds (opposite of producer
                                             rate limit)
 -pi,--polling-interval                 time to wait before polling
                                             with basic.get, in
                                             millisecond, default is 0.
 -po,--polling                               use basic.get to consume
                                             messages. Do not use this in
                                             real applications.
 -prsd,--producer-random-start-delay    max random delay in seconds
                                             to start producers
 -pst,--producer-scheduler-threads      number of threads to use when
                                             using --publishing-interval
 -q,--qos                               consumer prefetch count
 -Q,--global-qos                        channel prefetch count
 -qa,--queue-args                       queue arguments as key/value
                                             pairs, separated by commas,
                                             e.g. x-max-length=10
 -qp,--queue-pattern                    queue name pattern for
                                             creating queues in sequence
 -qpf,--queue-pattern-from              queue name pattern range
                                             start (inclusive)
 -qpt,--queue-pattern-to                queue name pattern range end
                                             (inclusive)
 -r,--rate                              producer rate limit
 -R,--consumer-rate                     consumer rate limit
 -rkcs,--routing-key-cache-size         size of the random routing
                                             keys cache. See
                                             --random-routing-key.
 -S,--slow-start                             start consumers slowly (1 sec
                                             delay between each)
 -s,--size                              message size in bytes
 -sb,--skip-binding-queues                   don't bind queues to the
                                             exchange
 -se,--sasl-external                         use SASL EXTERNAL
                                             authentication, default is
                                             false. Set to true if using
                                             client certificate
                                             authentication with the
                                             rabbitmq_auth_mechanism_ssl
                                             plugin.
 -sst,--servers-startup-timeout         start timeout in seconds (in
                                             case the servers(s) is (are)
                                             not available when the run
                                             starts). Default is to fail
                                             immediately if the servers(s)
                                             is (are) not available.
 -st,--shutdown-timeout                 shutdown timeout, default is
                                             5 seconds
 -sul,--servers-up-limit                number of available servers
                                             needed before starting the
                                             run. Used in conjunction with
                                             --servers-start-timeout.
                                             Default is deduced from --uri
                                             or --uris.
 -t,--type                              exchange type
 -T,--body-content-type                 body content-type
 -u,--queue                             queue name
 -udsc,--use-default-ssl-context             use JVM default SSL context
 -v,--version                                print version information
 -vr,--variable-rate                    variable publishing rate with
                                             [RATE]:[DURATION] syntax,
                                             where [RATE] integer >= 0 and
                                             [DURATION] integer > 0. Use
                                             the option several times to
                                             specify several values.
 -vs,--variable-size                    variable message size with
                                             [SIZE]:[DURATION] syntax,
                                             where [SIZE] integer > 0 and
                                             [DURATION] integer > 0. Use
                                             the option several times to
                                             specify several values.
 -x,--producers                         producer count
 -X,--producer-channel-count            channels per producer
 -y,--consumers                         consumer count
 -Y,--consumer-channel-count            channels per consumer
 -z,--time                              run duration in seconds
                                             (unlimited by default)
PerfTestを使う
runjava com.rabbitmq.perf.PerfTest -h amqp://guest:[email protected]:5672 -e xxx_exchange -k xxx_route -s 50 -x 5 -y 0 --body-content-type application/json -t topic -p
PerfTest对RabbitMQ进行压力测试_第2张图片
2つの発表者と4つの消費者を使う:
runjava com.rabbitmq.perf.PerfTest -x 2 -y 4 -u "test-2" -a --id "test 2"
この変更は消費者を手動確認に切り替えます.
runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "test-3" --id "test 3"
変更は、メッセージサイズをデフォルト(12バイト)から4 kBに変更します.
runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "test-4" --id "test 4" -s 4000
持続的なキューと持続的なメッセージを使用します.
runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "test-5" --id "test-5" -f persistent
オプションの説明:
  • -x,--(生産者数)
  • -(消費者数)
  • -u,--
  • -a、--    autack aut ackは、クライアントがmessagesを処理した後に、サービス側にack確認情報を返します.サービス側はこのack情報を受け取った後でメッセージを削除します.
  • -d,-(今回のテストの番号、識別情報)
  • -s--(メッセージサイズ、単位はバイト)
  • -f,-(メッセージ・マーク、コンマで区切られた複数のサポート値:persistentとmandtory)
  • 消費者は、一度に複数のメッセージを確認することができます.例えば、以下には100のメッセージが確認されます.
  • runjava com.rabbitmq.perf.PerfTest -x 1 -y 2 -u "test-6" --id "test-6" -f persistent --multi-ack-every 100
  • -A,-(いくつかのメッセージごとにack情報をサーバ端に返す)
  • -q,-(消費者プリ読み取りの数)
  • -c,-(未確認メッセージ投稿の最大値)
  • -C--(生産者が生成するメッセージの数は、今回の性能テストで生産者が指定数のメッセージを生成したら停止します.)
  • -r-(生産者速度制限)
  • -R,-(消費者速度制限)
  • -z,-(運転時間、単位は秒(デフォルトでは制限なし).
  • -p,-(定義済みのオブジェクトの使用を許可する)
  • -D,-(消費者が消費するメッセージの数、つまり今回のテストで消費者が全部でどれぐらいのメッセージを消費するかを指定します.消費者がこれだけのメッセージを消費すれば、消費者は停止されます.)
  • -qa,--queue-args queue  列パラメータのキーの値は、x-max-length=10
  • などのコンマで区切られます.
  • -mp,--  メッセージ属性はカンマで区切られたキーのペアで、例えばprorit=5.
  • -B,--カンマ区切りのファイルリストを使用して、メッセージの内容(ここではカンマ区切りのファイル名が複数あり、ファイルの内容をメッセージとして指定されたqueueに書き込む)
  • -T,--メッセージ・コンテンツ・タイプ
  • -qp,--  順次作成されるキュー名パターン
  • -F、 キューモードの開始(含む)
  • −T、キューモードの終了(含む)
  • -hst,--heart beat-sender-threads  生産者と消費者の心拍数
  • スレッド数
  • -ms、--遅延時間を収集するかどうか、単位ミリ秒.デフォルトはオフです.生産者と消費者が異なるホストで動作するなら、それをtrueに設定します.
  • -p,-- 予め宣言されたオブジェクトの使用を許可する