louisthomas
6/6/2018 - 5:36 PM

PCF increase datasource connection pool

By default, connection pool is tool low. Snippet to increase pool size connection

https://www.slideshare.net/makingx/why-pcf-is-the-best-platform-for-spring-boot

@Configuration
@Profile("cloud")
public class CloudConfiguration extends AbstractCloudConfig {

    @Value("${datasource.min-pool-size:0}")
    private int minSize;

    @Value("${datasource.max-pool-size:100}")
    private int maxSize;

    @Value("${datasource.max-wait:3000}")
    private int maxWait;

    @Bean
    public DataSource dataSource() {
        PoolConfig poolConfig = new PoolConfig(minSize, maxSize, maxWait);
        return connectionFactory().dataSource(new DataSourceConfig(poolConfig, null));
    }

}