CPU 动态节能技术用于降低服务器功耗,通过选择系统空闲状态不同的电源管理策略,可以实现不同程度降低服务器功耗,更低的功耗策略意味着 CPU 唤醒更慢对性能影响更大。但对于对时延和性能要求高的应用,可以关闭 CPU 的动态调节功能,禁止 CPU 休眠,并把 CPU 频率固定到最高,以达到最好的性能。通常建议在服务器 BIOS 中修改电源管理为 Performance,如果发现 CPU 模式为 conservative 或者 powersave,可以使用 cpupower 设置 CPU Performance 模式,效果也是相当显著的。
vi /etc/security/limits.conf #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # #<domain> <type> <item> <value> * soft core unlimited * hard core unlimited * soft data unlimited * hard data unlimited * soft fsize unlimited * hard fsize unlimited * soft sigpending unlimited * hard sigpending unlimited * soft nofile 65536 * hard nofile 65536 * soft msgqueue unlimited * hard msgqueue unlimited * soft nproc 65536 * hard nproc 65536 * soft locks unlimited * hard locks unlimited * soft memlock unlimited * hard memlock unlimited