I summarized it because there was no memorandum of addiction and an article that explained from top to bottom unexpectedly.
Do a load test with JMeter. 10 accesses per second. Target https://hogehoge.jp/abc With basic authentication nuxt.js, API communication backend Laravel JMeter is done on Mac.
Install JMeter anyway. Do it with brew. If you don't have brew, install brew.
To use JMeter, you need the main body and Java.
brew install jmeter
brew tap homebrew/cask-versions
brew cask install java
At the time of writing this, java version 14 was installed, but it worked normally.
Run from the console.
jmeter
This will open the GUI tool. Use this screen to create a test plan (test content).
To make it Japanese, select the following from the menu. Options > ChooseLanguage > Japanese
Right-click on "Test Plan" in the left column Add> Threads (Users)> Thread groups Select to create a thread group.
Next, right-click on the "thread group" created above. Add> Sampler> HTTP Request Add> Listener> Statistical Report Add> Listener> View Results in Table Add> Listener> Save Response to File Add> Listener> Graph display Select to create each.
Then it looks like this.
Decide how many times to run the test every few seconds. Number of threads: 10 Ramp-UP period (seconds): 1 Number of loops: 1
To set. The above means that 10 requests will be executed in 1 second.
Select the HTTP request in the left column and enter the information.
Setting items | Set value |
---|---|
protocol | https |
Server name or IP | hogehoge.jp |
HTTP request | GET |
path | /abc |
Right click on HTTP request Add> Configuration Element> HTTP Authentication Manager Select and create.
Setting items | Set value |
---|---|
Base URL | https://hogehoge.jp/ |
User name | Basic authentication username |
password | Basic authentication password |
Mechanism | BASIC |
Select ** TestPlan and press ** Ctrl + s to save. After this, this file will be used, so save it in a convenient location.
I will test if it works for the time being. Press the green △ at the top of the GUI to execute. After execution, select "Show results in table" and if Status is green, it is successful.
Implementation is done with CUI instead of GUI. Execute with the following command.
jmeter -n -t ~/src/jmeter/test_plan.jmx -l ~/src/jmeter/log.jtl
#For the path, set the location of the saved file. Please specify an appropriate location for the log.
The contents of the log are like this.
cat ~/src/jmeter/log.jtl
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1591777603078,21372,HTTP request,429,Too Many Requests,Thread group 1-9,text,false,,347449,208,10,10,https://hogehoge.jp/abc,16242,0,238
1591777603178,21915,HTTP request,429,Too Many Requests,Thread group 1-10,text,false,,353217,208,9,9,https://hogehoge.jp/abc,16151,0,220
1591777602975,24513,HTTP request,429,Too Many Requests,Thread group 1-8,text,false,,358302,208,8,8,https://hogehoge.jp/abc,16689,0,211
1591777602877,25325,HTTP request,429,Too Many Requests,Thread group 1-7,text,false,,346781,208,7,7,https://hogehoge.jp/abc,16539,0,175
1591777602578,29420,HTTP request,429,Too Many Requests,Thread group 1-4,text,false,,623792,208,6,6,https://hogehoge.jp/abc,18709,0,308
1591777602353,30684,HTTP request,429,Too Many Requests,Thread group 1-1,text,false,,623792,208,5,5,https://hogehoge.jp/abc,18968,0,533
1591777602676,30529,HTTP request,429,Too Many Requests,Thread group 1-5,text,false,,623792,208,4,4,https://hogehoge.jp/abc,18419,0,210
1591777602378,30834,HTTP request,429,Too Many Requests,Thread group 1-2,text,false,,623792,208,3,3,https://hogehoge.jp/abc,19032,0,508
1591777602776,30459,HTTP request,429,Too Many Requests,Thread group 1-6,text,false,,623792,208,2,2,https://hogehoge.jp/abc,18681,0,168
1591777602477,30900,HTTP request,429,Too Many Requests,Thread group 1-3,text,false,,623792,208,1,1,https://hogehoge.jp/abc,18591,0,409
Gununu ... This is due to the limit on the number of requests for laravel. Let's adjust the number of simultaneous accesses by referring to the articles around here. https://qiita.com/HorikawaTokiya/items/c04e410e4ed76d3dddc2
That's it. Chan-chan.
Recommended Posts