Dan, On Thu, Aug 7, 2025 at 5:01 PM Daniel Schwartz <d...@danielgschwartz.com> wrote:
> Hello Chris, > > Thank you for your reply, but I'm still unsure. You seem to be implying > that I have a memory leak, i.e., many connection objects being created that > are not being closed. However, I really don't think this is happening. My > code closes each connection immediately after using it. Maybe post your code again. Last time you posted it, it was prone to leaking connections. If it hasn't changed, that is likely your problem. > > My understanding is that the only way the maximum pool size of X, whatever > that is, would be a limitation is if there was an attempt to create X+1 > simultaneous connections. When you do this in Glassfish, it outputs an > error message saying that no more connections can be created and then > crashes. You have to go back in and manually restart it. > > I believe that the essential problem, as explained in a previous email to > Rob Sargent, is that I'm getting several hundred database requests per day > from web crawlers. I just spent some time reading through my ngnix > access.log and found that the vast majority of these are from GoogleBot. > My guess it that, due to a time lag between opening and closing > connections, many connections will be opened simultaneously. This is why a > small pool size won't work. > > Also, I'm advised to not block the web crawlers because this assists with > SEO. My understanding is that you just have to live with this. > > I don't think there is an issue with my code. The only answer I can come > up with is to have a large maximum pool size, larger that the expected > number of simultaneous accesses. > There is almost definitely a problem with your code (unfortunately), or your database requests are very slow and triggered by any connection. We run servers that handle much more traffic than you are describing and make thousands of DB requests per minute, and we rarely go over 10 DB connections being used at a time. There is almost for sure something leaking in your code. This is very unlikely to be a problem with the pooling ("select isn't broken"). You are looking for unlikely causes to the problem. > > I originally wrote to this email list because I was thinking of shifting > from Glassfish to Tomcat, and was trying to learn how to do this. I think > I do know how to do this now, and might try doing this. My understanding > is that the connection pooling that works with Tomcat doesn't have that > same limitation as Glassfish, and one can have connections that exist > outside the pool. This would resolve the issue I'm currently having with > Glassfish. > > Best regards, > > Dan Schwartz > ...snip..