OpenVZ recipies

#tcpsockets (must set both upper mem limit and numsockets)
VZID=199 SOCKET_MB=5 NUM_SOCKETS=360 \
SOCKET_BAR=$((1024**2*$SOCKET_MB)) \
SOCKET_LIM=$(($SOCKET_BAR+($NUM_SOCKETS*2560))) ; \
vzctl set $VZID \
–numtcpsock $NUM_SOCKETS \
–tcpsndbuf $SOCKET_BAR:$SOCKET_LIM \
–tcprcvbuf $SOCKET_BAR:$SOCKET_LIM \
–save

#othersockets, ie mysql etc. (must set both upper mem limit and numsockets)
VZID=199 SOCKET_MB=5 NUM_SOCKETS=360 \
SOCKET_BAR=$((1024**2*$SOCKET_MB)) \
SOCKET_LIM=$(($SOCKET_BAR+($NUM_SOCKETS*2560))) ; \
vzctl set $VZID \
–numothersock $NUM_SOCKETS \
–othersockbuf $SOCKET_BAR:$SOCKET_LIM \
–save

#kmemsize
VZID=199 KMEM_MB=30 \
MB=$((1024**2)) \
KMEM_LIM=$(($KMEM_MB*$MB)) \
KMEM_BAR=$(($KMEM_LIM-($KMEM_LIM/10))) ; \
vzctl set $VZID \
–kmemsize $KMEM_BAR:$KMEM_LIM \
–save

#privvmpages
VZID=199 MEM_MB=1024 KMEM_MB=20 \
PAGE_MB=$((1024**2/4096)) \
MB=$((1024**2)) \
KMEM_LIM=$(($KMEM_MB*$MB)) \
KMEM_BAR=$(($KMEM_LIM-($KMEM_LIM/10))) \
MEM_BAR=$((($MEM_MB-$KMEM_MB)*$PAGE_MB)) \
MEM_LIM=$(($MEM_BAR+($MEM_BAR/10))); \
vzctl set $VZID \
–privvmpages $MEM_BAR:$MEM_LIM \
–kmemsize $KMEM_BAR:$KMEM_LIM \
–save

#disk
VZID=199 DISKGB=8 \
GB=$((1024**2)) \
DISKSOFT=$(($DISKGB*$GB)) \
DISKHARD=$(($DISKSOFT+($DISKSOFT/10))); \
vzquota setlimit $VZID -b $DISKSOFT -B $DISKHARD

Dette indlæg blev udgivet i Knowledge Base, Linux, Old Base. Bogmærk permalinket.

Skriv et svar