JMeter – Simulate multi-users scenario with counter

/** Vietnamese: bài viết trình bày về cách dùng JMeter Counter để  giả lập nhiều user truy xuất hệ thống cùng lúc **/

In load testing field, JMeter is a powerful tool, and powerful tool often means high learning curve. The fact that JMeter document is not so well-written caused programmers lots of troubles getting around with it. If you know how things to be done, it’s very simple. If not, you are going to spend several hours searching for the solution.

The situation: I need to simulate 1000 users to login in my system, using different username (ofcourse). After logging in, each user must input their activation code, gotten from the database. Then they go for the site functions as usual.

The interesting thing is that the activation code are random strings: I have no control how it be. But I must do mapping accurately from user to activation code. To do that, I write bootstrap code to generate  1000 users (user1 -> user1000) and their activation code. Next, export them to a CSV file to be read by JMeter.

  • user1,12345
  • user2,52341
  • user3,12534

But how to get those information to  JMeter? Using bean shell script, I managed to put these values in custom variables CurrentUser and CurrentUserActivationCode. But I must only put one pair of different value for each thread. Since JMeter have no global variable, I can’t tell it to increase each time a new thread start!

I searched for global variables for a while and try some suggestion (properties and the likes) without success. And then I remember that I only need a counter, because it simply doesn’t matter if the users log in in a order or not.

Solution: It’s JMeter Counter Config Element(actually I have no idea why a counter is a Config Element).

4 thoughts on “JMeter – Simulate multi-users scenario with counter

  1. hienptit

    Hi Long,
    I’m trying to learn about Jmeter, and I encountered some problems. I searched on Google, and I found your blog. It’s good! I hope I get your support of Jmeter. Can you give me your email addresss or YM nick to discuss?
    My email address is: trinhhienptit@gmail.com. Thank you!

  2. ledohoanglong

    Hi Hien,

    Nice to meet you. Thank you for appreciating my blog :)

    I have sent to your email, hope you already received it.
    If there’s anything I can help, please drop a comment or feel free to email me. I will answer as soon as possible.

  3. Richard

    I had problems to find your blog in google. I found it
    on 15 position, you should build a lot of high authority social backlinks , it will help you to increase traffic.

    I know how to help your site, just search in google – k2 seo tips and
    tricks

    1. ledohoanglong Post author

      Hi, thanks for your kind comment :)

      I just change the domain name of the site, so… of course its rank will fall down a lot. I will check your guide out, thanks again!

Comments are closed.