473,231 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Unix domain instead of TCP socket connections with JDBC.

Using the org.postgresql.Driver JDBC driver is it possible to connect
to Postgres using a unix domain socket instead of a TCP socket (so you
don't have to start the postmaster with -i)? Using a TCP socket
instead of a unix socket seems to slow down requests that return large
result sets by a factor of 3 on the same machine. What's the point of
all the extra CPU overhead if you're on the same machine? A
high-volume server can really do without the extra overhead. Also, for
security reasons it would be slightly nicer to run Postgres without -i
just so there's one less port popping up when you port-scan.
Nov 11 '05 #1
4 6251
fr*********@yahoo.com (Alex Martinoff) writes:
... Using a TCP socket
instead of a unix socket seems to slow down requests that return large
result sets by a factor of 3 on the same machine.


Seems like a kernel bug to me. All modern TCP stacks have shortcuts for
local connections. What platform are you on exactly?

(BTW, this is not an argument against having JDBC support unix-socket
connections; I can see security reasons for that. But there should not
be performance reasons for it.)

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #2


On 7 Sep 2003, Alex Martinoff wrote:
Using the org.postgresql.Driver JDBC driver is it possible to connect
to Postgres using a unix domain socket instead of a TCP socket (so you
don't have to start the postmaster with -i)? Using a TCP socket
instead of a unix socket seems to slow down requests that return large
result sets by a factor of 3 on the same machine. What's the point of
all the extra CPU overhead if you're on the same machine? A
high-volume server can really do without the extra overhead. Also, for
security reasons it would be slightly nicer to run Postgres without -i
just so there's one less port popping up when you port-scan.


Java does not provide an API for dealing with unix sockets. It might
be possible to create such an interface via JNI, but I doubt you'll get
a whole lot of interest from the JDBC driver developers as the postgresql
JDBC driver is a Type IV (pure java) driver.

Is this factor of 3 difference in time the difference from running psql
over unix sockets vs tcp, or is it the difference between a Java client
and psql? If it's the latter you're not really doing an apples to apples
comparison.

Kris Jurka
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #3
The tomcat developers were working on a hybrid system, that would use
unix sockets via JNI for local connections, but I'm not sure what
happened to it. Or maybe they used a named pipe instead? I really
don't know.
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #4
The tomcat developers were working on a hybrid system, that would use
unix sockets via JNI for local connections, but I'm not sure what
happened to it. Or maybe they used a named pipe instead? I really
don't know.
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Gabriele Farina | last post by:
Hi, I'd like to manage multiple socket connection without having to use Threads. I'd like to manage every connection when it is returned from socket_Accept(), without having to wait for the...
1
by: afalanga | last post by:
Hi, I seem to be unable to connect to my PostgreSQL database over UNIX domain sockets, i.e. pg_connect("dbname=mydb"); No matter what I do to the pg_hba.conf file, or anything else, PHP...
0
by: Joseph Dionne | last post by:
I thought I read somewhere that version 1.5 was adding support for Unix domain sockets. Has support been added as yet? Joseph
5
by: Fossie | last post by:
Hi folks, I am unable to solve the following problem, which should not be new, but I cannot find an appropriate solution anywhere: One python process ("daemon") waits for messages. Another...
1
by: Didatus | last post by:
i have a problem to send data over an unix domain socket after the socket is created i am reading data from stdin und want to send it over socket to a listener but i get an error. He can't write...
9
by: Phil Jenson | last post by:
I am try to evaluate the most efficient method of handling thousands of simultaneous TCP connects each of which remain connected to the server for hours and pass a small amount of data usually once...
2
by: Torsten | last post by:
Hi, only one simple question. Is it possible to handle socket connections with javascript? TIA Torsten
0
by: Mangabasi | last post by:
Howdy, I would like to use the Synthesis Toolkit for a demo. I downloaded the STK from http://ccrma.stanford.edu/software/stk/index.html. It seems very powerful and user friendly. There are...
1
by: wsguglielmetti | last post by:
Hi, How are you? I'm completly new in python but I know a little of C. I developed a small application in python which generate and receive some data from times in times (question of...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.