Web UI

Apache Spark provides a suite of web user interfaces (UIs) that you can use to monitor the status and resource consumption of your Spark cluster.

Table of Contents

Overview

The Web UI is built into every Spark application: while the application is running, it serves a set of web pages that let you inspect what is happening inside it. Typical uses include monitoring a running job, diagnosing a failure, analyzing the execution plan of a slow SQL query, and checking how memory and tasks are distributed across executors.

By default the Web UI is available at http://<driver-host>:4040. When that port is already in use (for example, when several Spark applications run on the same host), Spark tries 4041, 4042, and so on until it finds a free port, and logs the chosen port at startup. You can override the default port with spark.ui.port, and tune other UI behavior through the spark.ui.* properties documented in the Configuration reference.

The Web UI is tied to the lifetime of the application: once it exits, the UI is no longer reachable. To inspect an application after it has finished, enable event logging and run the Spark History Server, which reconstructs an equivalent UI from the persisted event log; see Monitoring and Instrumentation for setup details.

The remaining sections walk through each tab in the Web UI’s top navigation bar.

Jobs Tab

The Jobs tab displays a summary page of all jobs in the Spark application and a details page for each job. The summary page shows high-level information, such as the status, duration, and progress of all jobs and the overall event timeline. When you click on a job on the summary page, you see the details page for that job. The details page further shows the event timeline, DAG visualization, and all stages of the job.

The information displayed at the top of the page includes:

The current user, application start time, and total uptime are shown in the footer at the bottom of every page.

All Jobs page

Jobs detail

This page displays the details of a specific job identified by its job ID.

Job detail page

Stages Tab

The Stages tab displays a summary page that shows the current state of all stages of all jobs in the Spark application.

At the top of the page is a summary with the count of all stages by status (active, pending, completed, skipped, and failed). In Fair scheduling mode a table of pool properties is also shown.

Below the summary are the stages, grouped by status (active, pending, completed, skipped, failed). An active stage shows a small (kill) link next to its description; clicking it asks Spark to cancel that stage. Only failed stages show the failure reason. Click a stage’s description to open its Stage detail page.

Stages tab

Stage detail

The stage detail page begins with information like total time across all tasks, Locality level summary, Shuffle Read Size / Records and Associated Job IDs.

It also shows a visual representation of the directed acyclic graph (DAG) of this stage, where vertices represent the RDDs or DataFrames and the edges represent an operation to be applied. Nodes are grouped by operation scope in the DAG visualization and labelled with the operation scope name (BatchScan, WholeStageCodegen, Exchange, etc). Notably, whole-stage code generation operations are also annotated with the code generation id. For stages belonging to Spark DataFrame or SQL execution, this allows you to cross-reference stage execution details to the relevant query in the SQL Tab.

Summary metrics for all tasks are represented in a table and in a timeline:

The same metrics are also shown aggregated by executor. Accumulators are shared variables that can be updated inside transformations; only named accumulators are displayed here. Finally, a tasks table shows the same information broken down per task, with links to executor logs and the task attempt number for failures.

Stage detail

Storage Tab

The Storage tab displays the persisted RDDs and DataFrames, if any, in the application. The summary page shows the storage levels, sizes and partitions of all RDDs, and the details page shows the sizes and using executors for all partitions in an RDD or DataFrame.

scala> import org.apache.spark.storage.StorageLevel._
import org.apache.spark.storage.StorageLevel._

scala> val rdd = sc.range(0, 100, 1, 5).setName("rdd")
rdd: org.apache.spark.rdd.RDD[Long] = rdd MapPartitionsRDD[1] at range at <console>:27

scala> rdd.persist(MEMORY_ONLY_SER)
res0: rdd.type = rdd MapPartitionsRDD[1] at range at <console>:27

scala> rdd.count
res1: Long = 100

scala> val df = Seq((1, "andy"), (2, "bob"), (2, "andy")).toDF("count", "name")
df: org.apache.spark.sql.DataFrame = [count: int, name: string]

scala> df.persist(DISK_ONLY)
res2: df.type = [count: int, name: string]

scala> df.count
res3: Long = 3

Storage tab

After running the above example, we can find two RDDs listed in the Storage tab. Basic information like storage level, number of partitions and memory overhead are provided. Note that the newly persisted RDDs or DataFrames are not shown in the tab before they are materialized. To monitor a specific RDD or DataFrame, make sure an action operation has been triggered.

Storage detail

You can click the RDD name ‘rdd’ for obtaining the details of data persistence, such as the data distribution on the cluster.

Environment Tab

The Environment tab is the place to verify that your Spark application is running with the configuration you expect. It groups the environment and configuration information into a set of sub-tabs along the left side of the page; clicking one switches the panel on the right.

Env tab

The sub-tabs are:

Executors Tab

The Executors tab lists every executor that has been allocated to the application, including the driver. Each row shows resource usage (memory, disk, cores), storage memory reserved for cached data, task counts, shuffle totals, and performance signals such as GC time.

Executors Tab

Each row carries a set of detail links — Thread Dump, Heap Histogram, and Flame Graph — that open the corresponding live data for that executor in a side panel without leaving the page. The panel can be resized by dragging its left edge. The stderr and stdout links open the executor’s log files in a new view; the exact location of those logs depends on your cluster manager (see Monitoring and Instrumentation for details).

