You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Sébastien Pérès-Labourdette <se...@omerin.com> on 2019/02/07 14:32:53 UTC

HikariCP & Cayenne

Hi all.

I wish i could delegate connection pooling to this guy.
Anybody did this before ?

Any howto to achieve that ?

- Sébastien


Re: HikariCP & Cayenne

Posted by Sébastien Pérès-Labourdette <se...@omerin.com>.
Guys, this community / list is frightening fast and efficient.

Thanks Maik
Just like that.

--
Sébastien

------------------------------------------------------------------------
*De :* 	Maik Musall <ma...@selbstdenker.ag>
*Envoyé :* 	Jeudi, 07/02/2019 15:45 (PM +0100)
*À :* 	Apache Cayenne <us...@cayenne.apache.org>
*Objet :* 	Re: HikariCP & Cayenne




> Hi,
>
> you mean something like this?
>
> ServerRuntimeBuilder srtBuilder = ServerRuntime.builder();
> HikariConfig config = new HikariConfig();
> config.setJdbcUrl( Application.getJdbcConn().jdbcUrl() );
> config.setMaximumPoolSize( 24 );// default is 10, see see
> https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
> HikariDataSource dataSource = new HikariDataSource( config );
> srtBuilder= srtBuilder.dataSource( dataSource);
>
> Maik
>
>
>
>> Am 07.02.2019 um 15:32 schrieb Sébastien Pérès-Labourdette
>> <sebastien.peres-labourdette@omerin.com
>> <ma...@omerin.com>>:
>>
>> Hi all.
>>
>> I wish i could delegate connection pooling to this guy.
>> Anybody did this before ?
>>
>> Any howto to achieve that ?
>>
>> - Sébastien
>>
>

Re: HikariCP & Cayenne

Posted by Maik Musall <ma...@selbstdenker.ag>.
Hi,

you mean something like this?

	ServerRuntimeBuilder srtBuilder = ServerRuntime.builder();
	HikariConfig config = new HikariConfig();
	config.setJdbcUrl( Application.getJdbcConn().jdbcUrl() );
	config.setMaximumPoolSize( 24 );	// default is 10, see see https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
	HikariDataSource dataSource = new HikariDataSource( config );
	srtBuilder = srtBuilder.dataSource( dataSource );

Maik



> Am 07.02.2019 um 15:32 schrieb Sébastien Pérès-Labourdette <se...@omerin.com>:
> 
> Hi all.
> 
> I wish i could delegate connection pooling to this guy.
> Anybody did this before ?
> 
> Any howto to achieve that ?
> 
> - Sébastien
> 


Re: HikariCP & Cayenne

Posted by Sébastien Pérès-Labourdette <se...@omerin.com>.
Thanks Andrus.

We are facing a "java.lang.OutOfMemoryError: unable to create new native
thread" on a cayenne call under tomcat.
Need to dig into that, using JMX to monitor stuff.... HikariCP quite
useful for such task.

And i forgot to mention that this pre-production tomcat instance is
running cayenne ..... 3.1.2.
So no ServerRuntime.builder() available for this case.

--
Sébastien.



------------------------------------------------------------------------
*De :* 	Andrus Adamchik <an...@objectstyle.org>
*Envoyé :* 	Jeudi, 07/02/2019 15:47 (PM +0100)
*À :* 	User <us...@cayenne.apache.org>
*Objet :* 	Re: HikariCP & Cayenne




> Hi Sébastien,
>
> Cayenne works with any DataSource, including HikariCP. 
>
> Some environments support it out of the box. E.g. Bootique [1], where you'd drop "bootique-jdbc-hikarcp" in your POM [2], and configure the connection info in the YAML [3], and off you go.
>
> In the most general case, you create an instance of com.zaxxer.hikari.HikariDataSource on your own, and pass it over to Cayenne runtime builder:
>
> HikariDataSource ds = new HikariDataSource();
> ds.setJdbcUrl("jdbc:mysql://localhost:3306/db");
> ds.setUsername("u");
> ds.setPassword("p");
>
> ServerRuntime cayenne = ServerRuntime.builder().dataSource(ds).build()
>
> Andrus
>
> [1] https://github.com/bootique-examples/bootique-cayenne-demo
> [2] https://github.com/bootique-examples/bootique-cayenne-demo/blob/master/pom.xml#L56
> [3] https://github.com/bootique-examples/bootique-cayenne-demo/blob/master/src/main/resources/config.yml#L2
>
>> On Feb 7, 2019, at 5:32 PM, Sébastien Pérès-Labourdette <se...@omerin.com> wrote:
>>
>> Hi all.
>>
>> I wish i could delegate connection pooling to this guy.
>> Anybody did this before ?
>>
>> Any howto to achieve that ?
>>
>> - Sébastien
>>

Re: HikariCP & Cayenne

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Sébastien,

Cayenne works with any DataSource, including HikariCP. 

Some environments support it out of the box. E.g. Bootique [1], where you'd drop "bootique-jdbc-hikarcp" in your POM [2], and configure the connection info in the YAML [3], and off you go.

In the most general case, you create an instance of com.zaxxer.hikari.HikariDataSource on your own, and pass it over to Cayenne runtime builder:

HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl("jdbc:mysql://localhost:3306/db");
ds.setUsername("u");
ds.setPassword("p");

ServerRuntime cayenne = ServerRuntime.builder().dataSource(ds).build()

Andrus

[1] https://github.com/bootique-examples/bootique-cayenne-demo
[2] https://github.com/bootique-examples/bootique-cayenne-demo/blob/master/pom.xml#L56
[3] https://github.com/bootique-examples/bootique-cayenne-demo/blob/master/src/main/resources/config.yml#L2

> On Feb 7, 2019, at 5:32 PM, Sébastien Pérès-Labourdette <se...@omerin.com> wrote:
> 
> Hi all.
> 
> I wish i could delegate connection pooling to this guy.
> Anybody did this before ?
> 
> Any howto to achieve that ?
> 
> - Sébastien
>