Skip to content

Instantly share code, notes, and snippets.

@inkel
Created October 21, 2010 15:10
Show Gist options
  • Save inkel/638645 to your computer and use it in GitHub Desktop.
Save inkel/638645 to your computer and use it in GitHub Desktop.
OpenVZ lower memory utilization
# OpenVZ lower memory utilization, according to
# http://wiki.openvz.org/UBC_systemwide_configuration#.E2.80.9CLow_memory.E2.80.9D_.28x86_32_specific.29
#
# AWK script to calculate lower memory utilization
lowmem() {
awk '$1 ~ /kmemsize|tcprcvbuf|tcpsndbuf|dgramrcvbuf|othersockbuf/ { M+=$2 } END { print M / (0.4 * 832 * 1024 * 1024 ) }' $*
}
# Reading user bean counters, low mem usage is: 0.137789
lowmem /proc/user_beancounters
# Reading all resources files in /proc/bc, low mem usage is: 0.372573
lowmem /proc/bc/*/resources
# Only counting running containers, low mem usage is: 0.288026
lowmem /proc/bc/{101..108}/resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment