emacs, er, Java makes all computers slow

nicholas on 2005-06-13T13:03:50

Eight megs and constantly swapping? Pah? Who needs emacs to make a computer slow when you have Java. (Or more specifically, Tomcat on a 2.4 Linux kernel). :-(

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
21543 wist      25   0  117M 117M 11368 S     0.0  2.9   0:09   0 java
21556 wist      15   0  117M 117M 11368 S     0.0  2.9   0:05   0 java
21558 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   2 java
21561 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
21600 wist      24   0  117M 117M 11368 S     0.0  2.9   0:00   3 java
21601 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   3 java
21602 wist      15   0  117M 117M 11368 S     0.0  2.9   0:07   2 java
21603 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24721 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24722 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24723 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24724 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   1 java
24791 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   3 java
24792 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   1 java
24793 wist      17   0  117M 117M 11368 S     0.0  2.9   0:24   2 java
24794 wist      18   0  117M 117M 11368 S     0.0  2.9   0:00   3 java
24795 wist      17   0  117M 117M 11368 S     0.0  2.9   0:00   3 java
24796 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   1 java
24797 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   1 java
24798 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24799 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24800 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24801 wist      25   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
24802 wist      15   0  117M 117M 11368 S     0.0  2.9   0:00   0 java
30489 wist      17   0  117M 117M 11368 S     0.0  2.9   0:00   3 java

4 Gigs of RAM disappears rather quickly. Particularly when there is more than 1 user running java. (b.t.w., this is why Parrot needs to run interpreted code quickly, and "just JIT it" is not a universal answer. Consider the case of many many processes running the same bytecode compiled scripts on a shared machine, and how much memory each would want for the JIT invocation)


not that java ain't a pig...

lachoy on 2005-06-13T13:57:56

...but are all those threads for the same process rather than separate processes? I have a Tomcat 4.x server running on a Linux 2.4.x kernel and see the same thing.

You probably know this, but just in case: you can cap the memory a JVM uses with command-line arguments: -Xms=xxxM sets the initial heap size (in MB), -Xmx=xxxM sets the max. (More with 'java -X -?'.) With tomcat these are typically set in your bin/catalina.sh file using JAVA_OPTS from the environment.

Re:not that java ain't a pig...

Matts on 2005-06-13T16:53:06

But capping the memory usage doesn't make it use less memory does it? I thought it just made it run OUT of memory sooner.

Re:not that java ain't a pig...

lachoy on 2005-06-13T17:51:01

Yep, capping the memory usage just means it won't eat up all the memory (and swap) of your machine, which seemed to be the complaint. I think that once you hit the limit you'll just start getting java.lang.OutOfMemoryError exceptions.

Conspiracy theories

mary.poppins on 2005-06-13T20:36:50

As I wrote in my profile:

My personal theory is that Java is a fraud perpetrated by Sun to stimulate hardware sales. "What? Too slow? Tends to eat up all of swap? You obviously need our new E20599000!"

threads

sky on 2005-06-13T22:49:03

Top is being stupid and showing all threads, press H and it shows you a better view of the world.... as I pointed out earlier today.

The reason that machine is slow is because it starts swaping programs to it's local IDE disk to get more buffer space reading from a SAN that has 8GB of read cache, and the ide causes interrupt storms and the machines start crawling..

Linux in it's infinitly stupid swap implementation.