JMeter Tips and Tricks with Christina Thalayasingam
Christina Thalayasingam, senior quality engineer at Cisco, shares JMeter techniques: use the throughput controller for realistic user distributions, test fragments with Module Controller to reuse scripts, Regular Expression Extractor for dynamic responses, and Groovy scripting for file handling and cleanup.
Five, four, three, two, one.
Drop that.
Welcome to the Test Guild Performance Podcast where we get together to learn more about performance testing and site reliability with your host, Joe Colantonio.
Here it is.
Here it is. Here it is.
Hey, it's Joe. And welcome to another episode of the Test Guild Performance Podcast. Today we'll be speaking with Christina Talia singham, all about JMeter. Christina shares her top JMETER tips and tricks to help create better performance tests. So listen up. Also, just so you know, I am in the middle of moving. I just finally got into my new studio but my audio's still off. So when I recorded this originally, the audio is not the best, but I think the content is awesome. So hopefully you'll hang in there and check out the other episodes. The audio quality will get better in future episodes, so just listen through and I think you're gonna get a lot of lot of insight for JMETER and tips and tricks to use with Kristina. Let's face it, performance testing is tough. Traditional load testing tools create scripts that are bogged down in data that's hard to read and require a lot of work. Even for simple playback. Load Ninja cuts out the dirty work by using AI to inspect and debug your code almost instantly. No coding necessary. No changing of hands or relays between teams either. Give it a shot. It's free and easy to try. Head on over to testguild.com smartbear and click on the link to learn more. Hey Christina, welcome to the show.
Hi Joe. Thank you.
Thank you so much for joining us. I'm really excited to have you today. I'd like to talk about performance testing using JMeter, maybe some JMeter tips and tricks which I know you're an expert on. You talk about this all the time. But before we get into it, can you just tell us a bit more about yourself?
So I'm Christina Parasingam, currently senior quality engineer at Cisco Web and I've been in the industry now close to about five years. I basically concentrate on non functional testing. So I'm into more like performance and security testing as well as functional automation and so on. So that's basically about myself being a part of a couple of international conferences and I guess a couple of people might have seen me before in certain conferences.
Very cool. I love your background. Just curious, how did you get into performance testing? Because you also. Do you still do functional and security testing as well?
Yes, that's right. So a lot of functional and performance and a bit of security. I can't say that I do A lot of security. But we moved into becoming something called full stack quality engineers. So I mean that's a very rare term. I guess that's usually used for developers, but we believe in a principle where our quality engineers should have the basically deck of all trades. So yeah, that's basically where all the skills come in skill sets in terms of testing comes in place. So since you asked about performance testing, so I think I've shared this before as well. So in my first project when I started off as a fresher, just to let you know, I did my internships as a developer but I saw the, that I had the testing or the technical testing side in me when I was doing my internship. So I got into performance testing. As soon as I joined as a fresher I was just like pushed into the deep end because we were working on basically a content management search application which basically required benchmarking. So it was something that required benchmarking and I had to do performance testing and that's. I was like basically pushed into this R and D project trying to benchmark this particular two application with the help of JMeter. That's how I actually got introduced to performance testing.
This is a brand new podcast on performance testing. I think it's a topic that doesn't have many resources. So as you were interning you were learning about benchmarking. How did you learn learn the ropes of performance testing? Just trial and error?
Well, yeah, so initially it was pretty difficult for me to understand the concept basically digest them. So it was basically looking into documentation. Obviously we all follow articles and scripts on, I mean Google. So that's how it started off. But then going forward there were lots of mistakes that were made. So it's more like of like as you said, trial and error on like basically understanding what type of aspects that needs to be tested. So for example, we had a particular.
Part of the test which had various different factors and we understood that those need to be tested because depending on the facets or the filters that we use, the content that's being graphed is different and hence the performance of the system differs as well. So we wanted to have a more realistic scenario. And understanding the benchmark that is basically benchmark is like we trying to understand how much can the system handle like a threshold. And based on that if it is not acceptable then they are the developers or the engineering needs to do fine tuning. So for that we need to give them precise results. So for that we have to keep on changing the test that we write, enhancing it to actually grasp the realistic scenario and obviously with the help of various different articles available on the website. So I used the Blazemeter blog, which has a lot of articles on JMeter as basically my bible and there were lots of other articles that lots of people had written on Stat Cole's Law as well. So yeah, that's basically how I got into performance testing.
Nice. So I'll be honest, I've heard a lot of people when they try to learn JMeter, it's been around a while that they say it's very difficult to learn or they get confused with it. So why did you choose JMETER then As the tool to use?
Yeah, to be honest that's because it was an open source tool and yeah and I understand that it was pretty hard initially when I jumped in as a pressure as I told you, it was pretty hard to understand what was each of each sampler people used. JMeter will understand a sampler listener, a controller trying to understand each of these aspects. Each controller has or a sampler has unique part to play and if you know how it works you can actually use it in the right way. But yeah, that's where I think many fail because we don't tend to understand.
What each of the samplers have been are useful for. Each of these particular elements are useful for. So the reason as I told you that we selected JMeter was one thing it was very popular and the other thing was the.
R and D project and we were completely relying on open source and hence we jumped into JMeter. That's one of the main reasons why we use JMeter. Obviously there's a lot of other tools out there which are obviously you can pay and get them and pretty easy even the you can record and playback and so on. But we chose JMeter main sole reason to be honest was because it was open source.
So I just want to go back to. I forgot to follow up on you said your title or where you work. The title is a full stack QA engineer, is that correct?
Yeah, that's what the. So that's what we believe in. We believe in something called full stack quality engineering. So everyone in Cisco Lab, whoever is in the quality engineering department may call it or the quality engineering practice. We believe that everyone should be deck of all trades, not just you know, specifically look into functional testing or anything but.
Basically anyone should be able to jump in the deep end and do performance or security, functional automation, API, mobile and so on.
I love this concept. I'm just trying to figure out how it works so you get a story for A new feature and then you just say, okay, this performance, this one did for security and you would handle all aspects of that or the team you work on would handle all aspects of the testing.
The team. So basically.
Say it's a team of only two quality engineers in this particular pod, we call it a pod in at Cisco Labs. And basically in a pod, let's say there's about two to three quality engineers and all three of them should be well versed with all the activities. For example, if there's a user story, they should be able to do the functional, the performance as well as the security testing aspect for that. But then obviously tasks will be allocated for.
Say functional for QAA and then the performance for QEB and and then the other person, C would have security. But in case say B falls sick or needs to be allocated to a different project, then A would be able to still execute his performance testing.
Activities.
That's basically the whole idea.
Very cool. All right, so back to JMeter. I don't know if you remember you did a session at Perf Guild, the performance testing conference, but you had like tip one, paved the way through the controller. I just thought, can you tell me a little bit more what that meant?
So basically.
This is something where you would want to use your test to mimic a realistic scenario. So the throughput controller, the name even, I mean I've seen in certain JMETER blogs, they've accepted the fact that the name is not the right convention or whatever. But what it actually tries to do is say about you're testing with 10 concurrent users or users who are trying to access the system. At the same time you would like to divide the number of users doing their activities they want to do. Five users go and use the search bar maybe and another two users try to add an item in terms of an E commerce site, add an item to the cart and another three users maybe would.
Basically try to log in, take on forgotten password, try to basically divide the number of users so that they there is a more realistic activity. So that's where you can either you can give a percentage like for example.
If it's 5 out of 10, then like 50% and then 20, 30% according to the realistic scenario. So when we do performance testing and if there's an existing application already.
In place, like something that I'm working for now with, we use Google Analytics and so on to understand the statistics on how the workflows are handled or user journeys if I may call it. So based on that, we divide the.
Number of users or basically give them a percentage. So you prioritize the most used workflow or most access workflow with a particular percentage and so on. So that's basically what you would do with a throughput controller.
Nice. And so another one you mentioned that was a good tip was using test fragments. Could you tell us a little bit more? What are test fragments within JMeter? How are they helpful?
Yeah, perfect. So this is something.
Which is very helpful, but I think lots of people rarely use it in terms of test fragments. It basically wouldn't say exactly bringing the object oriented concept into JMeter, but it's something about reusability. So basically what you do is create certain actions. Like for example, if you're. If there's a site that you would always need a particular user to log in, right. You wouldn't be always writing or have an HTTP request written for that every time you have a particular action. Right. What you could do is have a test fragment and have a particular variable mentioned for the username and password and so on and then reuse it every time. So just basically use the module controller and select the particular item, I mean particular text fragment. So based on that you would be able to then reuse the particular fragment again and again. So especially for features like, I mean functions like login, logout or even search, depending on the particular activity that you are working with, if it's very frequently used, then it's highly suggested that you have it as a text fragment so that you can reuse it.
Cool. So it's almost like a reusable method if you're coding something.
That's right, that's exactly the case. So even like when you basically record your text, you would save it. You can, I mean what you could do is then take those particular.
HTTP request and put it in one of the test fragments, name, name them with a specific name that obviously you could understand and then use that as.
Reuse it in your test.
So yeah, so the next one was regular expression extractor. What's that all about?
Basically.
This is something that has been like my best friend in using jv. So especially when you try to log in and there are some particular applications there, the section ID or a CSRF token is basically carried forward. Right. So that's where the session is in place. So.
Like it's carried to the header, not just the cookie data, but like carried through the header or for example say I create a folder in the previous step or like an HTTP request and I create a folder and once the next step is to upload a particular document in that folder, right? So I need to carry that particular folder's UUID or certain that folder ID for the next step. So how do I do that? I need. So there's obviously once I create the folder there's a response that would appear and then I grasp this particular.
Gather this little folder ID from the response and then throw it into my.
Next call which is basically uploading the document. So basically I'm telling the call, please upload the document in this reference id. So it would obviously go and upload the documents in that folder. So this is basically to save that data, but grab it with a regular expression so that the syntax is obviously available. You can sometimes what I do is I take the response and I put it into the regex 1 or 1 or reject 101. There's a online tool where you can see if your regular expressions that you're putting are accurate and then you can obviously gather the regulate, I mean the particular value or you can that expression and then put it into this JMeter regular expression expression extractor and then use it. There's one more thing. So you can actually have one particular regular expression variable. So I can remember, I think in Perf guild I had showed an expression where you can basically in one go like in one variable you can get three different values. So basically what you can do is write an expression which graphs all three values and then in the template you can say $1, $ and $2 and so on. So it will basically grab that particular those three values or whatever values that you've given and then.
You can use them using just one variable name. But then just say underscore group one and use that whenever is necessary. Basically this information is there in the Apache JMeter manual as well. So that's quite helpful because I think I've used it for so many other.
Activities, not just this uploading documents that just came into my mind now, but various other functionalities where like I search for an item like in terms of E commerce site and then it basically drops down a couple of items like an auto complete and then I randomly pick one item out of that using my regular expression and then I go to that particular item without me trying to hard code things. I basically randomize what I do. And Regular expression extractor has been very helpful with that because that's how you would do a performance testing make it more realistic. Not everyone's going to go and click on the same item.
That's where I use regular expression extract.
Cool. So it sounds like it just makes your scripts more dynamic. Like you said, it's not static.
That's right. Yeah, that's right.
The last tip that you talked about was Enter thread communication.
So this is basically using to say there's two thread groups, right? And one thread group basically has a particular value that comes out.
Like in one thread group you're logging in and the next thread group you are doing another activity. You're basically using all those logged in users from the first thread group into the next thread group. And this is just one example, just I'm specifying, but there's other cases there, you can use it as well. So from the first thread group you need to probably send a session ID or a token that needs to be carried through to the next threads group. So basically what you would do is for the thread you would have something called inter thread.
Communication pre processor. What you would do is then it's basically a queue, right? So it queues in and like first in, first out kind of queue. So you use a variable, you store that into that particular. So again you would use like a regular expression or something, get the session id, store it in into this inter thread communication preprocessor, and then you would use the post processor in the next.
Thread where you would use that particular value that comes from the previous thread and then reuse it in or basically use it in the next thread group. So it's basically sharing data between two thread groups.
Very cool. So it's almost like if I had one thread script that entered a patient and got a patient id, you can grab that patient ID and send it to the other thread.
Yes, that's right. Or basically like in case you are searching for some item and then you want to use that in various different ways in the next thread group.
Very cool. So Christina, I know we talked a lot about JMeter, but any other tools you use as a performance engineer that you think people would find useful?
So there's obviously blazemeter, which I obviously find it very helpful in terms of, because since I use JMETER and I write script and the JMX files are literally the files that we use in blazemeter. So you write the script and you use blazemeter. So you can do things like IP spoofing, like, you know, trying to really access the system with different IPs, you can also behave like for example, if you're testing from like uk, but you want to chip test the particular application in us. So actually the end users are in US and the application is actually going to face US customers when you're testing it from UK so it would actually give you privileges where you can also test application in the US bandwidth and that atmosphere, that's one more thing and the other thing is it's quite costly but you can also obviously run it. If you are using JMeter there is a restriction of how many users a particular instance can handle, so it's about a maximum. I would suggest an instance or a slave instance would could handle about 200 concurrent uses. I think the maximum would be 250, 300 so. But luckily Blazemeter can handle about 10,000 concurrent users as well. So when you're looking at a more application that requires a high amount of concurrent users then blazemeter would come in place. I've also used loadrunner which is also quite user friendly I would say it's very user friendly rather than, I mean like obviously it's not much of a strong struggle as trying to understand a lot of things that Jane Meter but the only thing is the licenses are quite expensive but other than that it's more like a record and playback and you just have to replace certain values with variables and then just run it. So it depends on the controllers and the amount of virtual users, the amount of based on that you'll be able to achieve the particular target value. But then again it's pretty extensive but the reports are more sophisticated I would say. But again, again comparing loadrunner and blazemeter blazemeter also has quite a good reporting features as well as also it has its own recording feature now which you can install in your browsers and record and playback as well. And blazemeto also caters for mobile testing as well. So that's pretty cool and that's quite helpful. So yeah, these are a couple of the paid tools that I've used.
If someone needs to customize their JMETER scripts, what's the language they would use to do that?
Yeah, so basically you can use Groovy to write scripts. For example, there are a couple of these scripts I've used the bean shell pre processor or post processor which basically for example, let me. When I was, I was talking about the upload document, right? So I have a particular folder and what I'm trying to do, I have a couple of folders and I'm trying to upload various different documents but unfortunately in a folder I can only upload one document with the same name. If I try to upload same document with the same name it's going to tell me sorry, it's got the same name, you can't upload this document. So I can't have hundred documents and try to upload them in terms of like you're talking about thousand documents. It's not realistic. So what I did, what the ideal thing would be, is that on the fly, we would change the name of the document and then upload. So here's when I used a bean shell pre processing. So what I did is I added this to the request that I'm making. I add the pre processor and I wrote a small script, right? And that script.
Basically helped me to rename my file every time it uploads. Basically renamed it with a uuid. So that was unique. And I didn't have this problem because when it was randomly selecting the folders, I didn't have any issues where the particular file was not getting uploaded or so on. The next thing was, once the file is like, for example, say I want to delete all the files that I created, then I would have inside delete all the files that I've uploaded into that folder or something like that. You want to delete all the test data that you've created. What I would do is again have that name that I had stored with the folder name or something and then have another post processor and I would basically delete that folder. The bean shell is basically. It uses Java for scripting. Then there's something called BSH which uses JavaScript. And now there's also groovy script which also can be.
Basically what you can do is write a script for these kind of functionalities. There's various different functionalities that you can do. This is something that just came into my mind and this is quite helpful because you wouldn't want like thousand files inside your system just because you would want to upload. So basically what we we had was like one file which just gets renamed and uploaded. So in the same way, depending on like sizes and so on, we had different files and they were just getting uploaded with different names and then getting deleted at the end of the test so that we don't have any unnecessary dummy data in the system.
All right, Kristen, I know a lot of times when people try using JMETER performance testing, sometimes they struggle with distributed testing. So is there a way in JMeter you can use like a master slave type approach?
Yeah, you can. So there is actually a distributed testing process and you can also set it up in.
Basically like your JMETER settings file if you have it locally. So ideally what you would do is have a master and have the slave systems and Basically again the IPs use those IPs. So there's like a JMetus server which would act as the master and then there would be the slave who would connect to the particular server but they will be basically running the test on the target or the particular application. So what you would do is you would go into the JMeter properties and enter the remote host value. So that's basically the idea when running it locally as well, you can click on the run remote option and run it on your remote machines or the basically your slaves as well. Also you can maintain the master slaves and then run the test on your so that you will have more.
Number of concurrent uses that you can handle. So As I said, one instance or one slave instance can like roughly handle about 200 to 300 concurrent users. So if you are completely looking at open source and you have the facilities to do this, the master save distribution, then why not have a couple of slave JMETER instances and run it across those. So if you're looking at about thousand users, you might not have about five slave instances set up. So it's pretty straightforward and all the information is actually in the JMeter manual.
Cool. So it sounds like, you know, like in load run you'd have a controller and then you have Vugen generators so you could spread the load off. Okay.
Yes.
Okay Kristina, before we go, let's know the best way to find or contact you.
You can contact me on Twitter and you can also contact me on LinkedIn.
Thank you Christina for your JMeter performance awesomeness. If you think something of value we covered in this episode, head on over to testguild.com plakeperformance04 and while you're there, make sure to click on that try it today link under the exclusive sponsor section to learn all about SmartBeer's awesome performance test tool Load Ninja. So that's it for this episode of the Test Guild Performance podcast. I'm Joe and my mission is to help you succeed with creating end to end automation awesomeness. As always, test everything and keep the good. Cheers.
Thanks for listening to the Test Guild Performance podcast. Head on over to testguild.com for full show notes, amazing blog articles and online testing conferences. Make sure to subscribe to join the guild and continue your testing journey. This has been a Joe Calantonio production.
More from JoeBot
Automation Testing Podcast 2026: New Schedule, Events, Discounts with Joe Colantonio
Automation Guild Kickoff, AWS Nova, Karate v2, and AI Testing Reality and more TGNS177