简体   繁体   English

java客户端/服务器应用程序的负载测试

[英]Load testing for java client/server application

I have written a java client server application (not http), which i need to load test.我编写了一个 java 客户端服务器应用程序(不是 http),我需要对其进行负载测试。 However, most tools out there such as jmeter and grinder seem to be targeted to http requests.但是,大多数工具(例如 jmeter 和grinder)似乎都是针对 http 请求的。 Any suggestions?有什么建议?

Thanks!谢谢!

JMeter allows writing pluginns. JMeter 允许编写插件。 If your application uses protocol other than HTTP it seems that the protocol is proprietary, so writing tests requires some custom implementation anyway.如果您的应用程序使用 HTTP 以外的协议,则该协议似乎是专有的,因此编写测试无论如何都需要一些自定义实现。 JMeter allows this and it is highly recommended. JMeter 允许这样做,强烈推荐这样做。

由于我们不知道您使用的是什么协议,因此请以易于扩展的方式编写您自己的客户端以进行负载测试。

您可以看看Soatest ,它声称是基于套接字的,并且应该能够使用您正在使用的任何 Web 协议(希望是 TCP/UDP)。

You can use the JUnit4 or JUnit5 based load runners below which can simply accept your Unit tests and generate load on the target server.您可以使用下面基于JUnit4JUnit5的负载运行器,它们可以简单地接受您的单元测试并在目标服务器上生成负载。 These need not be HTTP tests, these could be any tests annotated with @Test这些不需要是 HTTP 测试,这些可以是任何用@Test注释的测试

The load configs look like below to ramp up or ramp down your load:负载配置如下所示,以增加或减少您的负载:

number.of.threads=2
ramp.up.period.in.seconds=10
loop.count=1

Your load test will look like below:您的负载测试将如下所示:

@LoadWith("our_load_config.properties")
@TestMapping(testClass = AnyTestEndPoint.class, testMethod = "anyTestMethod")
@RunWith(ZeroCodeLoadRunner.class)
public class LoadTest {

}

Your JUnit test which is fed to the load generator, The test class looks like below:馈送到负载生成器的 JUnit 测试,测试类如下所示:

import org.junit.Test;

public class AnyTestEndPoint {

    @Test
    public void anyTestMethod() throws Exception {
       ...
       // You can have your client code invoking the target server
       ...
    }
}

Note: You can feed multiple Junit tests too to the load reactor, to generate load on different part of the server logic/apis/processes.注意:您也可以向负载反应器提供多个Junit测试,以在服务器逻辑/apis/进程的不同部分生成负载。

Visit the HelloWorld Examples for more details.有关更多详细信息,请访问HelloWorld 示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM