## Introduction
- It can target random pods with a Spring Boot application and allows configuring the assaults to inject network latency to every nth request. This can be tuned via `CM_LEVEL` ENV.
!!! tip "Scenario: Inject network latency to Spring Boot Application"

## Uses
??? info "View the uses of the experiment"
coming soon
## Prerequisites
??? info "Verify the prerequisites"
Variables |
Description |
Notes |
CM_LEVEL |
It contains number of requests are to be attacked, n value means nth request will be affected |
Defaults value: 1, it lies in [1,10000] range |
CM_WATCHED_CUSTOM_SERVICES |
It limits watched packages/classes/methods, it contains comma seperated list of fully qualified packages(class and/or method names) |
ByDefault it is empty list, which means it target all services |
CM_WATCHERS |
It contains comma separated list of watchers from the following watchers list [controller, restController, service, repository, component, webClient] |
ByDefault it is restController |
TOTAL_CHAOS_DURATION |
The time duration for chaos injection (seconds) |
Defaults to 30 |
SEQUENCE |
It defines sequence of chaos execution for multiple target pods |
Default value: parallel. Supported: serial, parallel |
PODS_AFFECTED_PERC |
The Percentage of total pods to target |
Defaults to 0% (corresponds to 1 replica) |
LIB |
The chaos lib used to inject the chaos |
Defaults to litmus . Supported litmus only |
RAMP_TIME |
Period to wait before and after injection of chaos in sec |
|
## Experiment Examples
### Common Experiment Tunables
Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Spring Boot specific tunable](spring-boot-experiments-tunables.md) to tune the common tunables for all experiments and spring-boot specific tunables.
### Spring Boot Application Port
It tunes the spring-boot application port via `CM_PORT` ENV
Use the following example to tune this:
[embedmd]:# (./spring-boot-latency/target-port.yaml yaml)
```yaml
# kill spring-boot target application
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: spring-boot-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=spring-boot'
appkind: 'deployment'
# It can be active/stop
engineState: 'active'
chaosServiceAccount: spring-boot-latency-sa
experiments:
- name: spring-boot-latency
spec:
components:
env:
# port of the spring boot application
- name: CM_PORT
value: '8080'
```
### Network Latency
It contains network latency value in ms. It can be tunes via `LATENCY` ENV
Use the following example to tune this:
[embedmd]:# (./spring-boot-latency/latency.yaml yaml)
```yaml
# provide the network latency
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: spring-boot-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=spring-boot'
appkind: 'deployment'
# It can be active/stop
engineState: 'active'
chaosServiceAccount: spring-boot-latency-sa
experiments:
- name: spring-boot-latency
spec:
components:
env:
# provide the latency (ms)
- name: LATENCY
value: '2000'
# port of the spring boot application
- name: CM_PORT
value: '8080'
```