This project is a hands-on challenge designed to help you explore containerization, load balancing, and performance testing using real-world tools.
Figure 1: Architecture diagram showing HAProxy in front of backend services
You will:
- Containerize a frontend and backend application.
- Set up HAProxy to load balance between multiple backend instances.
- Connect all services using Docker Compose.
- Run the full app stack locally.
- Design and execute load tests using Apache JMeter.
You are expected to create the following directory structure:
.
├── backend/
│ │ main.py
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ └── App.jsx
│ │ └── main.jsx
│ ├── index.html
│ └── Dockerfile
│ └── package.json
│ └── vite.config.js
├── haproxy/
│ └── haproxy.cfg
├── docker-compose.yml
└── README.md
You must create all missing files from scratch as part of the challenge. (dockerfile and docker-compose)
- Create a
Dockerfilefor the backend using Python and FastAPI. - Create a
Dockerfilefor the frontend using React and Vite. - Ensure each image exposes the correct ports and builds successfully.
- Define services for:
- Two (or more) backend containers
- One HAProxy container
- One frontend container
- Configure dependencies and port mappings
- Map a custom HAProxy config file to the HAProxy container
- Use
docker compose up --build - Access the frontend through the exposed port
- Verify that the frontend communicates with the backend through HAProxy
- Design a test plan in Apache JMeter to simulate concurrent users making HTTP requests to the backend via HAProxy.
- Use different listeners such as:
- View Results Tree
- Summary Report
- Response Time Graph
- Experiment with different numbers of users and request patterns.
- Use a
balancestrategy in HAProxy likeroundrobinorleastconn - Make sure all services are reachable from within the Docker network
- Keep logs and metrics to understand how HAProxy is routing traffic
- Your completed repository with:
- All configuration and Docker files
- Screenshots or reports from JMeter test results
