Skip to content

Commit 0331999

Browse files
Paul Angusyadvr
authored andcommitted
systemvm: improve SystemVM startup and memory usage (#3126)
In order to reduce memory footprint and improve boot speed/predictability. The following changes have been made: - add vm.min_free_kbytes to sysctl - periodically clear disk cache (depending on memory size) - only start guest services specific to hypervisor - use systemvm code to determine hypervisor type (not systemd) - start cloud service at end of post init rather than through systemd - reduce initial threads started for httpd - fix vmtools config file Fixes #3039 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 0833cf1 commit 0331999

17 files changed

Lines changed: 181 additions & 54 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# event MPM
2+
# StartServers: initial number of server processes to start
3+
# MinSpareThreads: minimum number of worker threads which are kept spare
4+
# MaxSpareThreads: maximum number of worker threads which are kept spare
5+
# ThreadsPerChild: constant number of worker threads in each server process
6+
# MaxRequestWorkers: maximum number of worker threads
7+
# MaxConnectionsPerChild: maximum number of requests a server process serves
8+
<IfModule mpm_event_module>
9+
StartServers 1
10+
MinSpareThreads 25
11+
MaxSpareThreads 75
12+
ThreadLimit 64
13+
ThreadsPerChild 25
14+
MaxRequestWorkers 30
15+
MaxConnectionsPerChild 1000
16+
</IfModule>
17+
18+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# clear memory cache to ultimately reduce swapping
4+
5+
sync && echo 1 > /proc/sys/vm/drop_caches
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# clear memory cache to ultimately reduce swapping
4+
5+
phymem=$(free|awk '/^Mem:/{print $2}')
6+
if [ $phymem -lt 513000 ]; then
7+
sync && echo 1 > /proc/sys/vm/drop_caches
8+
fi

systemvm/debian/etc/sysctl.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ net.ipv6.conf.all.autoconf = 0
6363

6464
# Minimum swappiness without disabling it
6565
vm.swappiness=1
66+
67+
# make the kernel more aggressive in reclaiming RAM from the disk and swap caches
68+
vm.vfs_cache_pressure = 200
69+
70+
# try to maintain 'free' memory thereby reducing the size of disk cache, hence reducing swapping.
71+
vm.min_free_kbytes = 20480
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[logging]
2+
# Turns on logging globally. It can still be disabled for each domain.
3+
# log = true
4+
5+
# Disables core dumps on fatal errors; they're enabled by default.
6+
enableCoreDump = false
7+
8+
# Defines the "vmsvc" domain, logging to file
9+
# vmsvc.level = message
10+
vmsvc.handler = file
11+
# Setup file rotation - keep 3 files
12+
vmsvc.maxOldLogFiles = 2
13+
# Max log file size kept: 1 MB
14+
vmsvc.maxLogSize = 1
15+
16+
# Defines the "vmtoolsd" domain, and disable logging for it.
17+
# vmtoolsd.level = none

systemvm/debian/etc/systemd/system/baremetal-vr.service renamed to systemvm/debian/lib/systemd/system/baremetal-vr.service

File renamed without changes.

systemvm/debian/etc/systemd/system/cloud.service renamed to systemvm/debian/lib/systemd/system/cloud.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Unit]
22
Description=CloudStack Agent service
3-
After=cloud-early-config.service network.target local-fs.target
3+
After=cloud-early-config.service network.target cloud-postinit.service local-fs.target
44

55
[Install]
66
WantedBy=multi-user.target
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Hyper-V file copy service (FCOPY) daemon
3+
ConditionPathExists=/dev/vmbus/hv_fcopy
4+
5+
[Service]
6+
ExecStart=/usr/sbin/hv_fcopy_daemon -n
7+
8+
[Install]
9+
WantedBy=multi-user.target
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Hyper-V key-value pair (KVP) daemon
3+
4+
[Service]
5+
ExecStart=/usr/sbin/hv_kvp_daemon -n
6+
7+
[Install]
8+
WantedBy=multi-user.target
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Hyper-V volume shadow copy service (VSS) daemon
3+
4+
[Service]
5+
ExecStart=/usr/sbin/hv_vss_daemon -n
6+
7+
[Install]
8+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)