Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am develops guy working for an e-commerce company I am running my e-commerce application built using ruby on rails spree commerce. I am presently running 2 medium instances in the production. One is a high memory instance which has 3.8 RAM and single Core CPU and another one is high CPU instance which has Dual Core CPU. Basically AWS calls it has m1.medium and c1.medium instance respectively. My question is it possible to separate the processes according the cpu intense and memory intense? So that all the cpu intense process can be made run in high cpu instance and all the memory intense process can be made to run in the high memory instances. Is any tool available to identify those process. Kindly give me some heads up. Thank you

share|improve this question
up vote 2 down vote accepted

it is very rare to separate these things properly, usually a CPU intensive task lives with a memory heavy task perfectly alright on the same box. I guess most of the time the AWS using companies build the most uniform load appliances possible, because you need to use a relatively homogeneous hardware fleet (few special cases (db server)). I would rather try to find out which is the cheapest instance you can run you stack at least 2 times (but 3 is recommended). You can achieve more availability and rather less performance overhead with this way. The tool you need is ps on linux (and on few other OS).


ps -eo 'pcpu,%cpu,pid,comm' | grep -v '%CPU   PID COMMAND' | sort -n  


ps -eo 'rss,%mem,pcpu,%cpu,pid,comm' | grep -v '%CPU   PID COMMAND' | sort -n

Please have a look at the fields section of the manpage for more:


   %cpu        %CPU      cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the
                         time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add
                         up to 100% unless you are lucky. (alias pcpu).

   %mem        %MEM      ratio of the process's resident set size  to the physical memory on the machine, expressed as a
                         percentage. (alias pmem).

   args        COMMAND   command with all its arguments as a string. Modifications to the arguments may be shown. The output in
                         this column may contain spaces. A process marked <defunct> is partly dead, waiting to be fully
                         destroyed by its parent. Sometimes the process args will be unavailable; when this happens, ps will
                         instead print the executable name in brackets. (alias cmd, command). See also the comm format keyword,
                         the -f option, and the c option.
                         When specified last, this column will extend to the edge of the display. If ps can not determine
                         display width, as when output is redirected (piped) into a file or another command, the output width
                         is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The COLUMNS
                         environment variable or --cols option may be used to exactly determine the width in this case. The w
                         or -w option may be also be used to adjust width.

   blocked     BLOCKED   mask of the blocked signals, see signal(7). According to the width of the field, a 32 or 64-bit mask
                         in hexadecimal format is displayed. (alias sig_block, sigmask).

   bsdstart    START     time the command started. If the process was started less than 24 hours ago, the output format is
                         " HH:MM", else it is "Mmm dd" (where Mmm is the three letters of the month). See also lstart, start,
                         start_time, and stime.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.