[JMeter stress test] Surging through jmeter pressure test

Table of contents

foreword

environment

Download configuration source code

JMeter and JDK download

JDK+Jmeter installation

 Jmeter non-GUI running pressure test

end


foreword

Surging is a heterogeneous microservice engine that provides a modular RPC request channel. The engine also provides various protocols on the basis of RPC service governance, and also provides a stage component for access to the gateway. Compared with functions, it is possible Everyone wants to know how much concurrency they can withstand, and everyone will conduct stress tests on their own. When encountering some problems that lead to unsatisfactory stress test results, they will label the framework engine. This performance is not good. Regarding the stress test results, many people I don’t know why, so I will tell you the results in a one-shot manner. Then this time, from the beginning to the end, I will sort out the environment and testing process, and publish it through this article, and please supervise the peers.

environment

Process: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz 2.20 GHz

Memory: 16.0GB

Language: .NET 6.0

Download configuration source code

 1. Download the latest source code through surge . After downloading, choose to test the Say service in the ManagerService module service, and the test code is relatively simple, which is to return a string. The code is as follows

  public async Task<string> Say(string name)
        {
            return await Task.FromResult($"{name}: say hello");
        }

2. Increase the log level, because this will affect the performance. For example, the set info will be three times lower than the error level. Take the test log configuration as an example. The test uses NLog. Change coloredConsole to error under Nlog.config level, the code is as follows

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <targets>
    <target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
    layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
      <highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
      <highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
      <highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
      <highlight-row condition="level == LogLevel.Error" foregroundColor="Red" />
      <highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" backgroundColor="White" />
    </target>
    <target name="file" xsi:type="File"
            archiveAboveSize="10240"
        layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}"
        fileName="c:\surging1\${level}\_${shortdate}.log" />
  </targets>
  <rules>
    <logger name="*" minlevel="error" writeTo="file" />
    <logger name="*" minlevel="error" writeTo="coloredConsole" />
  </rules>
</nlog>

3. Publish the server under the release type, and then run it through the dotnet Surging.Services.Server.dll command. After running successfully, whether it can be accessed through the browser

JMeter and JDK download

1. JMeter download address: http://jmeter.apache.org/download_jmeter.cgi

2. JDK download address: https://www.oracle.com/technetwork/cn/java/javase/downloads/index.html

JDK+Jmeter installation

1. Windows installation (take win 7 as an example)

1. Install jdk, configure java environment variables (steps omitted)

2. Unzip apache-jmeter-2.13.zip to D disk

3. Select "Computer" (right click) on the desktop - Advanced System Settings--Environment Variables

 4. In "System Variables" --- "New", enter: JMETER_HOME in the variable name, enter: D:\apache-jmeter-2.13 in the variable value 5. Modify the CLASSPATH variable, in the variable

 value Add %JMETER_HOME%\lib\ext\ApacheJMeter_core.jar;%JMETER_HOME%\lib\jorphan.jar;%JMETER_HOME%\lib\logkit-2.0.jar; click OK again.

6. Go to D:\apache-jmeter-5\bin and run jmeter.bat to open JMeter

 Jmeter non-GUI running pressure test

Create configuration jmx file

1. Add Thread Group

Configure the user thread of the thread group as 2000

 2. Add Http Request under thread group

Configure Http Request, the pressure test interface is http://localhost:281/api/manager/say?name=fanly, remember to check Use KeepAlive

3. Then click save as to reach D:\

 4. Run the jmeter console for pressure testing, the code is as follows

jmeter -n -t D:\HTTP.jmx -l D:\read.csv -e -o D:\ResultReport

5. The running results are as follows

If you don’t understand the above, you can load the generated read.csv to jmeter to generate a report for viewing, as shown below

 From the above figure, we can see that the throughput of the http pressure test of surge is 12589/s

end

Colleagues, fans, and customers are also welcome to perform stress testing according to the above configuration methods. I also remind you not to enable info level logs, because this will cause a significant decrease in performance. The stress test is only 4000/s, and only the error level is about 1/6 , also revealed that platform visualization will be provided in the follow-up under surge, the following are some modules

Finally, I would like to thank everyone who has read my article carefully. Looking at the fans’ growth and attention all the way, there is always a need for reciprocity. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!

In my QQ technology exchange group (technical exchange and resource sharing, no advertising)

Guess you like

Origin blog.csdn.net/weixin_67553250/article/details/131153380
Recommended