[Pgpool-general] Confused about JDBC and load balancing

Matt Solnit msolnit at soasta.com
Wed Jul 20 15:58:45 UTC 2011


Hi everyone.  I'm trying to understand why load balancing doesn't work with the PostgreSQL JDBC driver, and what (if anything) can be done about it.  I have to admit, I find the documentation a bit confusing.  Here is what it currently says at http://pgpool.projects.postgresql.org/pgpool-II/doc/pgpool-en.html:

    "Note: the JDBC driver has an autocommit option. If autocommit is false, the JDBC driver sends "BEGIN" and "COMMIT" by itself. So pgpool cannot do any load balancing. You need to call setAutoCommit(true) to enable autocommit."

And yet, a recent post to this mailing list (http://pgfoundry.org/pipermail/pgpool-general/2011-July/003819.html) contradicts this, and says that recent versions of pgpool-II can handle explicit transactions.  And the flow chart (http://pgpool.projects.postgresql.org/pgpool-II/doc/where_to_send_queries.pdf) seems to say the same thing.

Even more confusing is the fact that it *does* seem to work once in a while.  I'm currently using pgpool-II 3.0.4, with PostgreSQL 9.0.2 in streaming replication mode, and JDBC driver.  When I enable statement logging in both pgpool-II and PostgreSQL, I can see that a very small number queries do go to the slave.  I have not been able to figure out any pattern to this.

I would really love to understand more about what is going on.  Any help would be sincerely appreciated.

Sincerely,
Matt Solnit <msolnit at soasta.com>


More information about the Pgpool-general mailing list