[OrientDB] Setting up a connection pool

490 views
Skip to first unread message

Salvatore Piccione

unread,
May 13, 2012, 11:47:55 AM5/13/12
to OrientDB ML
Hello,

the connection pool provided by OrientDB allows the configuration of its min and max size (e.g. ODatabaseDocumentPool.setup(minPoolSize, maxPoolSize)). Anyway, it seems that such settings are ignored: you can find a trivial test case at https://gist.github.com/2688929. The assertion at line 50 fails because the max size of the pool is 20 while it should be 5; this happens using the latest orientdb-1.0-SNAPSHOT. Additionally, there isn't a method that returns the min size of the pool: could it be possible to add it?

I remember that you could also define a connection pool bypassing ODatabaseXXXPool and direclty using ODabatabaseXXX as reported in this (quite old) mailing list post by Luca: https://groups.google.com/d/msg/orient-database/4eWgdz7vgQs/VusG4Ze11pcJ. Basically, the connection pool could be set up by defining two database properties: minPool (com.orientechnologies.orient.client.remote.OStorageRemote.PARAM_MIN_POOL) and maxPool (com.orientechnologies.orient.client.remote.OStorageRemote.PARAM_MAX_POOL). Is this still available?

TIA,

Salvatore

Luca Garulli

unread,
May 13, 2012, 2:06:32 PM5/13/12
to orient-...@googlegroups.com
Hi Salvatore,
to define a custom pool you have to call setup as first thing, otherwise the default pool will be used.


 private void definePool () {
        dbPool = ODatabaseDocumentPool.setup(1,5);
        ...
    }

About minPool actually is ignored by current implementation and it's always 1.

Lvc@

Salvatore Piccione

unread,
May 14, 2012, 4:33:08 AM5/14/12
to orient-...@googlegroups.com
Thanks Luca,

I see also that now the API is fluent... great! What about my second question? Is it still possible to setup a connection pool as show below?
database = new ODatabaseDocumentTx("remote:localhost/demo");
database.setProperty("minPool", 2); database.setProperty("maxPool", 5);
database
.open("admin", "admin");
Cheers,

Salvatore

2012/5/13 Luca Garulli <l.ga...@gmail.com>

Luca Garulli

unread,
May 14, 2012, 7:07:32 AM5/14/12
to orient-...@googlegroups.com
Hi,
setting those properties is not supported. You've to use the pool.

Lvc@
Reply all
Reply to author
Forward
0 new messages