A high-performance, event-driven, multithreaded HTTP 1.1 server built with Netty and Java.
PrimRoseHTTP is designed for low-level control, high concurrency, and Prometheus-compatible metrics, with a browser-friendly dashboard.
- Non-blocking, event-driven architecture using Netty
- Multi-handler pipeline:
/→ Index page/hello→ Hello World/about→ Developer Information/metrics→ Prometheus metrics/metrics-dashboard→ Live HTML metrics dashboard with auto-refresh and charts- All other paths → 404 Not Found
- Metrics monitoring:
- Total HTTP requests
- Active connections
- Browser-friendly dashboard using plain javascript
- Unit-tested using JUnit 5 and Netty EmbeddedChannel
- Maven build with Shade plugin for runnable fat JAR
- Javadoc generation for full documentation
- Java 17+
- Maven 3.6+
git clone https://github.com/SouradipPatra7904/PrimRoseHTTP
cd PrimRoseHTTPmvn clean packageThis generates a runnable fat JAR:
target/primrose_http_server-1.0-SNAPSHOT.jar
Default port 8080:
java -jar target/primrose_http_server-1.0-SNAPSHOT.jarCustom port:
java -jar target/primrose_http_server-1.0-SNAPSHOT.jar 9090- Index: http://localhost:8080/
- Hello World: http://localhost:8080/hello
- Prometheus metrics: http://localhost:8080/metrics
- Browser dashboard: http://localhost:8080/metrics-dashboard
- 404 Not Found: any other path
mvn clean test- All handlers are tested using Netty
EmbeddedChannel /metricsendpoint is fully covered
Prometheus-compatible metrics:
# HELP http_total_requests Total number of HTTP requests
# TYPE http_total_requests counter
http_total_requests 10
# HELP http_active_connections Current number of active connections
# TYPE http_active_connections gauge
http_active_connections 2
Browser dashboard:
- Displays metrics in bar charts
- Auto-refreshes every 5 seconds
- Shows both total requests and active connections
- Includes link to raw
/metricsendpoint
- Maven Shade Plugin creates a runnable fat JAR
- Javadoc plugin generates API documentation:
mvn javadoc:javadoc- Netty EventLoopGroup for multi-threaded, non-blocking IO
- Pipeline design pattern for modular request handling
- FullHttpRequest aggregation using
HttpObjectAggregator - Atomic metrics for thread-safe counters
- EmbeddedChannel for unit testing without a live server
- Chart.js integration for live metrics visualization
- Prometheus exposition format for observability
- Maven build lifecycle with Surefire, JaCoCo, and Shade
application.propertiesholds configurable parameters:- Server port
- Max connections
- Optional timeouts
.gitignoreexcludes sensitive files and build directories- A sample file
application.properties.exampleis provided for reference
- Metrics endpoints are safe for Prometheus scraping and human-friendly viewing
- The pipeline order ensures
/metricsand/metrics-dashboardare handled before other handlers - Auto-refresh dashboard makes it easy to monitor server activity in real time
PrimRoseHTTP combines low-level performance with developer-friendly metrics and testing, making it a solid foundation for high-concurrency HTTP services.