Log in

No account? Create an account
Who, me? [userpic]

Java has an odd definition of "server"

August 4th, 2008 (04:03 pm)

I'm reading through the features Java added in 1.5, and I spotted something a little surprising. At least since 1.4 (1.3?), Sun's JVM has had a "server mode", in which it takes longer to start up, but then runs faster—the theory being that, if you're running a long-lived server, the tradeoff is worth it. Prior to 1.4, the default was client mode; if you wanted server mode, you had to specify "-server" at startup.

In 1.5, they added logic to infer whether you wanted server mode based on the type of machine you were on. If you're running on a 64-bit CPU, or if you're on a Unix machine with at least 2 CPUs and at least 2GB of RAM, then it's assumed that you're a server, and server mode becomes the default; if you want client mode, you have to specify "-client".

This means that every machine I might run Java on is classified as a server. My desktop machines (home and work) are 64-bit, and my laptop has 2 cores and 2GB of RAM. (Granted, I just upgraded to 2GB a week ago; but it was an option when I bought it in 2006.) I don't run much Java, but I think it's safe to say that none of what I would run is likely to be a long-lived server process.

(I suppose this would've been useful back when I was stuck using Eclipse for my compilers class; that was definitely long-lived.)


(Deleted comment)
Posted by: Justin du Coeur (jducoeur)
Posted at: August 13th, 2008 05:57 pm (UTC)

Oh, I dunno. It's true that it doesn't match your environment, but I suspect those heuristics are awfully solid in terms of real-world averages -- you're not exactly typical. The 64-bit filter is likely to stop being useful soon, but up until now that formula probably got about 90% of the machines out there right...

2 Read Comments