DEV Community

Shubham Bhati
Shubham Bhati

Posted on

Optimize HikariCP for Dirt-Cheap VPS Hosting

If you are running a Spring Boot app on a tiny ₹100/month VPS with 1GB RAM, the default settings will crash your server. The biggest silent killer is HikariCP. By default, Spring Boot sets the maximum connection pool size to 10. If you run PostgreSQL, Redis and Spring Boot on the same cheap box, you will quickly hit memory limits.

You don't need 10 connections for low-traffic apps scaling to their first ₹1 Lakh. A pool size of 2 or 3 is more than enough to handle concurrent requests if your queries are indexed properly.

Add this to your application.properties:

spring.datasource.hikari.maximum-pool-size=3
spring.datasource.hikari.minimum-idle=2
spring.datasource.hikari.idle-timeout=30000
Enter fullscreen mode Exit fullscreen mode

This simple tweak slashes RAM usage, prevents database errors and keeps your server alive on tight budgets.

Top comments (0)