Announcement Announcement Module
Collapse
No announcement yet.
c3p0 vs. dbcp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • c3p0 vs. dbcp

    Hello,

    Does anyone have any experience with either c3p0 vs. dbcp and know the pros and cons of each? The information that I've been able to find on google so far points me in the direction of c3p0. However, dbcp seems to have better support/documentation. So I'm not sure which is better.

    One thread says:
    These problems were experienced with the latest version of DBCP and
    pool. There are still some scary outstanding issues related to
    concurrency that are unresolved in DBCP's bugzilla:

    http://issues.apache.org/jira/browse/DBCP-44
    Evictor thread in GenericObjectPool has potential for deadlock

    Another says:
    "I personally prefer c3p0 mainly because it is actively maintained. There have been some discussions on each of them mainly on the Hibernate forums - try doing some search there. They are both open source though, so it is possible to extend/fix them if needed."

    I didn't have much luck searching the Hibernate mailing lists for the discussions, but I will keep looking. I am using the Spring framework and iBatis on top of a mysql database. Anyone have any suggestions comments on the pros/cons on these two packages?

    Thanks!
    Danny

  • #2
    I can't really say much about pros and cons. We used dbcp initially but had several problems, after reading various comments on other forums we tried out c3p0 and the issues went away. I've read a few posts on forums saying the same thing, but that's about as much as I have on the subject.

    Comment


    • #3
      Benchmarks and Blocking

      My experience has been that DBCP is likely to cause blocking and potential deadlocks in multithreaded environments with other synchronized resources. DBCP blocks on checkout and on checkin, C3P0 checks in asynchronously and avoids these sorts of issues.

      That being said, C3P0 needs a lot more connections to get the same job done and is, in general, a bit slower than DBCP. Here's an article I'm trying to find the time to finish which outlines some of this:

      Javatech: C3P0 vs DBCP - The Straight Dope

      Comment


      • #4
        An update

        While looking into how to configure the connection pool for an application that I have been working on (in Grails even), I was surprised/shocked to see a bunch of serious open issues related to DBCP.

        As a result, my team now uses c3p0.

        A couple of days after that decision was made I attended a SpringSource presentation on tcServer by Mark Thomas who mentioned in passing that SpringSource are developing a Tomcat connection pooling implementation:

        http://static.springsource.com/proje...cref.Help.html

        He also said that he has been contributing fixes to the open issues in DBCP - so some of the more serious issues could be going away soon.

        In the mean time I would avoid DBCP in production systems.

        Comment


        • #5
          Another link

          Just adding a link to another connection pool to try out (adding it here to complete this referenced thread): BoneCP

          (disclaimer: I'm the author)

          Comment


          • #6
            Originally posted by Darren Hicks View Post
            My experience has been that DBCP is likely to cause blocking and potential deadlocks in multithreaded environments with other synchronized resources. DBCP blocks on checkout and on checkin, C3P0 checks in asynchronously and avoids these sorts of issues.

            That being said, C3P0 needs a lot more connections to get the same job done and is, in general, a bit slower than DBCP. Here's an article I'm trying to find the time to finish which outlines some of this:

            Javatech: C3P0 vs DBCP - The Straight Dope
            I countered the same lock, but I found that it can be solved by increase count of maxactive property which default is 8 , too small to my application.

            Comment

            Working...
            X