Using Apache Jmeter to test the ScholarX backend

Apache Jmeter is Java application designed to load test functional behavior and measure performance. In a previous discussion, @YohanAvishke suggested to use it for testing performance of the ScholarX backend.

https://jmeter.apache.org/

Basically we can use this tool to create scripts to simulate the user requests.
Ex: Simulate the backend part of mentor flow parallelly with 100 users

There’s also a non-GUI version of this tool which can be added as an maven plugin. So we can include this in the tests also.

cc: @EngTeam

4 Likes

Thank you soo much @piumal1999 for working on the task. For the testing let’s use two thread groups,

  1. For mentors (about 10 users)
  2. For mentees (about 10 users for each mentor, all together 100)

Let’s run test plans for each group synchronously. And by the end of the run the app will be tested against 110 users.

Can you please post your test plans for each of the groups?

Yeah, this makes sense. Btw, how do we manage the program state changes with this.

I just tried using the tool with public endpoints. It works fine with the public APIs (which doesn’t require authentication)

I’m still finding a way to test the other endpoints without the user registration part.

We can change the states manually. Only mentee_application and mentor_application are the states we should run the tests for.
Also since the 2 thread groups will run synchronously after running the first thread group for mentors, we can change the state to mentor_application and run the second thread group.

Can you have a-look into the link. Even though in the blog they use different SSO provider the mechanism should be the same.

I also linked the part covering the login scenario,
https://jmeter.apache.org/usermanual/build-web-test-plan.html#logging_in

1 Like

I set up the configuration according to this but after setting the proxy server, Google chrome can’t access internet. I’ll find another method to do so.

Refered this too:

It worked with Firefox. So i was able to get the login records to mock the authentication process.

After running those records manually, still it throws the 403 errors when accessing the endpoints.

In most of the tutorials, it says to update the SAMLRequest, RelayState and SAMLResponse with a regex. But in our scenario, those details doesn’t show up in the login requests

Since the authentication part was not working in Jmeter, I ran a test with only using the public endpoints.
I added the 3 public endpoints to the test.

  • Get all programs
  • Get program by id
  • Get mentors of a program

image

I used 100 thread, so each endpoint runs 100 times at once. But only 86 threads completed well this time. Maybe heroku is blocking the remaining requests.

image

So 259 out of 300 requests succeeded. The rest was not running.

After stopping it, I ran the 100 threads again but the cleardb database reached the query limit after few requests (nearly 80). So I have to wait until the query limit resets for another attempt.

image

cc: @YohanAvishke @EngTeam

This is the result I got after 3 hours.

This is nice @piumal1999 !

What’s the conclusion of your result as you see? Is the current deployment feasible of running the pilot?

1 Like

As I see the server is enough for the pilot. The problem we have is with the database.
Since clearDB has a query limit per hour, we’ll have to use either PostgreSQL or a database in another server.

Btw, I ran the tests again had the same result. So there shouldn’t be anything wrong with the server.

First 100 threads (0% error rate):

Another 100 threads (nearly 50% error rate due to the cleardb problem):

My conclusion: Need to use another way to keep the database

WDYT? @jaye @YohanAvishke @Gravewalker @anjisvj

2 Likes

@piumal1999 nice work.

Yup, let’s migrate the database to a PostgreSQL database.

Let’s try Postgres then. ClearDB MySQL version is also old. Heroku gives you a Postgres DB hosted on an EC2 instance

1 Like

Now the mvp is connected to a new postgresql database.
https://sef-scholarx.herokuapp.com/

Now the query limit problem is fixed.

4 Likes

yay! Good job! @piumal1999 WIth that we completed the backend for the pilot right?

Yeah I think so. Let’s have a final QA as you said in Final QA before launching ScholarX for the pilot - #3 by anjisvj

1 Like

Nice, good job @piumal1999

1 Like