473,780 Members | 2,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6323
fr*********@yah oo.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*******@postg resql.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*******@postg resql.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
4829
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 current running tonnection to stop. How can I do that? bye
1
3660
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 always returns things like, "Are you sure the server is running locally?", etc. What's the magic chant to connect to PostgreSQL over UNIX domain sockets? I know it's working because I can connect via psql. In case it matters, I'm using all this on...
0
3350
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
3776
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 python program ("client"), which is NOT forked off the daemon (but is on the same Linux machine), sends that message to the daemon. This of course can be nicely done with Unix domain sockets (AF_UNIX),
1
3220
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 into the socket. This is my program: #!/usr/bin/perl -w use strict; use IO::Handle;
9
2481
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 a minute. The data received is logged in a SQL Server database. The only method I have found of reading each socket requires a thread for each connection which blocks waiting for data. This appears to be very inefficient as it will result in...
2
1533
by: Torsten | last post by:
Hi, only one simple question. Is it possible to handle socket connections with javascript? TIA Torsten
0
1775
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 bindings for socket connections and TCL gui examples. I would like to get one of the demo samples work with Python/wxPython. I am including the TCL code for the drums demo (this was the shortest one). Has anybody converted this to wxPython? ...
1
14750
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 seconds) and I need to send this data to a unix domain socket (/var/run/sfp) and read the response and print on the screen.
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.