diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/experiments.ts b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/experiments.ts index 8dba44ef52b..a98ab6fafe6 100644 --- a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/experiments.ts +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/experiments.ts @@ -227,7 +227,19 @@ export const experiments: ExperimentDetails[] = [ name: "Pod JVM trigger gc", description:"Pod JVM trigger gc triggers the garbage collector for a Java process executing in a Kubernetes pod. This causes unused (or out of scope) objects and variables to be garbage collected and recycled, thereby freeing up memory space.", tags: ["pod", "jvm"], - category: "kubernetes", + category: "kubernetes", + }, + { + name: "Pod JVM SQL Exception", + description:"Pod JVM SQL Exception injects exception in sql queries for a Java application executing in a Kubernetes pod", + tags: ["pod", "jvm", "sql", "exception"], + category: "kubernetes", + }, + { + name: "Pod JVM SQL Latency", + description:"Pod JVM SQL Latency injects latency in sql queries for a Java application executing in a Kubernetes pod", + tags: ["pod", "jvm", "sql", "latency"], + category: "kubernetes", }, { name: "Pod memory hog exec", diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/kubernetes.md b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/kubernetes.md index 24c8655509b..61b6a5730da 100644 --- a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/kubernetes.md +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/kubernetes.md @@ -480,6 +480,38 @@ Pod JVM trigger gc triggers the garbage collector for a Java process executing i +### Pod JVM sql exception + +Pod JVM sql exception injects chaos into a Java application executing in a Kubernetes pod by invoking an SQL exception. + + +Use cases +- Determines the performance bottlenecks of the application +- Simulates SQL exceptions to ensure if application can recover gracefully +- Assess if the monitoring systems and alerting mechanisms can accurately detect and report SQL query exceptions in real-time. +- Determines the performance and resilience of the dependant application (or services) running on Kubernetes. + + + + + + +### Pod JVM sql latency + +Pod JVM sql latency injects chaos into a Java application executing in a Kubernetes pod by invoking latency in sql queries. + + +Use cases +- Determines the performance bottlenecks of the application +- Simulate database latency to evaluate how the application handles slower SQL queries +- Test the impact of SQL query latency on the end-user experience, ensuring the application behaves gracefully under slower response times. +- Determines the performance and resilience of the dependant application (or services) running on Kubernetes. + + + + + + ### Pod memory hog exec Pod memory hog exec is a Kubernetes pod-level chaos fault that consumes memory resources on the application container in megabytes. diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-exception.md b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-exception.md new file mode 100644 index 00000000000..a8f070bd78a --- /dev/null +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-exception.md @@ -0,0 +1,167 @@ +--- +id: pod-jvm-sql-exception +title: Pod JVM SQL Exception +--- + +Pod JVM SQL Exception fault simulates SQL query failures by raising exceptions for SQL queries executed by the Java process running inside a Kubernetes pod. This helps test the application's behavior and resilience against SQL-related errors. + +:::tip +JVM chaos faults use the [Byteman utility](https://byteman.jboss.org/) to inject chaos faults into the JVM. +::: + +![Pod JVM SQL Exception](./static/images/pod-jvm-sql-exception.png) + +### Use cases +Pod JVM SQL exception: +- Validate the application's resilience by simulating SQL exceptions to ensure it can recover gracefully, retry operations, or switch to backup databases without affecting functionality. +- Assess if the monitoring systems and alerting mechanisms can accurately detect and report SQL query exceptions in real-time. +- Trigger exception-handling paths in the application to ensure coverage of edge cases related to SQL query failures during testing. + + +### Mandatory tunables + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tunable Description Notes
TABLE The name of the SQL table to be targeted. For more information, go to Parameters
SQL_DATA_ACCESS_FRAMEWORK The name of the data access framework. It supports MYSQL5, MYSQL8, and HIBERNATE types. For more information, go to Parameters
SQL_EXCEPTION_CLASS The name of the exception class. For more information, go to Parameters
SQL_EXCEPTION_MESSAGE The exception message to be raised. For more information, go to Parameters
+ +### Optional tunables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tunable Description Notes
TOTAL_CHAOS_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. For more information, go to duration of the chaos.
SQL_OPERATION The type of SQL query to be targeted. If not provided, it targets all SQL queries. For example: select. For more information, go to Parameters
TRANSACTION_PERCENTAGE The percentage of total SQL queries to be targeted. Supports percentage in (0.00,1.00] range. If not provided, it targets all SQL queries. For more information, go to Parameters
POD_AFFECTED_PERCENTAGE Percentage of total pods to target. Provide numeric values. Default: 0 (corresponds to 1 replica). For more information, go to pods affected percentage.
JAVA_HOME Path to the Java installation directory. For example, /tmp/dir/jdk.
BYTEMAN_PORT Port used by the Byteman agent. Default: 9091.
CONTAINER_RUNTIME Container runtime interface for the cluster. Default: containerd. Support values: docker, containerd and crio. For more information, go to container runtime.
SOCKET_PATH Path of the containerd or crio or docker socket file. Default: /run/containerd/containerd.sock. For more information, go to socket path.
RAMP_TIME 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. For more information, go to ramp time.
SEQUENCE Sequence of chaos execution for multiple target pods. Default: parallel. Supports serial and parallel. For more information, go to sequence of chaos execution.
TARGET_CONTAINER Name of the container subject to API header modification. None. For more information, go to target specific container
TARGET_PODS Comma-separated list of application pod names subject to pod HTTP modify body. If not provided, the fault selects target pods randomly based on provided appLabels. For more information, go to target specific pods.
NODE_LABEL It filters the target pods that are scheduled on nodes matching the specified `NODE_LABEL`. For more information, go to node label.
LIB_IMAGE Image used to inject chaos. Default: harness/ddcr-faults:main-latest. For more information, go to image used by the helper pod.
+ +### Parameters + +The following YAML snippet illustrates the use of these tunables: + +[embedmd]:# (./static/manifests/pod-jvm-sql-exception/params.yaml yaml) +```yaml +kind: KubernetesChaosExperiment +apiVersion: litmuschaos.io/v1alpha1 +metadata: + name: pod-jvm-sql-exception + namespace: hce +spec: + tasks: + - definition: + chaos: + env: + - name: TOTAL_CHAOS_DURATION + value: "60" + # provide the sql table name + - name: TABLE + value: "product" + # provide the sql operation name + # it supports select, insert, update, delete, replace types + - name: SQL_OPERATION + value: "select" + # name of the data access framework + # it supports MYSQL5, MYSQL8, HIBERNATE types + - name: SQL_DATA_ACCESS_FRAMEWORK + value: "MYSQL8" + # name of the sql exception class + - name: SQL_EXCEPTION_CLASS + value: "com.mysql.cj.exceptions.CJException" + # provide the exception message + - name: SQL_EXCEPTION_MESSAGE + value: "CHAOS BOOM!" + # provide the transaction percentage + - name: TRANSACTION_PERCENTAGE + value: "50" +``` \ No newline at end of file diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-latency.md b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-latency.md new file mode 100644 index 00000000000..759316b45c5 --- /dev/null +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/pod-jvm-sql-latency.md @@ -0,0 +1,157 @@ +--- +id: pod-jvm-sql-latency +title: Pod JVM SQL Latency +--- + +Pod JVM SQL Latency fault introduces latency in the SQL queries executed by the Java process running inside a Kubernetes pod. +:::tip +JVM chaos faults use the [Byteman utility](https://byteman.jboss.org/) to inject chaos faults into the JVM. +::: + +![Pod JVM SQL Latency](./static/images/pod-jvm-sql-latency.png) + +### Use cases +Pod JVM SQL latency: +- Simulate database latency to evaluate how the application handles slower SQL queries, assess system performance under delayed database responses, and identify potential bottlenecks in handling high volumes of requests. +- Test the impact of SQL query latency on the end-user experience, ensuring the application behaves gracefully under slower response times. This includes validating timeouts, retries, and fallback mechanisms to maintain a seamless user experience. +- Ensure that the application can handle delayed SQL queries without failing. Test timeout configurations, error-handling strategies, and automatic recovery processes to verify that the system can withstand latency-induced delays without causing critical failures. + +### Mandatory tunables + + + + + + + + + + + + + + + + + + + + + +
Tunable Description Notes
TABLE The name of the SQL table to be targeted. For more information, go to Parameters
SQL_DATA_ACCESS_FRAMEWORK The name of the data access framework. It supports MYSQL5, MYSQL8, and HIBERNATE types. For more information, go to Parameters
SQL_LATENCY The latency to be injected into the SQL queries (in ms). For more information, go to Parameters
+ +### Optional tunables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tunable Description Notes
TOTAL_CHAOS_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. For example: 1m25s, 1h3m2s, 1h3s. For more information, go to duration of the chaos.
SQL_OPERATION The type of SQL query to be targeted. If not provided it targets all SQL queries. For example: select. For more information, go to Parameters
TRANSACTION_PERCENTAGE The percentage of total SQL queries to be targeted. Supports percentage in (0.00,1.00] range. If not provided, it targets all SQL queries. For more information, go to Parameters
POD_AFFECTED_PERCENTAGE Percentage of total pods to target. Provide numeric values. Default: 0 (corresponds to 1 replica). For more information, go to pods affected percentage
JAVA_HOME Path to the Java installation directory. For example, /tmp/dir/jdk.
BYTEMAN_PORT Port used by the Byteman agent. Default: 9091.
CONTAINER_RUNTIME Container runtime interface for the cluster Default: containerd. Support values: docker, containerd and crio. For more information, go to container runtime.
SOCKET_PATH Path of the containerd or crio or docker socket file. Default: /run/containerd/containerd.sock. For more information, go to socket path.
RAMP_TIME Period to wait before and after injecting chaos. Should be provided in [numeric-hours]h[numeric-minutes]m[numeric-seconds]s format. Default: 0s. For example: 1m25s, 1h3m2s, 1h3s. For more information, go to ramp time.
SEQUENCE Sequence of chaos execution for multiple target pods. Default: parallel. Supports serial and parallel. For more information, go to sequence of chaos execution.
TARGET_CONTAINER Name of the container subject to API header modification. None. For more information, go to target specific container
TARGET_PODS Comma-separated list of application pod names subject to pod HTTP modify body. If not provided, the fault selects target pods randomly based on provided appLabels. For more information, go to target specific pods.
NODE_LABEL It filters the target pods that are scheduled on nodes matching the specified `NODE_LABEL`. For more information, go to node label.
LIB_IMAGE Image used to inject chaos. Default: harness/ddcr-faults:main-latest. For more information, go to image used by the helper pod.
+ +### Parameters + +The following YAML snippet illustrates the use of these tunables: + +[embedmd]:# (./static/manifests/pod-jvm-sql-latency/params.yaml yaml) +```yaml +kind: KubernetesChaosExperiment +apiVersion: litmuschaos.io/v1alpha1 +metadata: + name: pod-jvm-sql-latency + namespace: hce +spec: + tasks: + - definition: + chaos: + env: + - name: TOTAL_CHAOS_DURATION + value: "60" + # provide the sql table name + - name: TABLE + value: "product" + # provide the sql operation name + # it supports select, insert, update, delete, replace types + - name: SQL_OPERATION + value: "select" + # name of the data access framework + # it supports MYSQL5, MYSQL8, HIBERNATE types + - name: SQL_DATA_ACCESS_FRAMEWORK + value: "MYSQL8" + # provide the latency in ms + - name: SQL_LATENCY + value: "2000" #in ms + # provide the transaction percentage + - name: TRANSACTION_PERCENTAGE + value: "50" +``` \ No newline at end of file diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-exception.png b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-exception.png new file mode 100644 index 00000000000..0402ced40d1 Binary files /dev/null and b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-exception.png differ diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-latency.png b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-latency.png new file mode 100644 index 00000000000..bbf5f8c7a36 Binary files /dev/null and b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/images/pod-jvm-sql-latency.png differ diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-exception/params.yaml b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-exception/params.yaml new file mode 100644 index 00000000000..0d42fa91068 --- /dev/null +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-exception/params.yaml @@ -0,0 +1,32 @@ +kind: KubernetesChaosExperiment +apiVersion: litmuschaos.io/v1alpha1 +metadata: + name: pod-jvm-sql-exception + namespace: hce +spec: + tasks: + - definition: + chaos: + env: + - name: TOTAL_CHAOS_DURATION + value: "60" + # provide the sql table name + - name: TABLE + value: "product" + # provide the sql operation name + # it supports select, insert, update, delete, replace types + - name: SQL_OPERATION + value: "select" + # name of the data access framework + # it supports MYSQL5, MYSQL8, HIBERNATE types + - name: SQL_DATA_ACCESS_FRAMEWORK + value: "MYSQL8" + # name of the sql exception class + - name: SQL_EXCEPTION_CLASS + value: "com.mysql.cj.exceptions.CJException" + # provide the exception message + - name: SQL_EXCEPTION_MESSAGE + value: "CHAOS BOOM!" + # provide the transaction percentage + - name: TRANSACTION_PERCENTAGE + value: "50" \ No newline at end of file diff --git a/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-latency/params.yaml b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-latency/params.yaml new file mode 100644 index 00000000000..fb1b7336b42 --- /dev/null +++ b/docs/chaos-engineering/use-harness-ce/chaos-faults/kubernetes/pod/static/manifests/pod-jvm-sql-latency/params.yaml @@ -0,0 +1,29 @@ +kind: KubernetesChaosExperiment +apiVersion: litmuschaos.io/v1alpha1 +metadata: + name: pod-jvm-sql-latency + namespace: hce +spec: + tasks: + - definition: + chaos: + env: + - name: TOTAL_CHAOS_DURATION + value: "60" + # provide the sql table name + - name: TABLE + value: "product" + # provide the sql operation name + # it supports select, insert, update, delete, replace types + - name: SQL_OPERATION + value: "select" + # name of the data access framework + # it supports MYSQL5, MYSQL8, HIBERNATE types + - name: SQL_DATA_ACCESS_FRAMEWORK + value: "MYSQL8" + # provide the latency in ms + - name: SQL_LATENCY + value: "2000" #in ms + # provide the transaction percentage + - name: TRANSACTION_PERCENTAGE + value: "50" \ No newline at end of file