Connector/J + JNA + Unix Sockets (Works, But Need Help w/Performance)
Posted by: Justin Y
Date: November 13, 2010 03:33PM

Hi Everyone --

In attempt to get better performance in an environment where a Java application is deployed to the same Linux server where MySQL is running, I've written a SocketFactory implementation that uses Unix Sockets:

http://www.productivity.org/projects/mysqlunixsocket/

This is an analog to using the NamedPipeSocketFactory on Windows systems. To pull this off, I use the JNA (Java Native Access) library in order to get to the underlying C library's socket methods (socket, connect, read, write, and close).

The code works, but does not perform better than TCP/IP as I expected.

I noticed a dramatic improvement by wrapping my underlying InputStream and OutputStream instances with BufferedInputStream and BufferedOutputStream (respectively), but it's still worse than TCP/IP by 20% or more.

I'm looking for assistance to tune this code such that I can consistently get results better than TCP/IP. I've seen dramatic improvements in speed in Perl code using MySQL's socket connectivity vs. TCP/IP, and that served as inspiration.

Also -- if anyone is of the opinion that this isn't worth the effort, I'd like to know why.

Thanks in advance!

-- Justin

Options: ReplyQuote


Subject
Written By
Posted
Connector/J + JNA + Unix Sockets (Works, But Need Help w/Performance)
November 13, 2010 03:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.