Skip to content

[LIVY-1072] Reduce Kubernetes API load in SparkKubernetesApp polling - #545

Open
soumyadeeplogin wants to merge 1 commit into
apache:masterfrom
soumyadeeplogin:livy-item2-reduce-k8s-api-load
Open

[LIVY-1072] Reduce Kubernetes API load in SparkKubernetesApp polling#545
soumyadeeplogin wants to merge 1 commit into
apache:masterfrom
soumyadeeplogin:livy-item2-reduce-k8s-api-load

Conversation

@soumyadeeplogin

@soumyadeeplogin soumyadeeplogin commented Aug 20, 2026

Copy link
Copy Markdown

What changes were proposed in this pull request?

SparkKubernetesApp.getApplicationReport previously issued a single LIST returning every pod tagged with the session's app tag. On large jobs this deserializes hundreds of executor pods into memory on every poll cycle, even though application state is derived only from the driver pod.

Two changes:

  • Narrow the driver lookup to spark-role=driver at the API server so the LIST returns a single pod.
  • Gate the separate executor LIST behind a new config flag livy.server.kubernetes.executor-tracking.enabled (default true, so existing deployments see no behavior change). Operators running large clusters can disable it to skip the executor LIST entirely. When disabled, per-executor Grafana/Loki log URLs and per-executor entries in session diagnostics are omitted; driver state tracking is unaffected.

Adds two tests: default-enabled invariant, and diagnostics graceful degradation when the executor list is empty.

How was this patch tested?

Existing and newly added unit tests in SparkKubernetesAppSpec, plus manual validation against a live Kubernetes cluster running Spark jobs with hundreds of executors.

Was this patch authored or co-authored using generative AI tooling?

Yes. Generated-by: Claude Code (Sonnet 5, Anthropic), used to scan/plan the extraction of local UIP patches for upstreaming and to draft/iterate on the code and tests in this PR under human review. Please refer to the ASF Generative Tooling Guidance for details.

Note on JIRA

Filed as LIVY-1072.

@soumyadeeplogin soumyadeeplogin changed the title Reduce Kubernetes API load in SparkKubernetesApp polling [LIVY-1072] Reduce Kubernetes API load in SparkKubernetesApp polling Aug 21, 2026
@soumyadeeplogin

Copy link
Copy Markdown
Author

Filed https://issues.apache.org/jira/browse/LIVY-1072 for this change.

@soumyadeeplogin

Copy link
Copy Markdown
Author

@gyogal @roczei could one of you approve the CI workflow run for this PR (first-time contributor gate) and take a look when you have a chance? Filed as LIVY-1072.

@gyogal

gyogal commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@soumyadeeplogin Thank you for opening these PRs as your first contributions! Due to a few upgrades done in the last few days, CI tests can only run successfully when rebased to the latest commit. Could you please update your PRs to include the latest commits from the master branch?

SparkKubernetesApp.getApplicationReport previously issued a single LIST
returning every pod tagged with the session's app tag — on large jobs
this deserializes hundreds of executor pods into memory each poll cycle,
even though application state is derived only from the driver pod.

Two changes:
- Narrow the driver lookup to spark-role=driver at the API server so
  the LIST returns a single pod.
- Gate the separate executor LIST on a new config flag
  livy.server.kubernetes.executor-tracking.enabled (default true, so
  existing deployments see no behavior change). Operators running large
  clusters can disable it to skip the executor LIST entirely. When
  disabled, per-executor Grafana/Loki log URLs and per-executor entries
  in session diagnostics are omitted; driver state tracking is
  unaffected.

Adds two tests: default-enabled invariant and diagnostics graceful
degradation when executors is empty.

(cherry picked from commit 27ba941)

Co-authored-by: Soumyadeep Roy <soumyadeep.roy@salesforce.com>
@soumyadeeplogin
soumyadeeplogin force-pushed the livy-item2-reduce-k8s-api-load branch from a8b8632 to 94b0237 Compare August 25, 2026 16:07
@soumyadeeplogin

Copy link
Copy Markdown
Author

Thanks @gyogal -- Just rebased and force-pushed all three PRs onto the latest master. They're clean/mergeable now. Since this is my first contribution, could you also approve the CI workflow when you get a chance?

@roczei

roczei commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@soumyadeeplogin

Thanks for the PR! Could you please add the required AI tooling disclosure to the PR description?

Was this patch authored or co-authored using generative AI tooling?

(If yes, include 'Generated-by: ' followed by the tool name and version. If no, write 'No'.)
Please refer to the ASF Generative Tooling Guidance for details.

@soumyadeeplogin

Copy link
Copy Markdown
Author

Thanks, @roczei! Added the AI tooling disclosure section to the PR description.

@roczei roczei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants