0

I realize that this question is pretty generic, and I'm looking for very general input on how to reconcile performance differences on linux (RedHat 5) vs Windows (2008 Server). I have a java application that is a collection of multiple services that is processing netflow packets off a wire that seems to be performing at about half the capacity on Linux vs Windows on the exact same hardware. The application involves pulling packets off a socket, and performing some very simple processing on them, and writing out a condensed output file to be processed downstream by a different C++ application.

Areas in the program that are relevant: Pulling packets off a socket Database access (mysql 5.1.45) A ton of file i/o

I have very little linux experience as far as optimizations go, and it would be great if someone could point out a few things to watch out for when trying to optimize this for linux that are different than on windows.

Also, I'm not entirely sure what other information I can give. As in, I know I haven't provided lots of useful information, and I would appreciate questions that point me in the right direction.

Are there any utilities that provide java performance benchmarking across linux and windows?

Feel free to shoot me down if the question doesn't make sense, or I'm providing too little information to even ask a useful question.

Thanks!

Edit: All the jvm settings are the same (we use the exact same wrapper config files in both cases for the services involved)

Edit: I'd like to table this issue for the time being. I have been unable to spend any more significant time exploring this apart from running a basic profiler and comparing the results. The results on both linux and windows look almost identical, apart from a much larger lag in pulling packets off the NIC. I still don't understand why this is the case, or if this is an anomaly related to other network conditions. I will post more when I get the time to look at this again.

Thanks for the answers all!

user1024191
  • 193
  • 1
  • 1
  • 6

4 Answers4

1

Suggestion: find a profiling tool that fits your scenario, and just run it in both environments.

For example, Eclipse TFTP:

PS:

Affe's suggestion about NIO is a good one. Admittedly, it begs the question about why there seems to be a performance difference. But if you're not already using NIO, it could benefit both environments. IMHO...

paulsm4
  • 99,714
  • 15
  • 125
  • 160
  • That's a good suggestion, and something that I will try tomorrow to see if the profiles look different. Thanks for the links too. – user1024191 Jul 10 '12 at 23:05
1

On the face of it, Linux is not slower than Windows for the same hardware. Before blaming the OS (or Java on the OS), I'd look at other things:

  • Is the hardware the same? Same processors specs? Same amount of memory? Same disc specs?

  • Is it a problem with the database? Are the Windows and Linux systems talking to the same database instance? Are they talking to it the same way. If the database instances are different, have they been configured the same? Have they been tuned?

The solution to this kind of problem often involves turning on performance monitoring, profiling, etc and analysing the systems' behaviour to see where the bottlenecks are.

IMO, you need to figure out where the bottlenecks really are before spending (wasting) time on some theory that (for instance) using NIO will fix the problem.


Are there any utilities that provide java performance benchmarking across linux and windows?

Not that I'm aware of.

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096
  • The hardware is identical in both cases. In fact, to make sure of that, I even tried swapping the machines, and ended up with the same result. The database is also the same in both cases (both in terms of configuration and tuning) and the code to talk to the database is also the same. – user1024191 Jul 10 '12 at 23:07
  • And what do the profiling and performance monitoring numbers say? Where is the bottleneck? – Stephen C Jul 10 '12 at 23:53
1

Some other things that might affect performance: - JVM - are you using the same vendors JVM? Same version? Are both 64-bit or 32-bit? - Kernel issues: Are you running a custom kernel? Correctly compiled for your processor? - What are the CLI performance tools (top, ntop, iostat, vmstat) telling you on Linux? For instance, if iostat has high IO wait times, then it could be an issue with how the drives are configured

There are LOTS of factors that can effect Java performance. Start simple, work backwards. In my mind, simple == basic stats like memory pages and IO performance. If we are talking the EXACT same code, then start identifying the differences (OS obviously, but what else?)

CodeChimp
  • 7,511
  • 3
  • 35
  • 76
  • Oh, and I agree with Stephen C...in my experience, the most usual suspects are the DB and disk IO. Put some print-outs around the disk writes and calls to the DB, run it on both Windows and Linux, and see what you get...might prove to be useful. – CodeChimp Jul 10 '12 at 23:46
1

JVisualVM may already be available on your target platforms. An example may be found here.

Community
  • 1
  • 1
trashgod
  • 196,350
  • 25
  • 213
  • 918