gatling

(6)Spring WebFlux性能测试——响应式Spring的道法术器

两盒软妹~` 提交于 2020-01-03 21:09:33
本系列文章索引 《响应式Spring的道法术器》 前情提要 响应式流 | Reactor 3快速上手 | Spring WebFlux快速上手 本文 源码 1.4 从负载测试看异步非阻塞的优势 前面总是“安利”异步非阻塞的好处,下面我们就实实在在感受一下响应式编程在高并发环境下的性能提升。异步非阻塞的优势体现在I/O操作方面,无论是文件I/O、网络I/O,还是数据库读写,都可能存在阻塞的情况。 我们的测试内容有三: 首先分别创建基于WebMVC和WebFlux的Web服务,来对比观察异步非阻塞能带来多大的性能提升,我们模拟一个简单的带有延迟的场景,然后启动服务使用gatling进行测试,并进行分析; 由于现在微服务架构应用越来越广泛,我们基于第一步的测试项目进一步观察调用存在延迟的服务的情况下的测试数据,其实主要是针对客户端的测试:阻塞的 RestTemplate 和非阻塞的 WebClient ; 针对MongoDB的同步和异步数据库驱动进行性能测试和分析。 说明:本节进行的并非是严谨的基于性能调优的需求的,针对具体业务场景的负载测试。本节测试场景简单而直接,各位朋友GET到我的点即可。 此外:由于本节主要是进行横向对比测试,因此不需要特定的硬件资源配置,不过还是 建议在Linux环境下进行测试 ,我最初是在Win10上跑的,当用户数上来之后出现了不少请求失败的情况

Publishing messages to ActiveMQ using Gatling

和自甴很熟 提交于 2020-01-03 18:58:21
问题 I have been using Gatling to publish messages to ActiveMq server. I get "java.lang.SecurityException: Invalid username: null or empty" tho I use valid username and password. Here is my test code and the exception were thrown. Any inputs on how to fix this will be of help. import io.gatling.core.Predef.Simulation import io.gatling.core.Predef._ import io.gatling.jms.Predef._ import io.gatling.core.config.Credentials import org.apache.activemq.ActiveMQConnectionFactory import org.apache

Gatling. Fetch data from response for next requests

风格不统一 提交于 2020-01-03 02:31:23
问题 I need to fetch optional data from a JSON response to build next requests. I use check(jsonPath("...rooms[0].id").exists.saveAs("...roomId")) but if the user has no rooms, the result is interpreted by .check() as an error (e.g. request count 4 (OK=3 KO=1) ) object Users { val execute = exec(http("Users")) .get("/api/user?userIdentifier=${userId}") // if user has no rooms, the check results in an error (KO) .check(jsonPath("$..user.rooms[0].id").exists.saveAs("roomId")) .pause(1) } object Room

How do I make Gatling capture request while reading from the session?

霸气de小男生 提交于 2020-01-02 05:32:12
问题 According to the Gatling documentation, I can work with session attributes when executing a scenario. However, every time I use function literals to access the session in a scenario, I end up with the following exception: [error] java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated [error] at io.gatling.charts.report.ReportsGenerator$.generateFor(ReportsGenerator.scala:45) [error] at io.gatling.app.Gatling.generateReports

Gatling - execute scenarios sequentialy

随声附和 提交于 2020-01-02 04:06:05
问题 When I run code like: setUp( scenario1.inject(constantUsersPerSec(1) during (1 second)), scenario2.inject(constantUsersPerSec(1) during (1 second)) ).protocol() Both scenarios are started at once. What need to be changed to run it one by one? 回答1: You could start the second scenario with a "nothingFor" injection step setUp( scenario1.inject(constantUsersPerSec(1) during (1 second)), scenario2.inject(nothingFor(1 second) , constantUsersPerSec(1) during (1 second)) ).protocol() If you want to

Gatling (and JMeter) struggling to maintain Requests per Second (RPS)?

谁说胖子不能爱 提交于 2019-12-25 02:19:31
问题 I'm load testing an API. We have a problem - our response times are too large, sometimes close to a minute. We want to be at the range of under a second. But that is besides the point. When I use a load testing tool, such as Gatling, the RPS sent seem to hit a halt. As you can see in the attached image, there is an initial 15 seconds of 20RPS, and suddenly almost no RPS at all. How can I maintain constant RPS? Probably it has to do with the poor response times, but what if I don't care about

Gatling for loop inside inject

北城以北 提交于 2019-12-25 01:14:46
问题 I am new to Scala and Gatling so bear with me! I want to have a for loop inside inject where I can set how many times I want atOnceUsers() instead of just repeating the code x times, but this code is giving me an error so I was wondering if this way is not supported. val numTimes = 3 val scn = scenario("Some scenario").exec(someScenario) setUp( scn.inject( for (i <- 1 to numTimes) atOnceUsers(10) ).protocols(httpProtocol) ) 回答1: you're close... .inject takes an array of steps (which a

How do you use Gatling's checkIf method?

佐手、 提交于 2019-12-24 05:18:21
问题 Documented here, Gatling's checkIf method is intended for conditional checking. It's not available on ScenarioBuilder 's fluent API but I can see it in the CheckSupport class. I have scoured the internet and cannot find a single example. I'm using Gatling 2.3.1. 回答1: I found an example in their unit tests as follows: http("untypedCheckIf").get("/") .check( checkIf("${bool}") { jsonPath("$..foo") } ) 来源: https://stackoverflow.com/questions/51328868/how-do-you-use-gatlings-checkif-method

What does rampUsersPerSec function really do?

扶醉桌前 提交于 2019-12-24 01:26:17
问题 I find Gatling documentation a bit unclear about a specific function: rampUsersPerSec . Injects a random number of users per second over a given duration (rate1) to (rate2) during(dur unit) Injects users from starting rate1 to target rate2, defined in users per second, during a given duration. Eg : rampUsersPerSec(10) to(20) during(10 minutes) For instance, with rampUsersPerSec(1) to 100 during 10 , I may have 41 more users on second 1, then 99 more users on second 2, then 8 more users on

What is the proper way of running Gatling from a stand-alone application

旧巷老猫 提交于 2019-12-23 12:52:39
问题 I need to start a Gatling simulation from a main application. The use case is as follows: The application reads a specification, and generate test cases based on this specification. The test cases are converted into Gatling scenarios. The scenarios are run in a Gatling simulation. So far I managed to do this via the sbt plugin. However this is inconvenient if we want to reuse the tool I'm developing in other contexts (imagine non-scala projects for instance). Since I'm generating Gatling