From e6defad00313d311f987c651b1afe3df6a1f2a62 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Tue, 19 Jun 2018 00:32:45 +0530 Subject: [PATCH] removed psutil as a requirement --- bench/config/nginx.py | 3 +-- bench/config/redis.py | 4 +--- requirements.txt | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bench/config/nginx.py b/bench/config/nginx.py index d3ba4c97..6bbfa9ad 100644 --- a/bench/config/nginx.py +++ b/bench/config/nginx.py @@ -215,7 +215,6 @@ def get_error_pages(): def get_limit_conn_shared_memory(): """Allocate 2 percent of total virtual memory as shared memory for nginx limit_conn_zone""" - import psutil - total_vm = (psutil.virtual_memory().total) / (1024 * 1024) # in MB + total_vm = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')) / (1024 * 1024) # in MB return int(0.02 * total_vm) diff --git a/bench/config/redis.py b/bench/config/redis.py index fe102135..6a32927e 100644 --- a/bench/config/redis.py +++ b/bench/config/redis.py @@ -67,9 +67,7 @@ def get_redis_version(): return float('{major}.{minor}'.format(major=version.major, minor=version.minor)) def get_max_redis_memory(): - import psutil - - total_virtual_mem = psutil.virtual_memory().total/(pow(1024, 2)) + total_virtual_mem = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')/(pow(1024, 2)) max_memory = int(total_virtual_mem * 0.05) # Max memory for redis is 5% of virtual memory if max_memory < 50: diff --git a/requirements.txt b/requirements.txt index 4365cc1d..9b2c5b30 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,6 @@ jinja2 virtualenv requests honcho -psutil python-crontab semantic_version GitPython==0.3.2.1