Link to home
Start Free TrialLog in
Avatar of aibdev
aibdev

asked on

Websphere database connection minimum pool size - 0 or 1

The websphere 6.1 application server and Oracle 10g database on our site have a firewall between with timeout of about 3 hours. The database datasource usage is purely based on user access which is restricted to working days (weekdays only). This causes the first call on the monday morning to return staleconnection (as firewall has disconnected it). My requirement is to honor the first request in case of staleconnection or pool being empty or otherwise (the first call will purge and recreate the pool).

Connection timeout      - 180 seconds  
Maximum connections - 100 connections  
Minimum connections  - 1 connections  
Reap time  seconds    - 180 seconds
Unused timeout          - 1800 seconds  
Aged timeout                  - 0 seconds  
Purge policy                  - EntirePool

To remedy this the minimum connection was reduced to 0. The above datasource connection timeouts are kept at installation defaults, whereas purge policy is updated to entirepool.

Here are a few questions I would like to ask regards to websphere connection pool.

1. Does test connection on websphere console affect connection timeout (resets it?) / affect pool (clears the staleconnections?)

2. If minimum connection size is reduced to 0, will the first connection request be returned as exception, triggering pool cleanup OR will the first request wait till pool is created assuming no delay on DB.

Do I require code change to retry connection in case of exception.

3. All the connection timeouts are within 30 mins, so after 30 mins of inactivity will the connection pools be 0, if so causing issue 2.

4. Is there any concept of keepalive database connection to get away with this entire configuration mess.  I could set a connection keepalive setting for every say 2 hours to avoid firewall drops.

(5.) Even when my min pool size was 1, I am still confused why it gave staleconnection as the connections should have gone long from the pool. Is aged timeout to be used here with specific value?

Would appreciate even if the answers are yes/no format wihtout explanation.
SOLUTION
Avatar of mustaccio
mustaccio
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aibdev
aibdev

ASKER

Hi mustaccio,

thanks for the reply, is there any way in which websphere periodically 'pings' the database. as doing this programmatically will be design hell.(timer/resource adapter or likes)

pretest connection is not useful here as you said 'WAS does not know if a connection has gone stale until ...' hence it will not call the connection till it is invoked through the code.With pretest connection my question again boils down to point 2. (will the first call return successfully with good connection OR fail triggering pool purge)
Check the manual. It will run the pretest SQL before returning the requested connection from the pool and, if necessary, re-establish the connection. There will be a small delay, obviously, because establishing a connection is expensive.
Avatar of aibdev

ASKER

Thanks m,
I will check the manual for your suggestion.

But the question that I am asking is subtly different, although it could be resoolved by your method (with overhead).

Without pretest connection setting, and with min connection of 0,
when the connection pool is empty will the first connection request be returned exception OR will it wait for the pool to build.
I feel that this questions the very basic of websphere connection pool concept
SOLUTION
Avatar of Radek Baranowski
Radek Baranowski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Clearly, when the pool is empty and a connection is requested from it, a new connection will be created, and obviously it will not be stale. By the way, "Minimum connections" is not a hard setting - there may be more or fewer connections in the pool. In other words, even if you set "Minimum connections" to 0, there's no guarantee that there will be 0 connections in the pool. You may want to set "Aged timeout" to something other than 0 as well.
Avatar of aibdev

ASKER

Thanks again baranello/mustaccio for your comments,

I understand the pool empty and new creation workflow,also I understand staleconnection issue. My question is maybe not clear.

When pool becomes zero (if at all and whenever), then will the first  request for connection return with any exception (connection not found etc) OR wait and return fresh connection (assuming no timeout due to pool creation etc).

I understand that the first request will create connections and subsequent calls will go through as expected. But it is the first request that I all care about.

Thanks again.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aibdev

ASKER

Thanks mustaccio,
I will test this out and check.
Avatar of aibdev

ASKER

Does manual testing the connection reset the underlying connection pool (purge and recreate or reset other time specific parameters)
It will probably just reset the Unused timer for the connection that was used for the test. If there is no connection available, one will be created and the pool will grow, if Max. connections is not exceeded.