I ssh into a server in my office, its running Lucid Lynx 10.04. I dont know why its running so many instances of java.
Thanks
This is the the console barf of $ top
Tasks: 134 total, 2 running, 132 sleeping, 0 stopped, 0 zombie
Cpu(s): 98.2%us, 1.8%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1926032k total, 1895432k used, 30600k free, 19500k buffers
Swap: 5644280k total, 192576k used, 5451704k free, 268796k cached
PID USER NI VIRT RES SHR S %CPU %MEM TIME+ PPID GROUP COMMAND
27132 padmin 0 1149m 405m 10m S 58 21.6 429:33.50 1 padmin java
7169 padmin 0 1134m 380m 10m S 57 20.2 37:02.32 1 padmin java
1893 padmin 0 1142m 381m 10m S 51 20.3 170:03.34 1 padmin java
3515 padmin 0 1105m 241m 916 S 20 12.8 4932:54 1 padmin java
16946 root 0 41784 7768 1084 S 1 0.4 0:00.13 6935 root munin-node
17301 nobody 0 17368 2744 1696 R 1 0.1 0:00.03 16946 munin memory
16930 root 0 41784 7768 1084 S 1 0.4 0:00.13 6935 root munin-node
54 root 0 0 0 0 S 0 0.0 22:38.89 2 root kondemand/0
926 mysql 0 237m 2484 664 S 0 0.1 14:30.06 1 mysql mysqld
1692 root 0 1017m 51m 27m S 0 2.7 60:31.46 1 root mongod
3284 padmin 0 76400 1032 232 S 0 0.1 0:30.69 1 padmin memcached
16012 padmin 0 19224 1424 1064 R 0 0.1 0:00.82 12115 padmin top
1 root 0 23904 1316 644 S 0 0.1 0:00.74 0 root init
2 root 0 0 0 0 S 0 0.0 0:00.01 0 root kthreadd
3 root 0 0 0 0 S 0 0.0 0:00.03 2 root migration/0
4 root 0 0 0 0 S 0 0.0 0:00.27 2 root ksoftirqd/0
5 root 0 0 0 0 S 0 0.0 0:00.21 2 root watchdog/0
6 root 0 0 0 0 S 0 0.0 0:00.03 2 root migration/1
7 root 0 0 0 0 S 0 0.0 0:00.95 2 root ksoftirqd/1
8 root 0 0 0 0 S 0 0.0 0:00.15 2 root watchdog/1
9 root 0 0 0 0 S 0 0.0 1:09.30 2 root events/0
As you can see, all the java instances of java have the same ppid. This is a mild case. At many rabid instances, there can be upto 7-10 instances of java. Let me know if there are any-other outputs you need.
As an aside, every time i log into the server, i get a
*** System restart required ***
Are so many instances of java the reason?
EDIT: $ pstree
init─┬─apache2───5*[apache2]
├─atd
├─avahi-daemon───avahi-daemon
├─console-kit-dae───63*[{console-kit-da}]
├─cron
├─cupsd
├─dbus-daemon
├─dnsmasq
├─dovecot─┬─2*[dovecot-auth]
│ ├─3*[imap-login]
│ └─3*[pop3-login]
├─6*[getty]
├─java───56*[{java}]
├─java───67*[{java}]
├─libvirtd───6*[{libvirtd}]
├─master─┬─pickup
│ └─qmgr
├─2*[memcached───5*[{memcached}]]
├─mongod───76*[{mongod}]
├─munin-node
├─mysqld───9*[{mysqld}]
├─named───4*[{named}]
├─nmbd
├─postgres───4*[postgres]
├─rsyslogd───3*[{rsyslogd}]
├─smbd───smbd
├─sshd───sshd───sshd───bash───pstree
├─udevd───2*[udevd]
├─upstart-udev-br
├─vsftpd
└─winbindd───3*[winbindd]
I don't think these represent Java threads, since each of them has a different PID.
You might have the padmin user (or a root user, or one who can use sudo for this purpose, etc.) check the command lines of these respective Java processes, using any of these methods (replacing pid with the respective number from the top output - 27132, 7169, etc.):
ps -ef | grep pid
or
cat /proc/pid/cmdline
This way, at least you can start figuring out where each of them was called from, and what it's doing.
1) It's hard to tell without seeing your process list, but most likely you are just observing many Java threads, not many instances/processes. Java by nature very heavily uses threads and it's normal to see many of them.
2) You have updated your server and one of the updates has been a kernel upgrade. That requires a reboot for a new kernel to be used, so that's why Ubuntu asks you to restart your server.
The System restart required is likely a result of a kernel patch being applied. A restart to use the new kernel is required. This is unrelated to the java process problem, but will likely resolve the problem temporarily.
As the PPID (parent PID) is 1 for the Java process, they are not threads. It is possible you have a command in your profile to start this application, although as it runs a user padmin, this may not be likely. A search for linux padmin java, gives a number of different possible application which may be running. The lsof command can be used to try to find out where these were started from. Then you can try to configure out what application is running.
The fact that it's a Java process doesn't tell you much about the actual application; you want to see the whole command-line.
ps -fp $(pgrep -d, -x java)
should give you the full commandline of each current java process (if they are short-lived processes then looking for the process first may fail as it may have finished by the time you try and find its commandline, hence doing it in a single line is a good idea)“ps aux | grep java” output would give much better data about the problem.
But with given data, there is single point of interest: group of those Java programs: padmin. This user is your user, right? Since you are running ”top” with that user.
You are also running memcached with your user. So I suspect you have complete server instance running with that user. Maybe Tomcat? It atleast uses Java.
With that TIME, those processes have been running for long time, so I guess they are some kind of backend threads of the program.