Project

General

Profile

Bug #3192

possible optimization when the database server resides on the same box as the P2J server

Added by Greg Shah over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#1 Updated by Greg Shah over 7 years ago

When the P2J server and database server run on the same UNIX/Linux system, it may be possible to use the JDBC drivers via UNIX domain sockets instead of using TCP sockets. As noted in this link, the result is generally about 30% faster:

http://momjian.us/main/blogs/pgblog/2012.html#June_6_2012

It is not clear how feasible it is to accomplish using the current drivers. There may be some support. There are reports that people have gotten it working but also that those people had to add code to make it happen. I see from https://jdbc.postgresql.org/documentation/head/connect.html that there is the socketFactory parameter to the JDBC URL and it explicitly states:

The provided value is a class name to use as the SocketFactory when establishing a socket connection. This may be used to create unix sockets instead of normal sockets. The class name specified by socketFactory must extend javax.net.SocketFactory and be available to the driver's classloader. This class must have a zero argument constructor or a single argument constructor taking a String argument. This argument may optionally be supplied by socketFactoryArg.

But then there are these other articles:

http://postgresql.nabble.com/revisiting-unix-domain-sockets-td5783697.html
http://stackoverflow.com/questions/4562471/connecting-to-local-instance-of-postgresql-with-jdbc
https://github.com/jruby/activerecord-jdbc-adapter/issues/677
https://www.postgresql.org/message-id/j1k9ss$p4m$1@dough.gmane.org

The last one proposes the addition of the socketFactory and socketFactoryArg parameters, so it may be an early pointer to the feature that does now exist. Also in that reference, it mentions the PgJdbcUnixSocketFactory class, but that class does not exist in postgresql-9.4.1207.jar and I see no obvious replacement candidate there.

Also available in: Atom PDF