summaryrefslogtreecommitdiffstats
path: root/demo/nginx_proxy/demo-1/adjust_hugepage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'demo/nginx_proxy/demo-1/adjust_hugepage.sh')
-rw-r--r--demo/nginx_proxy/demo-1/adjust_hugepage.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/demo/nginx_proxy/demo-1/adjust_hugepage.sh b/demo/nginx_proxy/demo-1/adjust_hugepage.sh
new file mode 100644
index 0000000..282e3bd
--- /dev/null
+++ b/demo/nginx_proxy/demo-1/adjust_hugepage.sh
@@ -0,0 +1,14 @@
+#!/bin/bash -x
+hugepagesize=$(cat /proc/meminfo | grep Hugepagesize | awk -F " " {'print$2'})
+if [ "$hugepagesize" == "2048" ]; then
+ pages=3000
+elif [ "$hugepagesize" == "1048576" ]; then
+ pages=5
+fi
+sudo sysctl -w vm.nr_hugepages=$pages
+HUGEPAGES=`sysctl -n vm.nr_hugepages`
+echo "Configured hugepages: $HUGEPAGE"
+if [ $HUGEPAGES != $pages ]; then
+ echo "Warning: Unable to get $pages hugepages, only got $HUGEPAGES. Cannot finish."
+fi
+