⇧ Googleって1998年に創業で、25年目なんですね。Microsoftの創業が1975年らしいので、Googleさん意外に歴史ありますね。
負荷テストとは?
Wikipediaさんによりますと、
負荷テストという用語は、プロのソフトウェアテスト業界ではさまざまな方法で使用される。負荷テストとは、一般に、プログラムに同時にアクセスする複数のユーザーをシミュレートすることにより、ソフトウェアプログラムの予想される使用法をモデル化する方法を指す。
⇧ とのこと。
「性能試験」については、
パフォーマンステスト (英: performance testing)はソフトウェア品質保証では、一般に、特定のワークロードでの応答性と安定性の観点からシステムがどのように機能するかを判断するために実行されるテスト手法である。
⇧ となっており、Wikipediaの情報が正しい仮定した場合、
- 性能試験(パフォーマンステスト)
- 負荷テスト
- ストレステスト
- ソークテスト
- スパイクテスト
- ブレークポイントテスト
- 構成テスト
- 分離テスト
- インターネットテスト
というカテゴリー分類となるっぽい。
テスト専門に扱うテスターが必要になるのも肯けるほど、考慮すべき事項と必要な作業が多いですかね...
性能試験(負荷テスト)で使えるツール
「負荷テスト」で利用できるツールとしては、
⇧ 上記サイト様の情報と、Wikipediaの「負荷テスト」のページの情報を合わせると、
- Apache Bench
- Locust
- k6
- Tsung
- Vegeta
- Apache JMeter
- BlazeMeter
- Blitz
- Flood
- Gatling
- Loader.io
- LoadRunner
- Load Test (included with SOAtest)
- loadUI
- Login VSI
- NeoLoad
- OpenSTA
- Rational Performance Tester
- Siege
- Silk Performer
- Test Studio
- Visual Studio Enterprise edition
- WebLOAD
の数のツールが挙げられている、多いな...。
テストを適応する領域などによって、適したツールは変わってくるとは思うのだけど、Javaアプリケーションに関する「性能試験(負荷テスト)」に利用するツールとしては、「Apache JMeter」がメジャーのようです。
と言うか、ネットの情報で上位表示されるのが、ほぼ「Apache JMeter」しか出て来ないので、とりあえず、Javaアプリケーションに関する「性能試験(負荷テスト)」は「Apache JMeter」を使っておけば良いってことなんかね?
Javaアプリケーションの性能試験(負荷テスト)ができるApache JMeterとは?
公式のドキュメントによりますと、
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
⇧ とあるので、純度100%のJava製で、性能を測定する用途に特化したツールらしい。
Webアプリケーションのテストのために設計されてるとあるので、Javaアプリケーション以外にもテストできるようですね。
基本的には、
⇧ 適当なフォルダにダウンロードして、展開(解凍)して、binディレクトリに移動して、JMeterを起動する実行ファイルを実行すれば良いようです。
ただ、ネットの情報を見た感じだと、
- Server Agent
- Client
で分かれてるっぽいように見えるんだが...
どうやら、
JMeter cannot retrieve by default server metrics except Tomcat ones. To overcome this situation, we have developed a server agent which will get performance data for JMeter. The agent uses the SIGAR open source library. It is composed of a Java common part and native libraries per OS.
⇧「Apache JMeter」のみだと、Tomcat以外のメトリクスが取得できないってことらしいのでプラグインを導入しろってことみたい...
⇧ 検証したい対象に「Server Agent」を配置するってことらしいのだけど、
Agent application to access system metrics on remote machines.
⚠️ It's very out-of-date for modern technologySince it relies on SIGAR library to gather metrics, with that library last updated in 2010, ServerAgent won't work on many modern systems.
⇧ え~っと...何かモダンなシステムで機能しないってあるんだけど...
え?プラグイン使えないやん...
公式のドキュメントによりますと、
Once you've made sure the systems are ready, it's time to setup remote testing. The tutorial assumes you already have JMeter installed on all the systems. The way JMeter works is one controller node initiates the test on multiple worker nodes.
https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html
⇧ すべてのシステムに「JMeter」をインストールしろってなってますね...
GitHubのドキュメントに見当たらなかったので裏メニューな感じなのかもしれないですが、
Before we dive into the step-by-step instructions, it's a good idea to define the terms and make sure the definition is clear.
- Controller Node
- the system running JMeter GUI, which controls the test
- Worker Node
- the system running jmeter-server, which takes commands from the GUI and send requests to the target system(s)
- Target
- the webserver we plan to stress test
https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html
⇧ どうやら、「Apache JMeter」を起動する際に「Control Node」として動作させるか「Worker Node」として動作させるかで利用する実行ファイルが異なるみたい...
何故、GitHubのドキュメントの目立つところに記載しないのか...
⇧ 確かに「jmeter」「jmeter-server」の2つ用意されてるっぽい。
ドキュメントを確認した感じでは、
There are some additional scripts in the bin directory that you may find useful. Windows script files (the .CMD files require Win2K or later):
- jmeter.bat
- run JMeter (in GUI mode by default)
- jmeterw.cmd
- run JMeter without the windows shell console (in GUI mode by default)
- jmeter-n.cmd
- drop a JMX file on this to run a CLI mode test
- jmeter-n-r.cmd
- drop a JMX file on this to run a CLI mode test remotely
- jmeter-t.cmd
- drop a JMX file on this to load it in GUI mode
- jmeter-server.bat
- start JMeter in server mode
- mirror-server.cmd
- runs the JMeter Mirror Server in CLI mode
- shutdown.cmd
- Run the Shutdown client to stop a CLI mode instance gracefully
- stoptest.cmd
- Run the Shutdown client to stop a CLI mode instance abruptly
⇧ とのこと。
ドキュメントの記述を発見する前に、
⇧ 上図を見付けて、複数の「Apache JMeter」をインストールするなんて、そんな戯けた構成をする大空け者は誰だい?って思ったことを反省いたします...
「Apache JMeter」の公式のドキュメントに、メトリクスを収集したい対象のアプリケーションが配置されているマシン以外のマシンに「Apache JMeter」をインストールするように書いてあったんだものね...
メトリクスを収集したい対象のアプリケーションがコンテナ化されてる場合は、
⇧ 上図のようなイメージの構成になる感じですかね。
ただ、普通に考えたら、Client(GUIで操作できると想定)の「Apache JMeter」は、WindowsもしくはMacにインストールすることになると思うから、Serverの「Apache JMeter」は別マシンを用意してインストールする感じになるんかな?
FAQを見た感じでは、
How to do remote testing the 'proper way'?
Answer: Here are a few notes to help you on your way.
You have:
- Your application server. You shouldn't run anything on this machine that you wouldn't have running on it in your proposed or actual production environment (if you are running anything else, including JMeter, you will be adding load to the server and thus tainting your results).
- One or more machines running jmeter-server (the JMeterEngine). You want these machines to be reasonably close (network wise) to the application server. By "reasonably close" I mean on the same Ethernet segment or at least with no low speed links between them. The JMeter User Manual provides reasonable information about doing this.
- A single machine running the JMeter GUI that you use to control the machines running the JMeterEngine.
⇧ とある。
⇧ 上記の通り。
なので、マシンとしては、
- 「Apache JMeter」のClientを動作する環境(WindowsないしはMac)
- 「Apache JMeter」のServerが動作する環境(Linux)
- 対象のアプリケーションが稼働してる環境(LinuxないしはWindows Server)
の3台構成になる感じなんですかね?
ドキュメントのどの部分が「Apache JMeter」を適切に動作させる環境を構築する方法になっているのかが分かり辛い...
分かり辛いと感じているのは自分だけかもしれんけど...
というか、『How to do remote testing the 'proper way'?』ってFAQになってる時点で、ドキュメントを見ても分からないんだが、って人が一定数板ってことだとは思うけど。
そもそも、「Apache JMeter」のGitHub の情報だと「Apache JMeter」のServerとして動作させる点については全く触れられていないので、「クライアントサーバーモデル」の構成になってなくても利用できるのかもしれんので、
で、また用意しなきゃならなんマシンの構成が変わってくるよね...
クラウド環境になってくると、また構成が変わってくるとは思うけど...
毎度モヤモヤ感が半端ない...
今回はこのへんで。