OS X talking to Windows with Sockets
Found an unusual compatibility problem last week
when using Sockets to communicate between OS X and Windows. The bottom line is
if you have a java application on OS X that does some high volume TCP/IP socket
communications to a Windows service, then you had better be using OS X Leopard
to get the best performance ... about 9X better.
IntroductionLast
week I completed a feature on a WebObjects application. I develop on OS X
Leopard using a Mac Pro. One aspect of the feature involves connecting to a
Windows machine running mailing address correction and geocoding software, which
BTW is the Mailroom
Toolkit Architect product from Satori Software . In any case, the
logic for each mailing address consists of creating a XML request, opening a
java.net.Socket to the Mailroom service running on Windows machine, writing the
request, reading the XML response, closing the Socket and parsing the response.
This logic runs in a loop while processing a list of mailing
addresses.The
ProblemOn my Leopard development
machine, I ran the Mailroom Architect service in Windows on a Parallels Virtual
Machine. For a test of 1000 records, the processing time was about 7
seconds which is perfectly acceptable. When I deployed the application to
PowerPC XServes running Mac OS X Tiger, the 1000 record test was taking 65
seconds, over 9 time slower! I use Shark for profiling in development, but I
had a little trouble getting it working on the deployment machine*, so I opted
to just do process of
elimination.The Source of the
ProblemWe discovered that the problem
manifested only when OS X Tiger (latest 10.4.11 with all updates) used the
service on native Windows. It did not matter whether we ran Windows XP or
Windows 2003 server on a PC or natively on an intel Mac. Interestingly, the slow
socket problem was not present when OS X Tiger accessed the service when the
service was hosted in a Parallels Virtual Windows machine on any intel
Mac.The
SolutionThe solution was to simply
upgrade the XServes to OS X Leopard. The socket performance 1000-address test
was back to 7 seconds on Leopard 10.5.3 fresh install and 10.5.5 with all latest
updates. So if you have a java app running on OS X Tiger that does high volume
socket communications with a Windows box, you should see a 9-fold performance
gain by upgrading to Leopard.*
Simply adding
-agentlib:Shark
to the instance Additional Arguments in WOMonitor was not enough to get Shark to
"see" the app and I really did not feel like wasting time getting Shark running
since with or without Shark profile info, the problem still existed only on OS X
Tiger.
Posted: Thursday - December 04, 2008 at 08:28 AM