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.
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. Should be less than or equal to the duration input. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. | Default: 30s . Examples: 1m25s , 1h3m2s , 1h3s |
duration | Duration through which chaos is injected into the target resource. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. | Default: 30s . Examples: 1m25s , 1h3m2s , 1h3s |
rampTime | Period to wait before and after injecting chaos. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. | Default: 0s . Examples: 1m25s , 1h3m2s , 1h3s |
Services
The services
input variable targets services to be stopped.
The following YAML snippet illustrates the use of this input 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: 30s
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 input 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: 30s
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 input 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: 30s
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 input 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: 30s
interval: 10s