| From: | Sérgio Saquetim <sergiosaquetim(at)gmail(dot)com> | 
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org | 
| Cc: | Rafael dos Santos Silva <xfalcox(at)gmail(dot)com> | 
| Subject: | Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver | 
| Date: | 2012-10-18 04:16:32 | 
| Message-ID: | d2b756c0-cb16-4a4b-a893-33042a2d28a9@googlegroups.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
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(at)gmail(dot)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(at)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(dot)shower(at)gmail(dot)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(at)postgresql(dot)org)
> 
> To make changes to your subscription:
> 
> http://www.postgresql.org/mailpref/pgsql-jdbc
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Craig Ringer | 2012-10-18 09:03:38 | Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver | 
| Previous Message | Michael Daines | 2012-10-17 20:46:07 | PGCopyOutputStream Doesn't Hold Connection |