I am assigned the task to limit the resources (Maximum memory usage and CPU weight) for Apache2 and nginx according to usage statistics, and test that limitation.
For resource limitations, I’ve chosen the easy way — to implement it via systemd’s resource control by running apache2 & nginx in a custom limited slice:
Description=Resource limiting test
And of course added the
Slice=limiter.slice option to apache2 & nginx service files.
Now, nginx and apache2 correctly start in the limited slice (checked with
systemctl status limiter.slice):
● limiter.slice - Resource limiting test
Loaded: loaded (/etc/systemd/system/limiter.slice; enabled; vendor preset: enabled)
Active: active since Wed 2018-07-18 16:07:59 EEST; 3s ago
Memory: 8.1M (max: 800.0M)
│ ├─1823 /usr/sbin/apache2 -k start
│ ├─1841 /usr/sbin/apache2 -k start
│ └─1843 /usr/sbin/apache2 -k start
├─1805 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─1808 nginx: worker process
└─1811 nginx: worker process
I believe that the resource limitation should work. However, I do not have access to any heavily-used apache/nginx servers, so I cannot get close to even making apache2/nginx use that much RAM. And my task is to show what happens when Apache2/Nginx start using that much memory, and it has to be realistic, it really has to be that much RAM, and they do want me to show those web servers running with almost as much RAM usage. You can ignore the CPU Weight, as it is not my main focus.
So, in other words, I need to somehow increase/inflate the RAM usage of those web servers.
- Is the way I’m trying to limit their resource usage a good practice (via systemd slice resource-control)?
- How to go about increasing Apache & Nginx webservers’ memory usage (to about 800M RAM, if possible even higher)?
My machine has 6G RAM, I’m okay with using 2-3G RAM for test cases.
Running Linux Debian 9.4.
Server version: Apache/2.4.25 (Debian)
nginx version: nginx/1.10.3
Note: Apache2 web server is the main focus, doing the same for Nginx is not necessary, it’s just a bonus for research.
I’ve tried to find any ways to benchmark RAM usage, but failed. Keep in mind that I’m doing this on a normal workstation, thus there’s no easy way to deploy apps on the web servers and generate enough traffic naturally in order to get such an increase in memory usage.
I managed to get apache + nginx consuming up to 400-500MB RAM by using heavy
ab benchmarks all the time. However, I still can’t test to see if they would be able to even reach the specified 800MB RAM limit. Any suggestions would be appreciated.
Get this bounty!!!