[Geoserver-devel] geoserver 1.6.3/4 and connection pool

Hey all!

Ok, here's the deal:

I downloaded geoserver 1.6.3 (same goes for 1.6.4) war and oracle plugin.
Then i created an oracle data store and then feature type. All went well and
i was able to make requests (getmap, getfeature...)

But then i noticed (in database administration tool, network monitor) that
geoserver was making connections to the database very often (no SQLs, just
connect/disconnect (very simple packets) ). This happened every ~~20 seconds
even if GS was perfectly idle (no requests were being made). So i loaded
1.6.3 source into eclipse and debugged a little. I discovered where all this
connection to the database come from: the GenericObjectPool from
commons-dbcp-1.2.2.

The function org.geotools.data.jdbc.datasource.buildDefaultDataSource(...)
creates a datasource with hardcoded
dataSource.setMinEvictableIdleTimeMillis(1000 * 20);

So my question is: why is this propery set to 20 seconds? It bothers me
since it creates sooo many connections to the database (at least they get
closed properly). What would happen if i would to set this val to lets say
-1?

p.s.

In GS 1.5.x this wasn't happening.
--
View this message in context: http://www.nabble.com/geoserver-1.6.3-4-and-connection-pool-tp18773300p18773300.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

GeoUser ha scritto:

Hey all!

Ok, here's the deal:

I downloaded geoserver 1.6.3 (same goes for 1.6.4) war and oracle plugin.
Then i created an oracle data store and then feature type. All went well and
i was able to make requests (getmap, getfeature...)

But then i noticed (in database administration tool, network monitor) that
geoserver was making connections to the database very often (no SQLs, just
connect/disconnect (very simple packets) ). This happened every ~~20 seconds
even if GS was perfectly idle (no requests were being made). So i loaded
1.6.3 source into eclipse and debugged a little. I discovered where all this
connection to the database come from: the GenericObjectPool from
commons-dbcp-1.2.2.

The function org.geotools.data.jdbc.datasource.buildDefaultDataSource(...) creates a datasource with hardcoded
dataSource.setMinEvictableIdleTimeMillis(1000 * 20);

So my question is: why is this propery set to 20 seconds? It bothers me
since it creates sooo many connections to the database (at least they get
closed properly). What would happen if i would to set this val to lets say
-1?

p.s.

In GS 1.5.x this wasn't happening.

My understanding of that setting was that it would not kill
connections from the pool when the number is equal to the minimum you set in the configuration page. The default is 4. Does the connection go
lower than this in your case?

Cheers
Andrea

In the Process Explorer i can see that the GS is connected to Oracle with 4
connections. And after a few minutes of running GS idle there have been over
200 "connect->send some small package to oracle->disconnect" actions. Is
that normal? (Over a day 1 GS may accumulate over 10.000 of this actions)
--
View this message in context: http://www.nabble.com/geoserver-1.6.3-4-and-connection-pool-tp18773300p18776335.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

GeoUser ha scritto:

In the Process Explorer i can see that the GS is connected to Oracle with 4
connections. And after a few minutes of running GS idle there have been over
200 "connect->send some small package to oracle->disconnect" actions. Is
that normal? (Over a day 1 GS may accumulate over 10.000 of this actions)

Nope, that's not the intended behaviour I'd say. Can you open a jira issue about it?. I guess that DBCP is trying to make sure that all the
connections in the pool are ready to be used (as opposed to stale),
but the frequency of refreshes is quite a bit too high.
Can you suggest a better one? Like, 10 minutes?
I would like to avoid exposing all the connection parameters to the
user, there are a ton...

Cheers
Andrea

The documentation for CommonsPoolTargetSource states:

setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)

    Set the minimum time that an idle object can sit in the pool before it
becomes subject to eviction. Default is 1800000 (30 minutes).

    Note that eviction runs need to be performed to take this setting into
effect.

    See Also:
        setTimeBetweenEvictionRunsMillis(long),
GenericObjectPool.setMinEvictableIdleTimeMillis(long)

Would this be usefull?
--
View this message in context: http://www.nabble.com/geoserver-1.6.3-4-and-connection-pool-tp18773300p18776669.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

GeoUser ha scritto:

The documentation for CommonsPoolTargetSource states:

setMinEvictableIdleTimeMillis

public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)

    Set the minimum time that an idle object can sit in the pool before it
becomes subject to eviction. Default is 1800000 (30 minutes).

    Note that eviction runs need to be performed to take this setting into
effect.

    See Also:
        setTimeBetweenEvictionRunsMillis(long),
GenericObjectPool.setMinEvictableIdleTimeMillis(long)

Would this be usefull?

Sure thing... which means, I should just remove the line setting the
eviction time. Did you open the issue report on jira.codehaus.org?
Cheers
Andrea

Not yet, you can do it if you wish.
--
View this message in context: http://www.nabble.com/geoserver-1.6.3-4-and-connection-pool-tp18773300p18777294.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.