SQL Tab

Query Listing

The SQL tab lists all SQL and DataFrame queries submitted to the Spark application. Any DataFrame action that triggers execution (such as count, show, or write) shows up here, not only queries written as SQL strings. Here is a short example that produces a few entries:

df = spark.createDataFrame([(1, "andy"), (2, "bob"), (2, "andy")], ["count", "name"])
df.count()
df.createOrReplaceTempView("df")
spark.sql("SELECT name, SUM(count) FROM df GROUP BY name").show()

SQL tab

The listing supports sorting by column, searching, filtering by status, and pagination, which makes it easy to locate a specific query in long-running applications.

SQL Plan Visualization

Each query in the listing has a graph view of its operators. Every node shows the operator name together with its metrics inline, and the edges follow the data flow. You can pan and zoom the graph to navigate large plans, search for a node by name, and click any node to open a side panel with its full details.

SQL plan visualization

Execution Detail Page

The execution detail page, opened by clicking the ID or Description link of any row in the query listing, gathers everything recorded for a single query. The header lists the query’s submission time, duration, status, description, and the jobs and stages associated with it. The SQL Plan Visualization shows the graph of operators. At the bottom of the page, a “Details” link expands the full text of the parsed, analyzed, and optimized logical plans together with the physical plan, useful when you want to see how Spark transformed your query during planning.

SQL metrics

Each node in the SQL Plan Visualization carries its own metrics inline. These metrics are useful when you want to dive into the execution details of each operator. For example, number of output rows shows how many rows pass through a Filter operator, and shuffle bytes written in an Exchange shows how much data the shuffle wrote.

Here is the list of SQL metrics:

SQL metricsMeaningOperators
number of output rows the number of output rows of the operator Aggregate operators, Join operators, Sample, Range, Scan operators, Filter, etc.
data size the size of broadcast/shuffled/collected data of the operator BroadcastExchange, ShuffleExchange, Subquery
time to collect the time spent on collecting data BroadcastExchange, Subquery
scan time the time spent on scanning data ColumnarBatchScan, FileSourceScan
metadata time the time spent on getting metadata like number of partitions, number of files FileSourceScan
shuffle bytes written the number of bytes written CollectLimit, TakeOrderedAndProject, ShuffleExchange
shuffle records written the number of records written CollectLimit, TakeOrderedAndProject, ShuffleExchange
shuffle write time the time spent on shuffle writing CollectLimit, TakeOrderedAndProject, ShuffleExchange
remote blocks read the number of blocks read remotely CollectLimit, TakeOrderedAndProject, ShuffleExchange
remote bytes read the number of bytes read remotely CollectLimit, TakeOrderedAndProject, ShuffleExchange
remote bytes read to disk the number of bytes read from remote to local disk CollectLimit, TakeOrderedAndProject, ShuffleExchange
local blocks read the number of blocks read locally CollectLimit, TakeOrderedAndProject, ShuffleExchange
local bytes read the number of bytes read locally CollectLimit, TakeOrderedAndProject, ShuffleExchange
fetch wait time the time spent on fetching data (local and remote) CollectLimit, TakeOrderedAndProject, ShuffleExchange
records read the number of read records CollectLimit, TakeOrderedAndProject, ShuffleExchange
sort time the time spent on sorting Sort
peak memory the peak memory usage in the operator Sort, HashAggregate
spill size number of bytes spilled to disk from memory in the operator Sort, HashAggregate
time in aggregation build the time spent on aggregation HashAggregate, ObjectHashAggregate
avg hash probe bucket list iters the average bucket list iterations per lookup during aggregation HashAggregate
data size of build side the size of built hash map ShuffledHashJoin
time to build hash map the time spent on building hash map ShuffledHashJoin
task commit time the time spent on committing the output of a task after the writes succeed any write operation on a file-based table
job commit time the time spent on committing the output of a job after the writes succeed any write operation on a file-based table
data sent to Python workers the number of bytes of serialized data sent to the Python workers Python UDFs, Pandas UDFs, Pandas Functions API and Python Data Source
data returned from Python workers the number of bytes of serialized data received back from the Python workers Python UDFs, Pandas UDFS, Pandas Functions API and Python Data Source

Structured Streaming Tab

When running Structured Streaming jobs in micro-batch mode, a Structured Streaming tab will be available on the Web UI. The overview page displays some brief statistics for running and completed queries. Also, you can check the latest exception of a failed query. For detailed statistics, please click a “run id” in the tables.

Structured Streaming Query Statistics

The statistics page displays some useful metrics for insight into the status of your streaming queries. Currently, it contains the following metrics.

As an early-release version, the statistics page is still under development and will be improved in future releases.

Streaming (DStreams) Tab

The web UI includes a Streaming tab if the application uses Spark Streaming with DStream API. This tab displays scheduling delay and processing time for each micro-batch in the data stream, which can be useful for troubleshooting the streaming application.

JDBC/ODBC Server Tab

We can see this tab when Spark is running as a distributed SQL engine. It shows information about sessions and submitted SQL operations.

The first section of the page displays general information about the JDBC/ODBC server: start time and uptime.

JDBC/ODBC Header

The second section contains information about active and finished sessions.

JDBC/ODBC sessions

The third section has the SQL statistics of the submitted operations.

JDBC/ODBC SQL Statistics