首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >面向内存和面向CPU进程的分离

面向内存和面向CPU进程的分离
EN

Server Fault用户
提问于 2012-10-07 05:04:29
回答 1查看 148关注 0票数 1

我是一家电子商务公司的开发人员,我正在运行我的电子商务应用程序,使用rails疯狂商业构建。我目前正在生产中运行两个中型实例。一种是具有3.8RAM和单核CPU的高内存实例,另一种是具有双核CPU的高CPU实例。基本上,AWS调用它分别有m1.media和c1.media实例。我的问题是,是否可以根据cpu强度和内存强度将进程分开?这样,所有cpu密集型进程都可以在高cpu实例中运行,而所有内存密集型进程都可以在高内存实例中运行。是否有任何可用于标识这些过程的工具。请给我一些提示。谢谢

EN

回答 1

Server Fault用户

回答已采纳

发布于 2012-10-07 05:31:14

正确地分离这些东西是非常罕见的,通常CPU密集型任务与内存繁重的任务生活在同一个机器上完全正常。我猜大多数情况下,AWS使用公司构建最统一的负载设备,因为您需要使用相对一致的硬件舰队(很少有特例(db服务器))。我宁愿找出哪一个是您可以运行堆栈至少2次的最便宜的实例(但推荐3次)。通过这种方式,您可以获得更多的可用性和更少的性能开销。您需要的工具是linux上的ps (以及很少有其他操作系统)。

CPU:

代码语言:javascript
运行
复制
ps -eo 'pcpu,%cpu,pid,comm' | grep -v '%CPU   PID COMMAND' | sort -n  

MEM:

代码语言:javascript
运行
复制
ps -eo 'rss,%mem,pcpu,%cpu,pid,comm' | grep -v '%CPU   PID COMMAND' | sort -n

有关更多信息,请查看手册中的“字段”部分:

代码语言:javascript
运行
复制
       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.
票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/435618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档