pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sérgio Saquetim <sergiosaquetim@gmail.com>
To: pgsql-jdbc@postgresql.org
Cc: Rafael dos Santos Silva <xfalcox@gmail.com>
Subject: Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver
Date: Wed, 17 Oct 2012 21:16:32 -0700 (PDT)
Message-ID: <d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com> (raw)
In-Reply-To: <CACLs3uCrjXaY94ivGQgoXDfe-2dwxwsHdPXrA3ey+eL7TPQEJA@mail.gmail.com>
References: <CACLs3uCrjXaY94ivGQgoXDfe-2dwxwsHdPXrA3ey+eL7TPQEJA@mail.gmail.com>

I can confirm the problem, it's taking about 4000ms to get a Connection. I did a simple Java class to test that:


/*
 * JavaApplication1.java
 * 
 * Criado em Oct 18, 2012, 12:40:56 AM
 * 
 * Copyright(c) 2012 Sérgio Ernesto Diniz Saquetim. Todos os direitos reservados.
 */
package javaapplication1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * [Insira a descrição da classe aqui]
 *
 * @author Sérgio Saquetim <sergiosaquetim@gmail.com>
 * @version 0.1
 * @since 0.1
 */
public class JavaApplication1 {

  /**
   * Função de entrada de execução do programa.
   *
   * @param args os argumentos da linha de comando
   */
  public static void main(String[] args) throws ClassNotFoundException, SQLException {
    Class.forName("org.postgresql.Driver");

    String url = "jdbc:postgresql://192.168.1.100/frames?user=postgres&password=postgres@mac";

    long time = System.currentTimeMillis();
    try (Connection conn = DriverManager.getConnection(url)) {
      System.out.println("Elapsed Time: "+(System.currentTimeMillis()-time));
      try (PreparedStatement pst = conn.prepareStatement("SELECT version();")) {
        try (ResultSet rs = pst.executeQuery()) {
          while (rs.next()) {
            System.out.println(rs.getString(1));
          }
        }
      }
    }
  }
}

The result using the : 9.2-1000 JDBC 4
run:
Elapsed Time: 5172
PostgreSQL 9.2.1 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00), 64-bit

Now using the 9.1-903 JDBC 4:
Elapsed Time: 50
PostgreSQL 9.2.1 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00), 64-bit

I'm getting the same results in my company what makes this Driver unusable in production. Is there any workaround? Will I get to much trouble if I use 9.1-903 JDBC 4 version driver with Postgres 9.2?

Thanks a lot!








Em sexta-feira, 5 de outubro de 2012 16h27min21s UTC-3, "emergency.shower@gmail.com"  escreveu:
> Hi,
> 
> 
> 
> after the upgrade the latest PortgreSQL 9.2-1000 JDBC 4 driver, we
> 
> discovered a severe performance degradation when connecting to 8.4,
> 
> 9.0, 9.1, and 9.2 servers.  In a test application the
> 
> DriverManager#getConnection(String, String, String) call constantly
> 
> took > 4500 ms compared to < 20 ms with the previous 9.1-903 JDBC 4
> 
> driver. This makes the driver virtually unusable in production
> 
> environments.
> 
> 
> 
> Client: Windows 2008 R2, Windows 7
> 
> Server: PostgreSQL 8.4, 9.0, 9.1, 9.2 on Linux 2.6
> 
> 
> 
> Regards,
> 
> Alex
> 
> 
> 
> 
> 
> -- 
> 
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> 
> To make changes to your subscription:
> 
> http://www.postgresql.org/mailpref/pgsql-jdbc




view thread (25+ messages)  latest in thread

Message-ID: <d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com>
Permalink:  ../d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com/
Also on:    postgresql.org/message-id/d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: sergiosaquetim@gmail.com, xfalcox@gmail.com
  Subject: Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver
  In-Reply-To: <d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com>
  References: <CACLs3uCrjXaY94ivGQgoXDfe-2dwxwsHdPXrA3ey+eL7TPQEJA@mail.gmail.com> <d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox