The task is to consistently increment a number in a database when parallel threads are racing to increment the number.
-
Create a table Number in MySQL database with one integer type field.
-
Create a RESTful API using Spring MVC architecture that increments this number.
-
Use Jmeter (Do not use postman because it does not send parallel requests) to call this API with 5000 users so that a lot of parallel requests are sent to server to increment the number.
-
Now set the initial value of Number to 0.
-
After the execution of Jmeter, the value of the number in the database shall be 5000. (Try the same with a bigger number 100000)
-
The API should be scalable i.e. if deployed on multiple machines with same database, the result should be consistent.
- Checkout the git repository in your local machine.
- Open your favorite IDE, import a new maven project from file system. Choose the checkout location of the project.
- Run maven update / clean.
- Change the mysql database username and password with your mysql database username and password.
- Create the schema and table as provided in the database-instructions file.
- Run the project as Springboot application.
- Open JMeter and import the test script included in the repository.
- Run the test suite.
- Run the Jmeter test script.
- Check the count in the database with the select query in the database-instructions file.