6

I host several Rails applications on a VPS using Ubuntu 8.04, Nginx, Passenger, Mysql, RVM, so all the usual suspects.

In the last days it was the first time I really had to debug a problem and look at which processes are running. I could fix the problem using passenger-status and passenger-memory-stats, but I am quite confused by the number of processes running and can't quite figure it out.

Take a look at this screenshot for example: http://screencast.com/t/wUMrmy5iQPQi (taken from htop)

It shows lots of Hudson processes (Hudson is the CI server I am running on that machine).

My questions are:

  • Why are there 34 of them?
  • Are they all separate processes?
  • Are there supposed to be 34 of them or are some of them stale, orphaned processes that didn't shutdown properly on a restart and which I should kill?
3
  • Wow you are running an old ubuntu version. 10.10 is the current version!
    – Alfred
    Jan 17, 2011 at 11:42
  • @Alfred: unfortunately many VPS provider don't support the current Ubuntu versions. Also: the most likely upgrade path from 8.04 would be 10.04, as both are LTS releases. Jan 17, 2011 at 12:58
  • Yep, as Joachim assumed, my host does not let me choose a newer Ubuntu version... would love to update to a more recent one! Jan 18, 2011 at 21:45

2 Answers 2

12

You are seeing threads. While in htop, press F2 for options then select "Display Options". Check the box for "Hide userland threads" and/or try some of the options in htop like "display threads in a different color"

You may also want to turn on the PPID (parent process id) column. Then you'll be able to tell that all of the threads likely list the same parent process.

3
  • This is not definitely the case; "ps" generally doesn't show threads by default if you use a recent (i.e. not ancient) libc / threads package and 2.6. kernel, which the OP seems to be using.
    – MarkR
    Jan 17, 2011 at 12:23
  • 2
    @MarkR while "ps" might not show threads, the tool that the OP IS using, "htop", shows threads by default. This is why my answer is written directly to the tool in question.
    – basszero
    Jan 18, 2011 at 0:27
  • Doesn't the threads share the same PID? In top case, each instance showing different PID. Oct 17, 2023 at 13:21
0

Linux ps will display separate threads as processes. I don't think there is anything to worry about in that regard.

Try the -L flag to see thread (Lightweight Process) information.

4
  • Nope this is no longer the default. On my distrib ps -e | grep java | wc -l gives 9 results while including the threads with -L (ps -Le | grep java | wc -l) returns 369 results.
    – gabuzo
    Jan 17, 2011 at 10:58
  • So all the Hudson lines in the screenshot are threads? Why would I be interested in those instead of the process(es)? And where can I see the actual processes? Jan 17, 2011 at 11:08
  • @gabuzo Agreed - but is it the default under Ubuntu 8?
    – trojanfoe
    Jan 17, 2011 at 11:13
  • @zoopzoop I don't have access to a Ubuntu 8 system - I think you'll need to look through the ps manpage. I could be barking up the wrong tree though... :-/
    – trojanfoe
    Jan 17, 2011 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .