Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧵 Java Socket Server Performance Test: Single Thread vs Multi-thread vs Thread Pool

This project is a hands-on demonstration of different Java server concurrency models using sockets:

  • Single-threaded Server
  • Multi-threaded Server
  • Thread Pool Server

All implementations were tested using Apache JMeter under high request loads (up to 10,000 requests per minute). Performance results are included with screenshots.


⚙️ Technologies

  • Java 8+
  • Apache JMeter
  • Java Networking (Sockets)
  • Java Concurrency (Threads, ExecutorService)

🚀 Server Types

1. 🔹 Single-threaded Server

  • Handles one client at a time
  • Good for simple or controlled environments
  • Efficient at low traffic

✅ Test Result:

  • Able to handle 10,000 requests/min successfully.

📸 Screenshot Screenshot 2025-06-09 142644

Screen.Recording.2025-06-09.142723.mp4

2. ❌ Multi-threaded Server (New Thread per Client)

  • Spawns a new thread for each client connection
  • Under high load, system runs out of resources

❌ Test Result:

  • Fails completely at 10,000 RPM
  • No successful requests

📸 Screenshot Screenshot 2025-06-09 144111

Screen.Recording.2025-06-09.144742.mp4

3. ✅ Thread Pool Server

  • Uses Executors.newFixedThreadPool()
  • Limits the number of threads
  • Handles high load efficiently and safely

✅ Test Result:

  • Smooth performance under high load
  • 100% success rate with 10,000+ RPM

📸 Screenshot Screenshot 2025-06-09 145159

Untitled.video.-.Made.with.Clipchamp.mp4

🧪 JMeter Load Testing

Test Config:

  • 10,000 requests per minute
  • 100 concurrent threads
  • 1-minute ramp-up

Metrics Tracked:

  • % Success
  • Avg. Response Time
Server Type Success Rate Notes
Single Thread ✅ 100% Processes one request at a time
Multi Thread ❌ 0% Crashed due to thread exhaustion
Thread Pool (10) ✅ 100% Efficient concurrency + resource control

💻 How to Run

🔧 Compile All Java Files

javac Server.java Client.java

🧵 Run Single Thread Server
cd single_thread
java Server

🔁 Run Multi Thread Server
cd multi_thread
java Server

🧠 Run Thread Pool Server
cd thread_pool
java Server

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages