Can I add comments via e-mail?
ConnectorJ 3.0 & unix sockets
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > MySQL database development > ConnectorJ 3.0 & unix sockets 21 January 2004 11:26:19

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

ConnectorJ 3.0 & unix sockets

Michael McTernan 20 January 2004 19:46:49
 Hi there,

I've got Tomcat and MySQL on the same box and want them to talk using Unix
sockets to save a bit of TCP/IP overhead.

The docs say that this is not possible:

"MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as Java does
not support Unix Domain Sockets. Therefore, when MySQL Connector/J connects
to MySQL, the security manager in MySQL server will use its grant tables to
determine whether or not the connection should be allowed."

I can see that that allows a pure Java implementation, but does anyone know
if support for Unix domain sockets is planned at all?

Thanks,

Mike



--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org


Add comment
Mark Matthews 20 January 2004 20:10:30 permanent link ]
 -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael McTernan wrote:
Hi there,>
I've got Tomcat and MySQL on the same box and want them to talk using Unix> sockets to save a bit of TCP/IP overhead.>
The docs say that this is not possible:>
"MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as
Java does> not support Unix Domain Sockets. Therefore, when MySQL Connector/J
connects> to MySQL, the security manager in MySQL server will use its grant
tables to> determine whether or not the connection should be allowed.">
I can see that that allows a pure Java implementation, but does anyone
know> if support for Unix domain sockets is planned at all?

In the limited testing I've done, the JNI overhead makes Unix domain
sockets _slower_ than TCP/IP, so if you're looking for a performance
boost, you won't find it there.

Because Connector/J has pluggable socket factories, it would be
relatively straightforward to take something like this:

http://www.nfrese.n­et/software/gnu_net_­local/overview.html

And implement com.mysql.jdbc.Sock­etFactory using the Unix domain support
in the package above to get the support for Unix domain you're looking for.

Either that, or plead with Sun through the BugParade to add unix domain
socket support :)­

Regards,

-Mark


- --
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 557 2388
www.mysql.com

Want to swim with the dolphins? (April 14-16, 2004)
http://www.mysql.co­m/uc2004/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.moz­dev.org

iD8DBQFADWEFtvXNTca­6JD8RAikcAJwMTjyf2vs­NoXhwt/5Mha+7DxTb3AC­fe1sn
/jkzGpww0OoFd0U8c0c­S45U=
=lhnn
-----END PGP SIGNATURE-----

--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org


Add comment
Morten Norby Larsen 20 January 2004 20:59:59 permanent link ]
 Just out of curiousity, as I know nothing about these low-level issues:

Would you actually gain anything from Unix sockets? If I understand
correctly, using them would mean that you go through some kernel-level
drivers (i.e., no physical network interface), which is of course a big
advantage over calls across a TCP/IP layer on top of a some physical
network.

However, I would guess that if you connect through 127.0.0.1 (which is
what localhost normally maps to), then you should never get anywhere
near a physical network layer, and so the overhead is only what the
TCP/IP layer gives. The TCP/IP overhead shouldn't amount to that much,
compared to the database's disk access, or am I totally wrong here? Your
bytes are still routed through the kernel, just along a different (and
probably slightly longer) path than if you used Unix Domain Sockets.

I would love any insight into these issues!

Thanks,

Morten



Mark Matthews wrote:
-----BEGIN PGP SIGNED MESSAGE-----> Hash: SHA1>
Michael McTernan wrote:>
Hi there,>>
I've got Tomcat and MySQL on the same box and want them to talk using Unix>>sockets to save a bit of TCP/IP overhead.>>
The docs say that this is not possible:>>
"MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as>
Java does>
not support Unix Domain Sockets. Therefore, when MySQL Connector/J>
connects>
to MySQL, the security manager in MySQL server will use its grant>
tables to>
determine whether or not the connection should be allowed.">>
I can see that that allows a pure Java implementation, but does anyone>
know>
if support for Unix domain sockets is planned at all?>
In the limited testing I've done, the JNI overhead makes Unix domain> sockets _slower_ than TCP/IP, so if you're looking for a performance> boost, you won't find it there.>
Because Connector/J has pluggable socket factories, it would be> relatively straightforward to take something like this:>
And implement com.mysql.jdbc.Sock­etFactory using the Unix domain support> in the package above to get the support for Unix domain you're looking for.>
Either that, or plead with Sun through the BugParade to add unix domain> socket support :)­>
Regards,>
-Mark>
- --> Mr. Mark Matthews> MySQL AB, Software Development Manager, J2EE and Windows Platforms> Office: +1 708 557 2388> www.mysql.com>
Want to swim with the dolphins? (April 14-16, 2004)> http://www.mysql.co­m/uc2004/> -----BEGIN PGP SIGNATURE-----> Version: GnuPG v1.2.3 (MingW32)> Comment: Using GnuPG with Thunderbird - http://enigmail.moz­dev.org>
iD8DBQFADWEFtvXNTca­6JD8RAikcAJwMTjyf2vs­NoXhwt/5Mha+7DxTb3AC­fe1sn> /jkzGpww0OoFd0U8c0c­S45U=> =lhnn> -----END PGP SIGNATURE----->

