@shinyaz

Spring Boot + HikariCP warmup helps even with node-based ElastiCache

When using the JDBC Wrapper's Remote Query Cache Plugin with node-based ElastiCache (TLS enabled), plain JDBC tests showed no initial timeout — warmup was unnecessary (Article 3).

But through Spring Boot + HikariCP, the first request without warmup took 2443ms. HikariCP's connection pool initialization + TLS handshake + cache plugin initialization add up.

Adding an ApplicationRunner that sends a dummy query to pre-initialize everything brought the first request down to 264ms.

Java
@Component
public class CacheWarmupRunner implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        try (Connection conn = dataSource.getConnection();
             Statement stmt = conn.createStatement();
             ResultSet rs = stmt.executeQuery("/* CACHE_PARAM(ttl=1s) */ SELECT 1")) {
            rs.next();
        }
        Thread.sleep(5000);
    }
}

"No warmup needed for node-based" only applies to plain JDBC. In Spring Boot + HikariCP, warmup is recommended regardless of ElastiCache configuration.

Share this post

Shinya Tahara

Shinya Tahara

Solutions Architect @ AWS

I'm a Solutions Architect at AWS, providing technical guidance primarily to financial industry customers. I share learnings about cloud architecture and AI/ML on this site.The views and opinions expressed on this site are my own and do not represent the official positions of my employer.