Linux service restart
Linux service restart stops the target system services running in a Linux machine.
- It determines the performance and resilience of the application (or services) running on Linux machines.
Use cases
- Service restart determines the resilience of an application upon random halts.
- Determines how efficiently an application recovers and restarts the services.
- This fault can be executed on Ubuntu 16 or higher, Debian 10 or higher, CentOS 7 or higher, RHEL 7 or higher, Fedora 30 or higher, and openSUSE LEAP 15.4 or higher.
- The
linux-chaos-infrastructure
systemd service should be in an active state, and the infrastructure should be inCONNECTED
state.
Fault permissions
The fault uses the root
Linux user and root
user group.
Fault tunables
Mandatory tunables
Tunable | Description | Notes |
---|---|---|
services | Names of the target services. | For example nginx,apache2,sshd |
Optional tunables
Tunable | Description | Notes |
---|---|---|
selfHealingServices | Set to true if the service restarts on its own upon stopping it. | Defaults to false . |
sequence | Sequence in which the services will be stopped. | Supports serial and parallel . Defaults to parallel . |
interval | Duration of a single iteration of chaos (in seconds). Should be less than or equal to the duration input. | Defaults to 30. |
duration | Duration through which chaos is injected into the target resource (in seconds). | Defaults to 30. |
rampTime | Period to wait before and after injecting chaos (in seconds). | Defaults to 0. |
Services
The services
input variable targets services to be stopped.
The following YAML snippet illustrates the use of this environment variable:
# specify target services
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-service-restart
labels:
name: service-restart
spec:
serviceRestartChaos/inputs:
services: "apache2,nginx"
duration: 30
Self-healing services
The selfHealingServices
input variable restarts the services on their own after the service was stopped.
The following YAML snippet illustrates the use of this environment variable:
# specify self healing services
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-service-restart
labels:
name: service-restart
spec:
serviceRestartChaos/inputs:
services: "apache2,nginx"
selfHealingServices: true
duration: 30
Sequence
The sequence
input variable stops the services. Services can be stopped in parallel, that is, all services can be stopped at once for every iteration of chaos or serially, that is, one after the other for every iteration of chaos.
The following YAML snippet illustrates the use of this environment variable:
# specify chaos sequence
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-service-restart
labels:
name: service-restart
spec:
serviceRestartChaos/inputs:
services: "apache2,nginx"
sequence: "serial"
duration: 30
Interval
The interval
input variable specifies the duration of a single iteration of chaos, which is less than or equal to duration
, and denotes the entire duration of the fault execution. You can tune multiple iterations of the chaos injection.
The following YAML snippet illustrates the use of this environment variable:
# three iterations of chaos
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-service-restart
labels:
name: service-restart
spec:
serviceRestartChaos/inputs:
services: "apache2,nginx"
sequence: "parallel"
duration: 30
interval: 10