I am using hikari with spring boot, local testing I can see 50 active connections. After I deployed to cloud foundry , I am only able to see 10 active connections.
spring.datasource.hikari.maximum-pool-size=50
Seems like cloud foundry bind service is trying to overwrite my application's configuration. How can configure this number in cloud foundry?
maybe someone get help from this link, it says if you are running serious application in production , you need to configure DataSourceConfiguration
https://spring.io/blog/2015/04/27/binding-to-data-services-with-spring-boot-in-cloud-foundry
I had to look up Hikari. According to this article it is a jdbc connection pool.
I am assuming then, you deployed Hikari as an app within Cloud Foundry and created a CUPS service from it. Is that correct?
You cannot modify the service thru the CUPS definition. It is only creating you an instance of that service.
Try setting the pool size either in the
bootstrap.yml
or by setting environment variables on the Hikari app to pass the default values. You may need to tweak the app to accept those variables at runtime.If that doesn't work, you may have to create your own service broker, or generate a tile. That would give you options to manipulate the service.
Hope this helps!
If you are including
spring-boot-starter-cloud-connectors
in your project, then the Spring Boot database properties aren't used. Spring Cloud Connectors will create and configure theDatasource
bean automatically, unless you write the Java code to manually configure it.As you found in the Connectors docs, you can write code like this to configure the connection properties, including pool size.
If you want to use Boot properties instead of writing code like this, you can remove
spring-boot-starter-cloud-connectors
from your project and configure the Boot properties using thevcap
properties provided by Boot when apps are run on CF. Yourmaximum-pool-size
property should be honored if you configure the connection in this way.