帮助优化容器

帮助优化容器

我有一个只有一个容器(Cpanel 服务器)的 openvz 节点。昨天我遇到了很多记忆问题:

无法分叉:无法分配内存

有人能帮我优化节点设置吗?我有一个 4Gb 节点,我可以将所有节点资源用于容器。

这是我的资源输出:

cat /proc/user_beancounters 
Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
      100:  kmemsize                 20674962             43480374            419090432            460999475                    0
            lockedpages                     0                    7                20463                20463                    0
            privvmpages                230416              1045032               900000              1000000               363565
            shmpages                    11328                17450                30695                30695                    0
            dummy                           0                    0                    0                    0                    0
            numproc                       106                  161                10230                10230                    0
            physpages                  129958               885303                    0  9223372036854775807                    0
            vmguarpages                     0                    0               491520  9223372036854775807                    0
            oomguarpages               153680               906996               917504  9223372036854775807                    0
            numtcpsock                     56                  191                10230                10230                    0
            numflock                        7                   21                 1000                 1100                    0
            numpty                          1                    1                  512                  512                    0
            numsiginfo                      0                   31                 1024                 1024                    0
            tcpsndbuf                 1171104              4738832             97794730            139696810                    0
            tcprcvbuf                  917504              4212568             97794730            139696810                    0
            othersockbuf               139120              1841832             48897365             90799445                    0
            dgramrcvbuf                     0               147352             48897365             48897365                    0
            numothersock                   72                  110                10230                10230                    0
            dcachesize                      0                    0             91533669             94279680                    0
            numfile                      7101                 7630               163680               163680                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            numiptent                     421                  421                  400                  500                    0

看起来“privvmpages”参数失败:

这是我的节点设置:

VERSION="2"

ONBOOT="yes"


NUMPROC="10230:10230"
AVNUMPROC="5115:5115"
NUMTCPSOCK="10230:10230"
NUMOTHERSOCK="10230:10230"
VMGUARPAGES="491520:9223372036854775807"

# Secondary parameters
KMEMSIZE="419090432:460999475"
TCPSNDBUF="97794730:139696810"
TCPRCVBUF="97794730:139696810"
OTHERSOCKBUF="48897365:90799445"
DGRAMRCVBUF="48897365:48897365"
OOMGUARPAGES="917504:9223372036854775807"
PRIVVMPAGES="900000:1000000"

# Auxiliary parameters
LOCKEDPAGES="20463:20463"
SHMPAGES="30695:30695"
PHYSPAGES="0:9223372036854775807"
NUMFILE="163680:163680"
NUMFLOCK="1000:1100"
NUMPTY="512:512"
NUMSIGINFO="1024:1024"
DCACHESIZE="91533669:94279680"
NUMIPTENT="400:500"
DISKSPACE="203811210:224192332"
DISKINODES="5000000:6000000"
CPUUNITS="139987"
VE_ROOT="/vz/root/$VEID"
VE_PRIVATE="/vz/private/$VEID"
ORIGIN_SAMPLE="1vs"

DISK_QUOTA="yes"
OSTEMPLATE="centos-5-x86_64"
IP_ADDRESS="xxx.xxx.xxx.xxx"
NAMESERVER="208.67.222.222 208.67.220.220"
HOSTNAME="xxx.xxxxxx.xxx"
QUOTAUGIDLIMIT="800"
DISKSPACE="204857600:215302400"
QUOTATIME="1200"

答案1

将 PRIVVMPAGES 中的两个字段都乘以 2。

也就是说,替换

PRIVVMPAGES="900000:1000000"

PRIVVMPAGES="1800000:2000000"

或者(没有测试,但应该可以工作):

PRIVVMPAGES="6.8G:7.6G"

并重新启动容器。

相关内容