17 messages in com.mysql.lists.javaRe: MySQL connection pooling
FromSent OnAttachments
Berlin Brown30 Jan 2004 07:16 
Dave Newton30 Jan 2004 07:46 
Berlin Brown30 Jan 2004 07:51 
Steve Forsyth30 Jan 2004 10:17 
Berlin Brown30 Jan 2004 10:30 
Mark Matthews30 Jan 2004 15:33 
Jim02 Feb 2004 12:58 
Mark Matthews02 Feb 2004 13:41 
Berlin Brown02 Feb 2004 13:49 
Jim02 Feb 2004 16:41 
Mark Matthews02 Feb 2004 17:17 
Will Glass-Husain02 Feb 2004 17:31 
Dave Newton02 Feb 2004 17:51 
Tom Michalek03 Feb 2004 19:59 
Mark Matthews04 Feb 2004 05:27 
Jim05 Feb 2004 06:32 
vpen...@hoovers.com05 Feb 2004 07:42 
Subject:Re: MySQL connection pooling
From:Will Glass-Husain (wgl@forio.com)
Date:02/02/2004 05:31:23 PM
List:com.mysql.lists.java

Hi,

You can force single-threading mode by having the servlet implement javax.servlet.SingleThreadModel. This is rather unusual, though.

As a side note, implementing connection pooling with DBCP wasn't really that hard. Took me a couple of hours to figure out the basics the first time. The Jakarta docs could be a bit better for first time users. But the examples are helpful, e.g.

http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons/dbcp/doc/ManualPoolingDriverExample.java

WILL

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Jim wrote:

First, let me thank Mark for yet another thorough and polite response. It was very illuminating to me who has not dealt extensively with load/performance issues.

However, I believe I really have a low load situation. At most 1000 users each of which will use the website (running on a dedicated server) perhaps a total of 20 minutes each over an academic semester. If I ever get 50 concurrent users, I'll be suprised. Or should I just never think any such application can be trusted to be low load.

Perhaps I suffer from another dilusion also. My impression is that by accessing through servlets (6 in all) the web server would throttle down database activity since there would be only one instance of each servlet (each with one connection). The server would queue client requests, passing them off the the servlet as the servelet finished the service routine for the preceding request.

I would appreciate any tutelage on this point. (Then I'll drop it.)

Thanks,

Jim Cant

The servlet spec allows implementors a little bit of leeway on how 'connections' are dispatched to servlet instances (except for servlet developers, who must assume their servlets are accessed in a multithreaded fashion), but in any implementation that I've seen (Tomcat, Jetty, WebSphere, Weblogic), you'll have at least one servlet instance running on a thread for each connection until you reach some configured limit, where requests will wait for an 'idle' servlet worker thread to become available.

In the case of Tomcat for example, this limit is 75, if memory serves me correctly.

Therefore, that means (in the Tomcat example) that in any one point in time, you could only have 75 concurrent users, which would use _up_to_ 75 MySQL connections.

Regards,

-Mark - -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com

Want to swim with the dolphins? (April 14-16, 2004) http://www.mysql.com/uc2004/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAHvaytvXNTca6JD8RAvP8AJ9qrC76Fy5BO9LjBNcfQcKxCsB6OQCgif3d u5z/6EcjGP9awXy+wZOQTTg= =ziGq -----END PGP SIGNATURE-----