Can python script (Or any other programming language scripts) be used to restrict resources (like RAM, CPU Usage) used by other applications?
openstack, openstack-swift, performance, python, resources
Solution
By using python resource module you can set the resource limit, please check more detail in the official docs resource
import resource
resource.setrlimit(resource.RLIMIT_CPU, (1, 1))
By using subprocess you can change the ulimit: system wide resource and nice level i.e scheduling priority.
import subprocess
subprocess.Popen('ulimit -t 10; nice -n 15 application_name', shell=True)
Problem
For my project, I am supposed to measure system performance of OpenStack SWIFT based on available resources like RAM, CPU, etc.. So, I was wondering, can I use a python script or some other programming language scripts to restrict the resources usage by OpenStack SWIFT to measure the impacts of those resources on the OpenStack SWIFT ??? Please reply!!!