Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Linux / UNIX and the fly likes Unix newbie - advice about performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Unix newbie - advice about performance" Watch "Unix newbie - advice about performance" New topic

Unix newbie - advice about performance

Tommy Mato

Joined: Dec 14, 2007
Posts: 26

I am writing a VERY processor-intensive standalone application in Java (web server not required). I plan to wring every bit of performance out of my multiprocessor system.

Naturally, I don't want all that processing power being robbed by a Windows operating system checking every millisecond to see if msn messages have come in, whether it is time to upgrade, whether my license is valid, whether it is time to change my underwear, etc, etc, etc.

I want a 'bare bones' unix system, possibly command-line only, that supports JVM multi-threading to multiple processors. I'd be ever so grateful if the experienced members here could point me in the right direction of which version I should install, and whether it is easy to turn off the GUI environment. Being a unix virgin I could do with a version that is easy to install and is reasonably well supported device-driver wise.

Thanks in advance. I bow to your knowledge and experience. Regards,

Tom Reilly

Joined: Jun 01, 2010
Posts: 618
I can only speak to Linux (not Unix). There are quite a few popular Linux distributions available. Most support what you are asking about. Here's how I would approach your project:

1. Be prepared to install Linux many times before getting it the way you want it. Also be prepared to get frustrated.
2. Get a computer that is not brand new and not really old. This will reduce the risk that your Linux distribution will not support your hardware "out of the box". Expect that all data on this box will be destroyed when you install Linux.
3. Have a working computer available so you can download the Linux distribution and search the wild wild web throughout the install process. You will do this a lot.
4. Pick a Linux distribution, download the install image, and burn it to CD/DVD. Throughout the process, you may decide to try several distributions.
5. Install Linux using all deafults. Once successful, you will have confidence to continue.
6. Reinstall Linux removing the functionality that you do not want.

I personally like the Fedora distribution. Fedora is the free version of Redhat. CentOS, also a variant of Redhat, looks good too. The difference between Fedora and CentOS is in their distribution lifecycles. Fedora, I believe is updated every six months. There are many others.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

If I recall correctly, Ubuntu Server is a no GUI installation. But you will still have to disable services that you don't need/want. If you are not that familiar with Linux it might be best to use a GUI initially and try out your app with that. You can even use ALT-Fn to switch to a non-GUI terminal. Once comfortable with Linux and you app, you can disable the services you don't need and disable the GUI.

JBoss In Action
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Try FreeBSD, OpenBSD, ArchLinux or Gentoo.
(ArchLinux and Gentoo require a massive dirty work to be done and I wont to surprised if Gentoo appears in the next SAW movie as a trap).
Joe Ess

Joined: Oct 29, 2001
Posts: 9188

Tommy Mato wrote:I am writing a VERY processor-intensive standalone application in Java (web server not required). I plan to wring every bit of performance out of my multiprocessor system.

If you are writing processor-intensive code, make sure your processor is up to the task. The fastest code and OS will still be slow on a slow processor. My time is not cheap. Computer hardware, by comparison, is cheap. It makes more sense to invest some money for a sure payoff than to spend days trying to tweak my way to a faster program.

[How To Ask Questions On JavaRanch]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Word of warning. I've been doing performance studies and tuning for a (get-offa-my-lawn!) LONG time. I spent a fair amount of that on IBM mainframes, which were designed when resources were expensive (I remember how excited we got when they first had an entire MEGAbyte of RAM to play with).

Even then, the measured amount of CPU time for a typical app what 50% kernel usage, 50% application usage. So just to get a given amount of application optimization, you had to work twice as hard.

I certainly believe in efficient resource usage, and frequently get yelled at for worrying about such things in an age when you can just throw more hardware at the problem. Certainly, one should shut down useless processes and remove unused code. They're not merely a waste of space, they're also more places for a security exploit to attack. However, they're rarely going to have that great an impact on performance. Multi-tasking systems only function at all because there's a lot of "dead" time on most applications.

However, the first rule of optimization is not to optimize too early. It's far better to prototype the system and benchmark it with realistic conditions, then measure for where the real bottlenecks are. Hint: based on long experience, they're almost never where you "know" they are.

There are 2 popular approaches to ensuring that a given app isn't penalized. One is to scale processors. Blades, Beowulf clusters, stuff like that. The other one is the more traditional approach, which is to use a load-balancer. IBM's mainframe OS permits the systems support people to establish service level agreements and define service level objectives. The OS will then internally manipulate itself to ensure that these agreements are adhered to, pushing down the priorities of less-important processes, if needed. Solaris also supports this sort of thing. Although in the real world, outside of mainframes, what I've seen is a preference for tossing hardware at the problem, since they didn't want to pay the salaries for Solaris sysadmins who were trained to do load-balancing.

Actually, you really shouldn't want to wring EVERY last ounce of performance out of a system. I used to work for someone who harped on that string, until an IBM representative pointed out that if you're running a 100% load all the time, the first bump in the road will train-wreck you (to mix metaphors). No good general takes the field without reserves, What you want is effective use of the system. Unless you really like having things go down just when you need them most.

Oh yeah, we have a very good optimization forum here.

An IDE is no substitute for an Intelligent Developer.
Tom Reilly

Joined: Jun 01, 2010
Posts: 618
John Todd wrote:Try FreeBSD, OpenBSD, ArchLinux or Gentoo.
(ArchLinux and Gentoo require a massive dirty work to be done and I wont to surprised if Gentoo appears in the next SAW movie as a trap).

Gentoo requires that you compile the operating system before installing it. But at least they provide you with the source code all in one place. If you really want to have fun, try LFS (Linux From Scratch). That requires that you compile the compiler before you can compile the operating system. And you have to get the source code from multiple places.
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

I strongly recommend Debian not Ubuntu for this case. Ubuntu is a child of Debian, so the system administration tasks are identical. Ubuntu has a lot of user friendly stuff included, that this case does not need. Debian is more pure.

I'd install the GUI, it makes life a lot easier especially for new users.
I agree. Here's the link:
subject: Unix newbie - advice about performance
jQuery in Action, 3rd edition