This repository contains a Java-based implementation of different types of web servers. The project is organized into three folders, each demonstrating a specific web server model. The performance of these web servers can be measured using Apache JMeter.
- A basic implementation of a web server that handles one request at a time.
- Suitable for understanding the fundamentals of web server operations.
- Use Case: Ideal for learning purposes or scenarios with minimal concurrent requests.
- An advanced implementation where each request is handled in a separate thread.
- Improves concurrency by enabling multiple client requests to be processed simultaneously.
- Use Case: Suitable for moderate traffic scenarios.
- Implements a thread pool to manage a fixed number of threads.
- Efficiently handles high traffic while maintaining control over resource usage.
- Use Case: Suitable for high-concurrency environments where resource management is critical.
-
Core Concepts Covered:
- Networking with Java (using
Socket
andServerSocket
). - Multithreading.
- Thread pool management.
- Networking with Java (using
-
Performance Testing:
- The web servers' performance can be measured using Apache JMeter.
- Test scenarios can include:
- Single-user request handling.
- Simulating multiple concurrent users.
- Stress testing under heavy load.
-
Clone this repository:
git clone https://github.com/kajalchoudhary1003/MultiThreadedWebServer cd MultiThreadedWebServer
-
Navigate to the desired server folder (
SingleThreaded
,MultiThreaded
, orThreadPool
). -
Compile and run the server and client on different terminals:
javac Server.java java Server javac Client.java java Client
-
Install Apache JMeter: Download Here.
-
Create a test plan:
- Add a thread group to simulate users.
- Configure HTTP requests targeting your web server.
-
Analyze results:
- Use JMeter's graphical tools to measure response times, throughput, and error rates.
-
Compare performance:
- Test each web server implementation under similar load conditions.
- Evaluate metrics such as latency, concurrency handling, and resource usage.
Happy coding! 🚀