-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Pawel,
On 2/2/18 1:47 PM, Pawel Veselov wrote: >> On 2/1/18 6:08 PM, Pawel Veselov wrote: >>> On Thu, Feb 1, 2018 at 1:02 PM, Mark Thomas <ma...@apache.org> >>> wrote: >>>> On 01/02/18 20:57, Pawel Veselov wrote: >>>>> Hello. >>>>> >>>>> It looks like in tomcat 8 (looking at master's HEAD), the >>>>> minIdle support is broken. According to docs, minIdle >>>>> supposed to do : "The minimum number of established >>>>> connections that should be kept in the pool at all times. >>>>> The connection pool can shrink below this number if >>>>> validation queries fail." >>>>> >>>>> I see that pool cleaner thread checks if the minIdle is >>>>> *less* than pool size, and only then invokes checkIdle(). >>>>> checkIdle() then will remove(!) connections from idle pool >>>>> until the value drops down to minIdle. But I don't see any >>>>> code that will add connections when minIdle is not met, and >>>>> the documentation suggests that that's the intent. >>>>> >>>>> Am I misunderstanding something? Is there a way to keep a >>>>> level of connections in the pool? I don't want to have >>>>> initialSize control that, as I need to at 0, to prevent >>>>> failures during pool initialization... >>>> But that is what initial size is for. >>> >>> Indisputably so. However, that would be the only other way to >>> achieve this, as long as the database connection don't die. >> >> What is the problem with failures during pool initialization? > > ConnectionPool.init() attempts to borrow initialSize worth of > connections. Imagine your database server is having problems at > this time. This will make init() fail, and the pool creation fail, > and your webapp is dead in the water after that Is it? Does init() in fact fail? Which pol are you talking about? If your webapp needs the pool to be working on startup, then delaying the pool-initialization until "later" will only delay it a few ms. > it's unlikely that there are mechanisms to attempt to recreate the > connection pool. The connection pool is just fine. It just doesn't contain any connection s. > This complicates automatic recovery. An existing pool can recover > easily, once the database is back online after a failure, the > connections will be vended normally. I would expect that any pool would recover when the database becomes available again, regardless of when the first connection was attempted. >> If you don't want the pool to make initialSize connections when >> it starts, when DO you want the pool to create those connections? >> During the first "cleaning"? > > I don't have strong expectations on exactly when the pool is to be > inflated. minIdle suggests that it should happen at some point, may > be that can be "cleaning", though this thread should probably then > be renamed as "maintenance". If not inflated in time, then any > requested connection will populate the pool, that's already what > ends up going on in my case. > > In all cases, I think that either minIdle should be reimplemented, > or at least the documentation should be changed from saying "The > minimum number of established connections that should be kept in > the pool at all times" to "Minimum idle connections that will > remain in the pool after cleaning", with a note that idle > connections are not created by the pool itself to fulfill that > amount. This may simply be an issue of semantics. When I read "min idle", I have no expectations that the pool will pro-actively create new (idle!) connections just to put them into the pool. As Mark said, that's what "initial size" is for. > The reason prefer the pool to auto-saturate, is that so sudden > demand for high amount of database connections doesn't require a > lot of new connections to be established, as that's the slowest > part of the process. Sorry, you can't have it both ways: don't create connections in advance, but create connections in advance "just in case". What you are describing is what I call "do-what-I-mean semantics" which means that you (YOU, a human) always "know what you mean" but you can't articulate the heuristic that you use to make decisions in any way that can be programmed. (This is a favorite requirements-model of Marketing, Design, and Sales teams.) - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlp05EodHGNocmlzQGNo cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFjkyQ/+KO6QQ00LE9ZxEjjt Sxw9fczfJiJ4ToEPGGTQlX9Xr+EQr8Jj55p/djr1v20oXqYYGXr/UZD54Pf8m5Cw wpXadAj83nnafqrJ5lV5voK+Hn8T/B7/6TruK3AWKs1/nQuQ6iQWkm2+YCBndMTv cxeMFrt8FubrvOLVwVKYOfJWAN/JiE3L2SKM+jUAX/vexxdjc21xmJULJPmar2fh +ZalpkeqaM98KnV+7LM97DDIW479I7g2uQvLaM969vqgcHCCeuv9Yn8cPQHioFpM j9Er1thojAZ6yZG5rD0MZpxqz5JODNLnKDxH5oqdyJMdv8EXKCQbj4y1tvCO4BKn ZH7bsEZKc2CWtEeyQYx/xrffnRGcJv9FQOaUrAl8C9VBOtbnL8yOrekIDfySaHf4 Lqoy3FhveybAvgwTOTS7sJEtdxGjlp8RS0jzpQZuv/9ioIVCxGL16VVJK1YMCTmv x2FMvmQ4RMbUepAaLMaWYLMEAaQkCbcJ1W4iW1QC+jJ1b7Fq+y7few/TGe4dfB4J /danPe5NbtfQ0oft3xHiKRT2Ixejy2umaOPNEGNQTM0SAddR5PIgiVMIKGQ6MGc7 Bi2psogUXqXtvL32VnOKer0/OiUxFPks1coufHFXzXwNad0s6DQnzwjKyis877// rlCEjE5OrFyGdrlcBVjqf9+iPjs= =hyXp -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org