This repository contains a web application designed to test the scalability of various services like MongoDB, PostgreSQL, Redis, RabbitMQ, and Kafka. The application is containerized using Docker and provides APIs to populate, retrieve, and clear data in each service, as well as send messages to queues for performance testing.
The following services are containerized and utilized in this application:
- MongoDB: Stores entries and provides endpoints to insert, retrieve, and clear data.
- PostgreSQL: Similar to MongoDB but stores data in relational format.
- Redis: Stores data in-memory for fast retrieval and provides endpoints to interact with it.
- RabbitMQ: Acts as a message broker for sending tasks to the queue.
- Kafka: A distributed event streaming platform used to handle high-throughput message processing.
- Insert, retrieve, and clear data from MongoDB, PostgreSQL, and Redis.
- Publish messages to RabbitMQ and Kafka.
- Automatically manage Kafka topic partitions.
- Performance monitoring of bulk inserts and retrieval operations.
Ensure you have the following installed:
- Docker
- Node.js
- Clone the repository:
git clone https://github.com/yourusername/webapp-scalability-test.git
cd webapp-scalability-test
- Build and run the Docker containers:
docker-compose up --build
- Start the server
npm run dev
- Serevr is up and available to run at:
http://localhost:3000
-
MongoDB
- Insert Data: POST /api/populate Body: { "entryCount": 100 }
- Retrieve Data: GET /api/retrieve/:entryValue
- Clear Data: DELETE /api/clear
-
Redis
- Insert Data: POST /api/populate-redis Body: { "entryCount": 100 }
- Retrieve Data: GET /api/retrieve-redis/:key
- Clear Data: DELETE /api/clear-redis
-
RabbitMQ
- Send Message: GET /api/test-mq?index=1
-
Kafka
- Send Bulk Messages: POST /api/test-kafka Body: { "reqCount": 1000 }
To test the performance and scalability of each service, you can use the provided endpoints to send a large number of requests, monitor the time taken for the operations, and inspect the logs for any bottlenecks.