FastNetMon

Wednesday 3 March 2010

Шаблон OpenVZ для случая "отдать все ресурсы сервера одному VPS"

Данный конфиг завязан на число ядер в системе и написан для случая 8 ядер. Так что при использовании заменяете 8 и 800 на числа соответствующие числу ядер в Вашей системе.

Для 64 битной ноды будет такой конфиг:

# Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

ONBOOT="yes"

# UBC parameters (in form of barrier:limit)
KMEMSIZE="9223372036854775807:9223372036854775807"
LOCKEDPAGES="9223372036854775807:9223372036854775807"
PRIVVMPAGES="9223372036854775807:9223372036854775807"
SHMPAGES="9223372036854775807:9223372036854775807"
NUMPROC="9223372036854775807:9223372036854775807"
PHYSPAGES="9223372036854775807:9223372036854775807"
VMGUARPAGES="9223372036854775807:9223372036854775807"
OOMGUARPAGES="9223372036854775807:9223372036854775807"
NUMTCPSOCK="9223372036854775807:9223372036854775807"
NUMFLOCK="9223372036854775807:9223372036854775807"
NUMPTY="9223372036854775807:9223372036854775807"
NUMSIGINFO="9223372036854775807:9223372036854775807"
TCPSNDBUF="9223372036854775807:9223372036854775807"
TCPRCVBUF="9223372036854775807:9223372036854775807"
OTHERSOCKBUF="9223372036854775807:9223372036854775807"
DGRAMRCVBUF="9223372036854775807:9223372036854775807"
NUMOTHERSOCK="9223372036854775807:9223372036854775807"
DCACHESIZE="9223372036854775807:9223372036854775807"
NUMFILE="9223372036854775807:9223372036854775807"
AVNUMPROC="9223372036854775807:9223372036854775807"
NUMIPTENT="9223372036854775807:9223372036854775807"
DUMMY="9223372036854775807:9223372036854775807"

# Disk quota parameters (in form of softlimit:hardlimit)
# get all disk to client
DISKSPACE="9223372036854775807:9223372036854775807"
DISKINODES="9223372036854775807:9223372036854775807"
QUOTATIME="0"

# CPU fair sheduler parameter
# set max value
CPUUNITS="500000"

IP_ADDRESS="xx.xx.xx.xx"
HOSTNAME="domain.ru"
VE_ROOT="/vz/root/$VEID"
VE_PRIVATE="/vz/private/$VEID"
OSTEMPLATE="debian-5.0-x86_64-ispmanager"
ORIGIN_SAMPLE="vps.basic"
QUOTAUGIDLIMIT="2048"
# max percent of cpu usage (8*100%)
CPULIMIT="800"
# all system kernels
CPUS="8"
# disable /proc/meminfo virtualization
MEMINFO="none"



Если же у Вас 32 битная машина, то замените 9223372036854775807 на 2147483647. Это объясняется тем, что берется максимальное число для int на платформе.

А вот команда, которая сделает увеличение ресурсов до предела намного быстрее:
export OURCTID=3350
sed -i 's/"[0-9]\+:[0-9]\+"/"9223372036854775807:9223372036854775807"/g' /etc/vz/conf/$OURCTID.conf
sed -i 's/CPUUNITS="[0-9]\+"/CPUUNITS="50000"/' /etc/vz/conf/$OURCTID.conf
sed -i 's/MEMINFO=".\+"/MEMINFO="none"/' /etc/vz/conf/$OURCTID.conf
sed -i "s/CPUS=\"[0-9]\+\"/CPUS=\"$(cat /proc/cpuinfo | grep processor | wc -l)\"/" /etc/vz/conf/$OURCTID.conf
sed -i "s/CPULIMIT=\"[0-9]\+\"/CPULIMIT=\"$((100*$(cat /proc/cpuinfo | grep processor | wc -l)))\"/" /etc/vz/conf/$OURCTID.conf

No comments :

Post a Comment

Note: only a member of this blog may post a comment.