The goal of this project was to build a scalable RESTful API service for a retail web-portal and optimize to handle web-scale traffic. An ETL process was implemented to migrate legacy datasets of more than 20M+ records into a MySQL database.
- Scaled microservice horizontally to handle 2100 requests per second by deploying four servers through the load balancer and implementing the least connection algorithm
- Reduced query time from 5800ms to 21ms by incorporating data partitioning, foreign keys, and indexes
- Stress tested by using k6 and loader.io to monitor improvements and identify performance bottleneck
Install dependencies
npm install
Start the server
npm start
Open http://localhost:8080
| Request Type | Endpoint | Returns | Status |
|---|---|---|---|
| GET | /qa/questions/:product_id/:page/:count | A list of questions for a particular product | 200 |
| GET | /qa/questions/:question_id/answers | All answers for a given question | 200 |
| POST | /qa/questions | Nothing is returned - adds an answer for the given question | 201 |
| PUT | /qa/questions/:question_id/helpful | Nothing is returned - updates a question to show it was found helpful | 204 |