--
Morten Norby Larsen morten@magisterludi­.com
Magister Ludi s.r.l. Phone: +39 02 26 11 72 80
Via Battaglia 8, I-20127 Milano, Italy Fax: +39 02 28 46 037
http://www.magister­ludi.com

--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org


Add comment
Stefan Praszalowicz 20 January 2004 21:16:23 permanent link ]
 I'd think the same, but, from mysql's manual:

<<
http://www.mysql.co­m/doc/en/Compile_and­_link_options.html

For a connection from a client to a server running on the same host, if
you connect using TCP/IP rather than a Unix socket file, performance is
7.5% slower. (If you connect to the hostname localhost, MySQL uses a
socket file by default.)>>

Which I find rather extreme !


On Tue, 2004-01-20 at 18:59, Morten Norby Larsen wrote:> Just out of curiousity, as I know nothing about these low-level issues:>
Would you actually gain anything from Unix sockets? If I understand > correctly, using them would mean that you go through some kernel-level > drivers (i.e., no physical network interface), which is of course a big > advantage over calls across a TCP/IP layer on top of a some physical > network.>
However, I would guess that if you connect through 127.0.0.1 (which is > what localhost normally maps to), then you should never get anywhere > near a physical network layer, and so the overhead is only what the > TCP/IP layer gives. The TCP/IP overhead shouldn't amount to that much, > compared to the database's disk access, or am I totally wrong here? Your > bytes are still routed through the kernel, just along a different (and > probably slightly longer) path than if you used Unix Domain Sockets.>
I would love any insight into these issues!>
Thanks,>
Morten>
Mark Matthews wrote:>
-----BEGIN PGP SIGNED MESSAGE-----> > Hash: SHA1> >
Michael McTernan wrote:> >
Hi there,> >>
I've got Tomcat and MySQL on the same box and want them to talk using Unix> >>sockets to save a bit of TCP/IP overhead.> >>
The docs say that this is not possible:> >>
"MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as> >
Java does> >
not support Unix Domain Sockets. Therefore, when MySQL Connector/J> >
connects> >
to MySQL, the security manager in MySQL server will use its grant> >
tables to> >
determine whether or not the connection should be allowed."> >>
I can see that that allows a pure Java implementation, but does anyone> >
know> >
if support for Unix domain sockets is planned at all?> >
In the limited testing I've done, the JNI overhead makes Unix domain> > sockets _slower_ than TCP/IP, so if you're looking for a performance> > boost, you won't find it there.> >
Because Connector/J has pluggable socket factories, it would be> > relatively straightforward to take something like this:> >
And implement com.mysql.jdbc.Sock­etFactory using the Unix domain support> > in the package above to get the support for Unix domain you're looking for.> >
Either that, or plead with Sun through the BugParade to add unix domain> > socket support :)­> >
Regards,> >
-Mark> >
- --> > Mr. Mark Matthews> > MySQL AB, Software Development Manager, J2EE and Windows Platforms> > Office: +1 708 557 2388> > www.mysql.com> >
Want to swim with the dolphins? (April 14-16, 2004)> > http://www.mysql.co­m/uc2004/> > -----BEGIN PGP SIGNATURE-----> > Version: GnuPG v1.2.3 (MingW32)> > Comment: Using GnuPG with Thunderbird - http://enigmail.moz­dev.org> >
iD8DBQFADWEFtvXNTca­6JD8RAikcAJwMTjyf2vs­NoXhwt/5Mha+7DxTb3AC­fe1sn> > /jkzGpww0OoFd0U8c0c­S45U=> > =lhnn> > -----END PGP SIGNATURE-----> >
-- > Morten Norby Larsen morten@magisterludi­.com> Magister Ludi s.r.l. Phone: +39 02 26 11 72 80> Via Battaglia 8, I-20127 Milano, Italy Fax: +39 02 28 46 037> http://www.magister­ludi.com
--
Stefan Praszalowicz <stefan@avedya.com>­
Avedya
Add comment
Michael McTernan 20 January 2004 23:27:16 permanent link ]
 Hi,

Sure, a localhost loopback connection shouldn't touch any physical device.
But there are still a number of other things to happen I guess, you still
have to go through TCP, IP and perhaps the routing tables... I'm not sure &
it's a topic for a different forum ;)

"Unix sockets are faster than TCP/IP but can only be used when connecting to
a server on the same computer. Unix sockets are used if you don't specify a
hostname or if you specify the special hostname localhost."

So I guess someone measured a performance increase, probably using the
benchmarks, which should be quite simple to do.
The TCP/IP overhead shouldn't amount to that much,> compared to the database's disk access, or am I totally wrong here?

Yes, the biggest bottleneck is always the first to be optimised, but after
assembling and tweaking a RAID 5 array of 15000rpm disks I don't see that
there is much more I can do there without spending more money. It would
also be nice to not have the open socket, although I'm locking it to
localhost only for security in any case.

Thanks,

Mike
-----Original Message-----> From: Morten Norby Larsen [mailto:morten@magisterludi.com]> Sent: 20 January 2004 18:00> To: java@lists.mysql.co­m> Subject: Re: ConnectorJ 3.0 & unix sockets>
Just out of curiousity, as I know nothing about these low-level issues:>
Would you actually gain anything from Unix sockets? If I understand> correctly, using them would mean that you go through some kernel-level> drivers (i.e., no physical network interface), which is of course a big> advantage over calls across a TCP/IP layer on top of a some physical> network.>
However, I would guess that if you connect through 127.0.0.1 (which is> what localhost normally maps to), then you should never get anywhere> near a physical network layer, and so the overhead is only what the> TCP/IP layer gives. The TCP/IP overhead shouldn't amount to that much,> compared to the database's disk access, or am I totally wrong here? Your> bytes are still routed through the kernel, just along a different (and> probably slightly longer) path than if you used Unix Domain Sockets.>
I would love any insight into these issues!>
Thanks,>
Morten>
Mark Matthews wrote:>
-----BEGIN PGP SIGNED MESSAGE-----> > Hash: SHA1> >
Michael McTernan wrote:> >
Hi there,> >>
I've got Tomcat and MySQL on the same box and want them to talk> using Unix> >>sockets to save a bit of TCP/IP overhead.> >>
The docs say that this is not possible:> >>
"MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as> >
Java does> >
not support Unix Domain Sockets. Therefore, when MySQL Connector/J> >
connects> >
to MySQL, the security manager in MySQL server will use its grant> >
tables to> >
determine whether or not the connection should be allowed."> >>
I can see that that allows a pure Java implementation, but does anyone> >
know> >
if support for Unix domain sockets is planned at all?> >
In the limited testing I've done, the JNI overhead makes Unix domain> > sockets _slower_ than TCP/IP, so if you're looking for a performance> > boost, you won't find it there.> >
Because Connector/J has pluggable socket factories, it would be> > relatively straightforward to take something like this:> >
And implement com.mysql.jdbc.Sock­etFactory using the Unix domain support> > in the package above to get the support for Unix domain you're> looking for.> >
Either that, or plead with Sun through the BugParade to add unix domain> > socket support :)­> >
Regards,> >
-Mark> >
- --> > Mr. Mark Matthews> > MySQL AB, Software Development Manager, J2EE and Windows Platforms> > Office: +1 708 557 2388> > www.mysql.com> >
Want to swim with the dolphins? (April 14-16, 2004)> > http://www.mysql.co­m/uc2004/> > -----BEGIN PGP SIGNATURE-----> > Version: GnuPG v1.2.3 (MingW32)> > Comment: Using GnuPG with Thunderbird - http://enigmail.moz­dev.org> >
iD8DBQFADWEFtvXNTca­6JD8RAikcAJwMTjyf2vs­NoXhwt/5Mha+7DxTb3AC­fe1sn> > /jkzGpww0OoFd0U8c0c­S45U=> > =lhnn> > -----END PGP SIGNATURE-----> >
--> Morten Norby Larsen morten@magisterludi­.com> Magister Ludi s.r.l. Phone: +39 02 26 11 72 80> Via Battaglia 8, I-20127 Milano, Italy Fax: +39 02 28 46 037> http://www.magister­ludi.com>
--> MySQL Java Mailing List> For list archives: http://lists.mysql.­com/java> To unsubscribe: http://lists.mysql.­com/java?unsub=mm1@t­tpcom.com>



--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org


Add comment
Peter Schдfer 21 January 2004 11:26:19 permanent link ]
 
-----Original Message-----> From: Morten Norby Larsen [mailto:morten@magisterludi.com]>
Would you actually gain anything from Unix sockets?

I was using a socket implementation from jlirc.sourceforge.n­et,
with some small adaptions for Connector/J (see attachment).

Performance is slightly worse than TCP/IP. I have no exact figures, however.

A useful application for sockets could be a dedicated server that is not
meant to be
accessible through the network ("--skip-networking­"). Also, you avoid
conflicts with
other processes running on the same TCP/IP port.

-- Peter




--
MySQL Java Mailing List
For list archives: http://lists.mysql.­com/java
To unsubscribe: http://lists.mysql.­com/java?unsub=gcdmj­-java@m.gmane.org
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > MySQL database development > ConnectorJ 3.0 & unix sockets 21 January 2004 11:26:19

see also:
Xmlcontent and locales
6.0.3->6.0.4 - what is the smoothest…
OpenCMS and SAP?
pass tests:
Avatar's from Elfen lied.
see also:
here so quietly and boring! on beon...
boring..boring...boring :-| where p...
mego day!

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .