From a66450808f356610945e11647e2746f37bc305e2 Mon Sep 17 00:00:00 2001 From: eneller Date: Wed, 15 Nov 2023 16:36:04 +0100 Subject: [PATCH] oracle: README --- oracle/README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 oracle/README.md diff --git a/oracle/README.md b/oracle/README.md new file mode 100644 index 0000000..95e06d7 --- /dev/null +++ b/oracle/README.md @@ -0,0 +1,71 @@ +# Oracle +The requirements to keep Oracle from reclaiming always free resources can be found [here](https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier_topic-Always_Free_Resources.htm). +They currently are: +- CPU utilization for the 95th percentile is less than 15% +- Network utilization is less than 15% +- Memory utilization is less than 15% (applies to A1 shapes only) + + +```bash +sudo su - +apt update +apt install supervisor stress-ng +``` + +After we have both tools installed we can go ahead and run the following commands to send some load to our CPUs and Memory: + +The command below will put 15% load on each of the 4 CPUs available, we can tweak the numbers below as we wish to meet our requirements. + +``` +stress-ng --cpu 4 --cpu-load 15 +``` + +The line below will take 15% of our total memory and hold it. So if we are already using lets say 2% of our total memory running this command will cause 17% memory utilization. Again we can tweak these numbers as we wish to meet our requirements. + +``` +stress-ng --vm 1 --vm-bytes 15% --vm-hang 0 +``` + +To terminate these commands all we need to do is press Ctrl-c. + +Once we have adjusted these commands to fit our needs. We need to create supervisor configuration file . The supervisor configuration file will ensure that stress-ng is always running on our instance. To create the file we run the following command. +` +nano /etc/supervisor/conf.d/stress.conf +` + +Copy and paste the following config to your “stress.conf” this is just and example make sure to tweak it to meet your requirements. The config below will create two programs “cpu_stress” and “memory_stress” the two programs will run the two “stress-ng” commands we ran above simultaneously, it will auto start them on boot and auto-restart them if they get crash or get killed. + +``` +[program:cpu_stress] +command=/usr/bin/stress-ng --cpu 4 --cpu-load 15 +directory=/usr/bin/ +user=root +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/var/log/stress.log + +[program:memory_stress] +command=/usr/bin/stress-ng --vm 1 --vm-bytes 15%% --vm-hang 0 +directory=/usr/bin/ +user=root +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/var/log/stress.log +``` + +To get supervisor to start the two program we have we first need to reload the configuration file we do that by running the following command. Run the command below anytime you make changes to this config file or create new file! +` +sypervisorctl reread +` + +Next we can go ahead and reload the “supervisorctl” to start the two programs. +` +sypervisorctl reload +` + +You can check the status of the programs by running +` +supervisorctl status +`