我是一家电子商务公司的开发人员,我正在运行我的电子商务应用程序,使用rails疯狂商业构建。我目前正在生产中运行两个中型实例。一种是具有3.8RAM和单核CPU的高内存实例,另一种是具有双核CPU的高CPU实例。基本上,AWS调用它分别有m1.media和c1.media实例。我的问题是,是否可以根据cpu强度和内存强度将进程分开?这样,所有cpu密集型进程都可以在高cpu实例中运行,而所有内存密集型进程都可以在高内存实例中运行。是否有任何可用于标识这些过程的工具。请给我一些提示。谢谢
发布于 2012-10-07 05:31:14
正确地分离这些东西是非常罕见的,通常CPU密集型任务与内存繁重的任务生活在同一个机器上完全正常。我猜大多数情况下,AWS使用公司构建最统一的负载设备,因为您需要使用相对一致的硬件舰队(很少有特例(db服务器))。我宁愿找出哪一个是您可以运行堆栈至少2次的最便宜的实例(但推荐3次)。通过这种方式,您可以获得更多的可用性和更少的性能开销。您需要的工具是linux上的ps (以及很少有其他操作系统)。
CPU:
ps -eo 'pcpu,%cpu,pid,comm' | grep -v '%CPU PID COMMAND' | sort -n
MEM:
ps -eo 'rss,%mem,pcpu,%cpu,pid,comm' | grep -v '%CPU PID COMMAND' | sort -n
有关更多信息,请查看手册中的“字段”部分:
CODE HEADER DESCRIPTION
%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.
https://serverfault.com/questions/435618
复制相似问题