DBCP connection pool settings on Tomcat
I use a connection pool on tomcat for my java web application.
Connections tomcat created was not what I had in mind.
Do I misunderstand properties initialSize, maxTotal, maxIdle, minIdle ?
Tomcat 8.0.48/PostgreSQL 9.4.9
My connection pool setting on Tomcat is;
<Resource name="jdbc/postgres_test" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://hostname:5432/sss_test"
username="sss_test"
password=""
initialSize="10"
maxTotal="10"
maxIdle="10"
minIdle="0"
maxWaitMillis="10000"
testOnBorrow="true"
validationQuery="select 1"
timeBetweenEvictionRunsMillis="5000"/>
Then I checked connections by sql on psql, It was like below,
(same as using netstat command)
sss_test=> SELECT count(client_addr) FROM pg_stat_activity group by client_addr;
client_addr | count
--------------+-------
A | 30
I expected 10 connections but it was 30.
java tomcat apache-commons-dbcp
|
show 1 more comment
I use a connection pool on tomcat for my java web application.
Connections tomcat created was not what I had in mind.
Do I misunderstand properties initialSize, maxTotal, maxIdle, minIdle ?
Tomcat 8.0.48/PostgreSQL 9.4.9
My connection pool setting on Tomcat is;
<Resource name="jdbc/postgres_test" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://hostname:5432/sss_test"
username="sss_test"
password=""
initialSize="10"
maxTotal="10"
maxIdle="10"
minIdle="0"
maxWaitMillis="10000"
testOnBorrow="true"
validationQuery="select 1"
timeBetweenEvictionRunsMillis="5000"/>
Then I checked connections by sql on psql, It was like below,
(same as using netstat command)
sss_test=> SELECT count(client_addr) FROM pg_stat_activity group by client_addr;
client_addr | count
--------------+-------
A | 30
I expected 10 connections but it was 30.
java tomcat apache-commons-dbcp
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Rather than printing the count, what does theclient_addr
look like - same?
– Scary Wombat
Nov 13 '18 at 6:50
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00
|
show 1 more comment
I use a connection pool on tomcat for my java web application.
Connections tomcat created was not what I had in mind.
Do I misunderstand properties initialSize, maxTotal, maxIdle, minIdle ?
Tomcat 8.0.48/PostgreSQL 9.4.9
My connection pool setting on Tomcat is;
<Resource name="jdbc/postgres_test" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://hostname:5432/sss_test"
username="sss_test"
password=""
initialSize="10"
maxTotal="10"
maxIdle="10"
minIdle="0"
maxWaitMillis="10000"
testOnBorrow="true"
validationQuery="select 1"
timeBetweenEvictionRunsMillis="5000"/>
Then I checked connections by sql on psql, It was like below,
(same as using netstat command)
sss_test=> SELECT count(client_addr) FROM pg_stat_activity group by client_addr;
client_addr | count
--------------+-------
A | 30
I expected 10 connections but it was 30.
java tomcat apache-commons-dbcp
I use a connection pool on tomcat for my java web application.
Connections tomcat created was not what I had in mind.
Do I misunderstand properties initialSize, maxTotal, maxIdle, minIdle ?
Tomcat 8.0.48/PostgreSQL 9.4.9
My connection pool setting on Tomcat is;
<Resource name="jdbc/postgres_test" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://hostname:5432/sss_test"
username="sss_test"
password=""
initialSize="10"
maxTotal="10"
maxIdle="10"
minIdle="0"
maxWaitMillis="10000"
testOnBorrow="true"
validationQuery="select 1"
timeBetweenEvictionRunsMillis="5000"/>
Then I checked connections by sql on psql, It was like below,
(same as using netstat command)
sss_test=> SELECT count(client_addr) FROM pg_stat_activity group by client_addr;
client_addr | count
--------------+-------
A | 30
I expected 10 connections but it was 30.
java tomcat apache-commons-dbcp
java tomcat apache-commons-dbcp
edited Nov 13 '18 at 6:52
Jes
asked Nov 13 '18 at 5:42
JesJes
12
12
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Rather than printing the count, what does theclient_addr
look like - same?
– Scary Wombat
Nov 13 '18 at 6:50
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00
|
show 1 more comment
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Rather than printing the count, what does theclient_addr
look like - same?
– Scary Wombat
Nov 13 '18 at 6:50
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Rather than printing the count, what does the
client_addr
look like - same?– Scary Wombat
Nov 13 '18 at 6:50
Rather than printing the count, what does the
client_addr
look like - same?– Scary Wombat
Nov 13 '18 at 6:50
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274536%2fdbcp-connection-pool-settings-on-tomcat%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274536%2fdbcp-connection-pool-settings-on-tomcat%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are they active connections? what is your query?
– user7294900
Nov 13 '18 at 6:03
Rather than printing the count, what does the
client_addr
look like - same?– Scary Wombat
Nov 13 '18 at 6:50
@user7294900 They were all idle connections. It was just after server started.
– Jes
Nov 13 '18 at 6:54
@Scary Wombat Sorry, I edited my sql it was wrong, client_addr was same!
– Jes
Nov 13 '18 at 6:55
See stackoverflow.com/questions/13236160/…
– user7294900
Nov 13 '18 at 7:00