The caffeine-fueled Java web server that keeps pace with nginx in our latency and throughput tests.
Virtual threads, Undertow guts, obsessive profiling, and now a built-in metrics dashboard.
mvn clean package
java -jar target/caffeind-0.1.0-SNAPSHOT.jar --metrics --dir ./public
Static files appear at http://localhost:8080. The dashboard lives at http://localhost:9090/, JSON at /metrics.
server:
host: 0.0.0.0
port: 8080
httpsPort: 8443
vhosts:
- domains: ["*"]
documentRoot: ./public
routes:
- path: "/*"
handler: optimized-static
metrics:
enabled: true
port: 9090
path: "/metrics"
logging:
startupLevel: INFO
steadyStateLevel: WARN
access:
perVhost: true
directory: logs/access
error:
perVhost: true
directory: logs/error
Need to rotate or truncate logs on demand? Run caffeind logging rotate --target access (or hit /admin/logging on the metrics listener) and keep the service online.
java -jar target/caffeind-0.1.0-SNAPSHOT.jar caf-feind.yml
Point Prometheus at `/metrics` or keep things light with the HTML view—both derive from the same collector.
- path: "/*"
handler: optimized-static
root: /var/www/html
- path: "/*.php"
handler: fastcgi
upstream: 127.0.0.1:9000
- path: "/api/*"
handler: reverse-proxy
upstream: http://backend:8080
- path: "/health*"
handler: health
Endpoints: /health, /health/live, /health/ready
defaults:
tls:
enabled: true
provider: acme
acme:
email: admin@example.com
domains:
- example.com
- "*.example.com"
challengeType: http-01
renewBeforeDays: 28
middleware:
security:
enabled: true
compression:
enabled: true
CafFeind provisions and renews certificates, reloads them live, and publishes TLS metrics so you always know which cipher suites your clients prefer.
java \
-Xms2G -Xmx2G \
-XX:+UseParallelGC \
-XX:+UseCompactObjectHeaders \
-jar target/caffeind-0.1.0-SNAPSHOT.jar caf-feind.yml
export CAF_FEIND_SERVER_PORT=9090
export CAF_FEIND_CACHE_SIZE=20000
java -jar target/caffeind-0.1.0-SNAPSHOT.jar
middleware:
caching:
enabled: true
maxSize: 10000
ttlSeconds: 600
rateLimit:
enabled: true
requestsPerSecond: 150
metrics:
enabled: true