| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project demonstrates and benchmarks different approaches for making 100 REST API calls from a Java application.
The main goal is to measure the performance impact of:
The project contains both the API client and the test API server, allowing the benchmark to be reproduced locally.
java-parallel-api-benchmark/
│
├── validation-client/
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── com/test/validation_client/
│
├── validation-server/
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── com/test/validation_server/
│
└── README.md
| Java Version | Execution Model | Threads | HTTP Pool | Total Time | Improvement |
|---|---|---|---|---|---|
| Java 21 | Sequential | 1 | — | 101,741 ms | — |
| Java 21 | CompletableFuture | 10 | Default | 10,533 ms | 89.6% |
| Java 21 | CompletableFuture | 10 | 10 | 10,329 ms | 89.8% |
| Java 17 | Sequential | 1 | — | 101,672 ms | — |
| Java 17 | CompletableFuture | 10 | Default | 20,421 ms | 79.9% |
| Java 17 | CompletableFuture | 10 | 10 | 10,366 ms | 89.8% |
Test: 100 PRID validation API calls -Concurrency: 10 parallel requests -Measurement: End-to-end execution time for processing all 100 requests.
Key Observations
The results can be summarized as:
Sequential
~101.7 seconds
│
│ CompletableFuture + 10 threads
▼
Java 17 ~20.4 seconds
Java 21 ~10.5 seconds
│
│ HTTP Connection Pool(10)
▼
Java 17 ~10.4 seconds
Java 21 ~10.3 seconds
100 PRIDs
│
▼
CompletableFuture
│
▼
ExecutorService
10 threads
│
▼
RestClient
│
▼
Apache CloseableHttpClient
│
▼
PoolingHttpClientConnectionManager
│
HTTP Pool (10)
│
┌──────────────┼──────────────┐
▼ ▼ ▼
C1 C2 ... C10
│ │ │
└──────────────┼──────────────┘
▼
Validation Server
│
▼
Response
Note: These are initial benchmark results from a local/test environment. For a rigorous comparison, multiple runs with average, median, and P95 latency should be recorded.
| Back | FazBrowse Home | New Git URL |