Reputation: 99
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!!!
Upvotes: 3
Views: 191
Reputation: 16940
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)
Upvotes: 5