JMeter 并行 mq 发布具有唯一序列 ID 的请求消息,在发送之前需要针对外部系统进行验证

问题描述 投票:0回答:1

我需要创建一些将消息发布到通过 ActiveMQ Artemis 队列获取输入的系统的负载测试。 我遇到的问题是,我发送的每个请求都必须有一个唯一的序列号才能被视为有效,并且队列后面的系统在数据库中管理该序列号,如果当前线程请求有一条消息,则不会考虑有效请求与系统期望的不同的 ID。

我认为下面的这种方法将是一个可能的解决方案,但我想从社区获得一些验证我的方法是否正确,也许还有一些建议。

Set-up thread group:
    1. : Get initialSequenceID from DB through JDBC sampler 
    2. Pass initialSequenceID to JMeter system variables
    
Thread group: 
(test with 1 loop, 3 parallel threads):
    3. User Defined Variables: get initialStartingCounterValue from jmeter system variables
    4. JMeter Counter (config element): initialize global counter with initialSequenceID (using Jmeter global counter) and create a threadCounterVariable. 

现在对于这部分我遇到了麻烦,但基本上这就是我想逻辑地实现它的方式:

A. Spawn X parallel Publisher threads with uniqueCounterValue starting from initialStartingCounterValue (refer Jmeter global counter variable) - I tested this and it works with the JMeter Publisher sampler (the counter value ids are unique per each request even though the threads are parallel)
For each thread attempting to publish:
    B. Ask db if the next id has incremented to the current thread value
    C. Compare currentThreadUniqueCounterValue with currentDbSequenceId
    if (currentThreadUniqueCounterValue == currentDbSequenceId) {
        send publish request
    } else {
        retry until currentThreadUniqueCounterValue == currentDbSequenceId or some_timeout_value
    }

基本上,每个线程(具有唯一的序列号)需要询问 Db 是否准备好接受具有当前 id(由 JMeter 全局计数器设置)的消息。

这个A、B、C标准让我头疼。任何关于我应该如何实现这一点的想法或建议将不胜感激。

jmeter performance-testing activemq-artemis mq
1个回答
0
投票

最简单的是:

  1. 设置线程组:

    • 通过JDBC采样器从DB获取initialSequenceID
    • 根据需要生成尽可能多的“序列 ID”,并使用 JSR223 SamplerGroovy 语言
    • 将它们写入 CSV 文件
  2. “普通”线程组

    • 使用 CSV 数据集配置从 CSV 文件中读取序列 ID 值,直到它们可用或您的测试以其他方式结束(最后一个线程完成最后一次迭代、超出测试持续时间等)
© www.soinside.com 2019 - 2024. All rights reserved.