Memory optimized

This commit is contained in:
Mark Korondi 2017-04-12 13:44:58 +02:00
parent 74f3553d78
commit f7470b2ce6
10 changed files with 75 additions and 14 deletions

View File

@ -50,6 +50,8 @@ Instructions
This step takes about 10 minutes, it needs an internet connection,
however the expected downloaded data stays low if using a fresh enough
appliance.
6. To lower the memory consumption, run `optimize-memory` which configures
horizon, keystone and mysql to use less memory.
### Building your own
@ -84,7 +86,8 @@ After booting up the virtual machine, start setting up devstack. It takes around
10 minutes to finish, until then you can get familiar with the environment the
VM provides you with.
Open up a terminal and run `/opt/devstack/stack.sh`
Open up a terminal and run `/opt/devstack/stack.sh`. To reduce memory usage in
your VM, also run `optimize-memory`.
The four main software you will be using from the desktop during the training
are

6
Vagrantfile vendored
View File

@ -2,12 +2,14 @@ Vagrant.configure(2) do |config|
config.vm.hostname = "upstream-training"
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "5632"
vb.memory = "4608"
vb.cpus = 2
vb.name = "upstream-training"
vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
vb.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]
vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
vb.customize ["modifyvm", :id, "--vram", "32"]
vb.customize ["modifyvm", :id, "--natnet1", "192.168.10/24"]
end
config.vm.provision :shell, inline: "/vagrant/install-base.sh",
privileged: false, keep_color: true
@ -17,6 +19,8 @@ Vagrant.configure(2) do |config|
privileged: false, keep_color: true
config.vm.provision :shell, inline: "/vagrant/configure-vagrant.sh",
privileged: false, keep_color: true
config.vm.provision :shell, inline: "/vagrant/cleanup.sh",
privileged: false, keep_color: true
config.vm.box_check_update = false
config.ssh.forward_x11 = true
config.ssh.forward_agent = true

13
cleanup.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Empty packages cache
sudo apt clean
# Remove compiled pyc files
sudo updatedb
for pyc in $(locate *.pyc); do
sudo rm -rf $pyc
done
# Empty user caches
rm -rf ~/.cache/*

View File

@ -4,6 +4,6 @@ vagrant up
vagrant halt
echo "Creating Virtual Appliance..."
vboxmanage sharedfolder remove devstack-training --name vagrant
vboxmanage export devstack-training \
-o "dist/devstack-training-$(date +%Y%m%d-%H%M).ova"
vboxmanage sharedfolder remove upstream-training --name vagrant
vboxmanage export upstream-training \
-o "dist/upstream-training-$(date +%Y%m%d-%H%M).ova"

View File

@ -1,8 +1,4 @@
[[local|localrc]]
# Required for Virtualbox standard 'Nat' networking, since devstack cannot
# determine host ip address
HOST_IP=10.0.2.15
# This line will be uncommented at the end of devstack setup so that starting up
# the VM again would not require high network bandwith to check and install
# packages

View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Tune mysql
sudo tee -a /etc/mysql/my.cnf << EOF
# Courtesy of Morgan Tocker
# http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html
[mysqld]
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
query_cache_size=0
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
innodb_ft_cache_size=1600000
innodb_ft_total_cache_size=32000000
# per thread or per operation settings
thread_stack=131072
sort_buffer_size=32K
read_buffer_size=8200
read_rnd_buffer_size=8200
max_heap_table_size=16K
tmp_table_size=1K
bulk_insert_buffer_size=0
join_buffer_size=128
net_buffer_length=1K
innodb_sort_buffer_size=64K
#settings that relate to the binary log (if enabled)
binlog_cache_size=4K
binlog_stmt_cache_size=4K
EOF
sudo service mysql restart
# Set Apache WSGI modules' process and thread count
sudo sed -i '/WSGIDaemonProcess/s/processes=[0-9]*/processes=1/g' /etc/apache2/sites-available/horizon.conf
sudo sed -i '/WSGIDaemonProcess/s/threads=[0-9]*/threads=5/g' /etc/apache2/sites-available/horizon.conf
sudo sed -i '/WSGIDaemonProcess/s/processes=[0-9]*/processes=1/g' /etc/apache2/sites-available/keystone.conf
sudo sed -i '/WSGIDaemonProcess/s/processes=[0-9]*/processes=1/g' /etc/apache2/sites-available/placement-api.conf
sudo service apache2 reload

View File

@ -22,8 +22,6 @@ sudo apt install -y git gitk git-gui git-review tig
# Install basic TUI applications
sudo apt install -y htop mc tmux
sudo apt clean
# Copy configs
sudo cp -ar "$REPO/files/etc" /
sudo cp -ar "$REPO/files/home" /
@ -31,3 +29,7 @@ sudo chown -R "$USER:$GROUP" /home/
# Set password
echo "$USER:openstack" | sudo chpasswd
# Copy scripts
sudo cp -ar "$REPO/files/usr" /

View File

@ -11,7 +11,6 @@ cp -ar "$REPO/files/opt" /
/opt/devstack/stack.sh
sudo apt clean
# Enable OFFLINE mode for next invoking stack.sh to be faster
sed -i 's/#OFFLINE=/OFFLINE=/' /opt/devstack/local.conf

View File

@ -13,4 +13,3 @@ sudo apt install -y firefox xfce4-terminal xfce4-whiskermenu-plugin \
# Configure virtualbox GUI
sudo apt install -y virtualbox-guest-dkms virtualbox-guest-x11
sudo apt clean