<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Spark_Connect_server</id>
	<title>Spark Connect server - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openlakehouse.io/w/index.php?action=history&amp;feed=atom&amp;title=Spark_Connect_server"/>
	<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Spark_Connect_server&amp;action=history"/>
	<updated>2026-12-06T00:25:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://openlakehouse.io/w/index.php?title=Spark_Connect_server&amp;diff=183&amp;oldid=prev</id>
		<title>Open Lakehouse Wiki sync: Sync from open-lakehouse/wiki@7c9abaa</title>
		<link rel="alternate" type="text/html" href="https://openlakehouse.io/w/index.php?title=Spark_Connect_server&amp;diff=183&amp;oldid=prev"/>
		<updated>2026-11-25T00:52:52Z</updated>

		<summary type="html">&lt;p&gt;Sync from open-lakehouse/wiki@7c9abaa&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox concept&lt;br /&gt;
| name            = Spark Connect server&lt;br /&gt;
| also_known_as   = Spark Connect endpoint, Spark Connect service&lt;br /&gt;
| field           = Distributed data processing, client-server protocols&lt;br /&gt;
| introduced      = Apache Spark 3.4.0&lt;br /&gt;
| key_parts       = gRPC service in the Spark driver, session manager, execution manager, interceptors, &amp;lt;code&amp;gt;sbin/start-connect-server.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
| implementations = [[Apache Spark]] (&amp;lt;code&amp;gt;org.apache.spark.sql.connect.service.SparkConnectServer&amp;lt;/code&amp;gt;)&lt;br /&gt;
| related         = [[Spark Connect]], [[Spark Connect client]], [[Spark Connect plugin]], [[Executor]]&lt;br /&gt;
}}&lt;br /&gt;
{{Verified|2026-11-23|the v4.3.0 tag of apache/spark (sbin/start-connect-server.sh, sql/connect/server config/Connect.scala, SparkConnectService.scala, SparkConnectSessionManager.scala, PreSharedKeyAuthenticationInterceptor.scala, SparkConnectPlugin.scala, sql/connect/docs/client-connection-string.md, python/pyspark/sql/connect/client/core.py), the Spark 4.3.0 configuration, monitoring and Spark Connect overview pages, and the Apache Spark 4.3.0 download directory}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Spark Connect server&amp;#039;&amp;#039;&amp;#039; is the server side of [[Spark Connect]] in [[Apache Spark]]: a gRPC service that runs inside a Spark driver, accepts unresolved logical plans from remote clients, runs them in per-client Spark sessions and streams the results back as Apache Arrow batches.&amp;lt;ref name=&amp;quot;overview&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/spark-connect-overview.html |title=Spark Connect Overview (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; Spark implements the server as a driver plugin, so any Spark application can host it, and ships a launcher script that starts a standalone server. By default it listens on port 15002 without TLS, and Spark&amp;#039;s only built-in authentication is an optional pre-shared bearer token.&amp;lt;ref name=&amp;quot;connectconf&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/config/Connect.scala |title=Connect.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;service&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectService.scala |title=SparkConnectService.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How is a Spark Connect server deployed? ==&lt;br /&gt;
The usual way to start a Spark Connect server is &amp;lt;code&amp;gt;sbin/start-connect-server.sh&amp;lt;/code&amp;gt; from a Spark distribution.&amp;lt;ref name=&amp;quot;overview&amp;quot; /&amp;gt; The script runs the class &amp;lt;code&amp;gt;org.apache.spark.sql.connect.service.SparkConnectServer&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;spark-submit&amp;lt;/code&amp;gt; as a daemon named &amp;quot;Spark Connect server&amp;quot;, and it accepts the normal &amp;lt;code&amp;gt;spark-submit&amp;lt;/code&amp;gt; options such as &amp;lt;code&amp;gt;--master&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--conf&amp;lt;/code&amp;gt;. With &amp;lt;code&amp;gt;--wait&amp;lt;/code&amp;gt; as the first argument it runs in the foreground instead of as a daemon. &amp;lt;code&amp;gt;sbin/stop-connect-server.sh&amp;lt;/code&amp;gt; stops it.&amp;lt;ref name=&amp;quot;startsh&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sbin/start-connect-server.sh |title=start-connect-server.sh (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;stopsh&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sbin/stop-connect-server.sh |title=stop-connect-server.sh (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the server is a Spark driver, it runs on any cluster manager that the driver supports, and its queries run on ordinary [[executor]]s. Inside the driver, the server is started by the driver plugin &amp;lt;code&amp;gt;org.apache.spark.sql.connect.SparkConnectPlugin&amp;lt;/code&amp;gt;. Spark&amp;#039;s source describes this design as a way to decouple the build of Spark Connect from Spark core: the server is enabled by putting its JAR on the classpath and loading the plugin through &amp;lt;code&amp;gt;spark.plugins&amp;lt;/code&amp;gt;.&amp;lt;ref name=&amp;quot;plugin&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/SparkConnectPlugin.scala |title=SparkConnectPlugin.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; PySpark uses the same plugin when &amp;lt;code&amp;gt;SparkSession.builder.remote(&amp;quot;local[*]&amp;quot;)&amp;lt;/code&amp;gt; starts a local server for the current process.&amp;lt;ref name=&amp;quot;pysession&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/python/pyspark/sql/connect/session.py |title=pyspark/sql/connect/session.py (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Spark 4.3.0 release is published both as the usual &amp;lt;code&amp;gt;spark-4.3.0-bin-hadoop3.tgz&amp;lt;/code&amp;gt; and as &amp;lt;code&amp;gt;spark-4.3.0-bin-hadoop3-connect.tgz&amp;lt;/code&amp;gt;, the variant with Spark Connect enabled by default that Spark 4.0.0 introduced.&amp;lt;ref name=&amp;quot;dl&amp;quot;&amp;gt;{{Cite web |url=https://downloads.apache.org/spark/spark-4.3.0/ |title=Index of /spark/spark-4.3.0 |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;r400&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/releases/spark-release-4-0-0.html |title=Spark Release 4.0.0 |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Which configuration keys does the server use? ==&lt;br /&gt;
The main Spark Connect server settings are static configurations, set when the driver starts:&amp;lt;ref name=&amp;quot;config&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/configuration.html |title=Spark Configuration (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Default !! Meaning !! Since&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.binding.address&amp;lt;/code&amp;gt; || (none) || Address to bind || 4.0.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.binding.port&amp;lt;/code&amp;gt; || 15002 || Port to bind || 3.4.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.port.maxRetries&amp;lt;/code&amp;gt; || 0 || Port retry attempts; 0 fails fast on a port conflict || 4.0.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.interceptor.classes&amp;lt;/code&amp;gt; || (none) || Comma-separated &amp;lt;code&amp;gt;io.grpc.ServerInterceptor&amp;lt;/code&amp;gt; classes || 3.4.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.maxInboundMessageSize&amp;lt;/code&amp;gt; || 134217728 || Largest accepted gRPC request, in bytes || 3.4.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.keepAlive.enabled&amp;lt;/code&amp;gt; || true || Server keepalive pings to detect dead client connections || 4.3.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.grpc.keepAlive.time&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;.timeout&amp;lt;/code&amp;gt; || 60s / 20s || Idle time before a ping, and wait for its acknowledgement || 4.3.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.connect.extensions.relation.classes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.expression.classes&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.command.classes&amp;lt;/code&amp;gt; || (none) || [[Spark Connect plugin]] classes || 3.4.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spark.sql.connect.ui.retainedSessions&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;retainedStatements&amp;lt;/code&amp;gt; || 200 / 200 || Sessions and statements kept in the Spark Connect UI || 3.5.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How are client sessions isolated? ==&lt;br /&gt;
The Spark Connect server keeps one server-side Spark session for each pair of user ID and session ID sent by the client. A new pair gets a new session created with &amp;lt;code&amp;gt;SparkSession.newSession()&amp;lt;/code&amp;gt; on the server&amp;#039;s base session; the session ID must be a UUID, and an ID that was already closed cannot be reused.&amp;lt;ref name=&amp;quot;sessmgr&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectSessionManager.scala |title=SparkConnectSessionManager.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; Clients set these values with the &amp;lt;code&amp;gt;user_id&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;session_id&amp;lt;/code&amp;gt; parameters of the connection string; by default the session ID is a random UUID, and reusing one lets several clients, even in different languages, share a session.&amp;lt;ref name=&amp;quot;connstr&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/docs/client-connection-string.md |title=Connecting to Spark Connect using Clients (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Session isolation in the Spark Connect server covers session state, not the whole application. The Spark documentation states that temporary views, runtime SQL configurations and session artifacts are per session, while state backed by the shared &amp;lt;code&amp;gt;SparkContext&amp;lt;/code&amp;gt;, such as the persistent catalog, global temporary views and cached datasets, is shared by all sessions.&amp;lt;ref name=&amp;quot;overview&amp;quot; /&amp;gt; The server starts its base session with artifact session isolation enabled, so JARs and files uploaded by one client are kept apart from other sessions.&amp;lt;ref name=&amp;quot;server&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectServer.scala |title=SparkConnectServer.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; All sessions run on the same driver and executors.&lt;br /&gt;
&lt;br /&gt;
== What timeouts apply to sessions and operations? ==&lt;br /&gt;
The Spark Connect server removes idle sessions and abandoned operations with internal settings:&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spark.connect.session.manager.defaultSessionTimeout&amp;lt;/code&amp;gt; (default 60 minutes, since 4.0.0) removes a session that has received no RPC for that long; &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; keeps sessions forever.&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spark.connect.execute.manager.detachedTimeout&amp;lt;/code&amp;gt; (default 5 minutes, since 3.5.0) removes an execution that no RPC is attached to.&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&lt;br /&gt;
* Reattachable execution (&amp;lt;code&amp;gt;spark.connect.execute.reattachable.enabled&amp;lt;/code&amp;gt;, default true, since 3.5.0) lets a client reconnect to a running query; the server ends one response stream after &amp;lt;code&amp;gt;spark.connect.execute.reattachable.senderMaxStreamDuration&amp;lt;/code&amp;gt; (default 2 minutes) or &amp;lt;code&amp;gt;spark.connect.execute.reattachable.senderMaxStreamSize&amp;lt;/code&amp;gt; (default 1g), and the client reattaches.&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These keys are marked internal in the source, so they do not appear in the configuration page and may change without notice.&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt; Spark 4.3.0 added REST endpoints under &amp;lt;code&amp;gt;/applications/[app-id]/connect/&amp;lt;/code&amp;gt; that list and describe sessions and operations.&amp;lt;ref name=&amp;quot;monitoring&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/docs/4.3.0/monitoring.html |title=Monitoring and Instrumentation (Spark 4.3.0) |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;r430&amp;quot;&amp;gt;{{Cite web |url=https://spark.apache.org/releases/spark-release-4-3-0.html |title=Spark Release 4.3.0 |publisher=Apache Software Foundation |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How are Spark Connect clients authenticated? ==&lt;br /&gt;
The Spark Connect overview states that Spark Connect has no built-in authentication and is designed to work with authenticating proxies in front of its gRPC HTTP/2 interface.&amp;lt;ref name=&amp;quot;overview&amp;quot; /&amp;gt; In the 4.3.0 source, the server has three layers to consider:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Mechanism !! Shipped with Spark? !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| Pre-shared token (&amp;lt;code&amp;gt;spark.connect.authenticate.token&amp;lt;/code&amp;gt; or the &amp;lt;code&amp;gt;SPARK_CONNECT_AUTHENTICATE_TOKEN&amp;lt;/code&amp;gt; environment variable)&lt;br /&gt;
| Yes; internal setting added in 4.0.0&lt;br /&gt;
| Rejects any call whose &amp;lt;code&amp;gt;Authorization&amp;lt;/code&amp;gt; header is not &amp;lt;code&amp;gt;Bearer&amp;lt;/code&amp;gt; plus the token, with gRPC status &amp;lt;code&amp;gt;UNAUTHENTICATED&amp;lt;/code&amp;gt;. One shared secret; no users or roles.&amp;lt;ref name=&amp;quot;connectconf&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;psk&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/PreSharedKeyAuthenticationInterceptor.scala |title=PreSharedKeyAuthenticationInterceptor.scala (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Custom interceptors (&amp;lt;code&amp;gt;spark.connect.grpc.interceptor.classes&amp;lt;/code&amp;gt;)&lt;br /&gt;
| Hook only; the user supplies the classes&lt;br /&gt;
| Runs &amp;lt;code&amp;gt;io.grpc.ServerInterceptor&amp;lt;/code&amp;gt; code on every call, for example to validate a JWT or map a caller to a user. When the token check is on, it runs first, so interceptors see only authenticated calls.&amp;lt;ref name=&amp;quot;config&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;service&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| TLS and identity-aware proxy&lt;br /&gt;
| No; external&lt;br /&gt;
| The server&amp;#039;s gRPC builder sets no TLS context, so encryption and single sign-on are added by a proxy or gateway in front of it.&amp;lt;ref name=&amp;quot;service&amp;quot; /&amp;gt;&amp;lt;ref name=&amp;quot;overview&amp;quot; /&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
On the client side, the &amp;lt;code&amp;gt;token&amp;lt;/code&amp;gt; parameter of the connection string sends a standard gRPC bearer token, and the connection string reference states that setting it enables TLS.&amp;lt;ref name=&amp;quot;connstr&amp;quot; /&amp;gt; The PySpark client makes one exception: for &amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt; without &amp;lt;code&amp;gt;use_ssl=true&amp;lt;/code&amp;gt;, it sends the token over gRPC local channel credentials instead of TLS.&amp;lt;ref name=&amp;quot;core&amp;quot;&amp;gt;{{Cite web |url=https://github.com/apache/spark/blob/v4.3.0/python/pyspark/sql/connect/client/core.py |title=pyspark/sql/connect/client/core.py (tag v4.3.0) |publisher=Apache Spark on GitHub |access-date=2026-11-23}}&amp;lt;/ref&amp;gt; When PySpark starts a local server itself, it generates a random token unless one is set.&amp;lt;ref name=&amp;quot;pysession&amp;quot; /&amp;gt; For a remote server, a token therefore needs a TLS-terminating proxy in front of the plaintext gRPC port.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
The following commands start a server on a local master that requires a token and binds only to the loopback interface, then connect with PySpark:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export SPARK_CONNECT_AUTHENTICATE_TOKEN=&amp;quot;$(openssl rand -hex 32)&amp;quot;&lt;br /&gt;
$SPARK_HOME/sbin/start-connect-server.sh --master &amp;quot;local[*]&amp;quot; \&lt;br /&gt;
  --conf spark.connect.grpc.binding.address=127.0.0.1 \&lt;br /&gt;
  --conf spark.connect.grpc.binding.port=15002&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import os&lt;br /&gt;
from pyspark.sql import SparkSession&lt;br /&gt;
&lt;br /&gt;
token = os.environ[&amp;quot;SPARK_CONNECT_AUTHENTICATE_TOKEN&amp;quot;]&lt;br /&gt;
spark = SparkSession.builder.remote(f&amp;quot;sc://localhost:15002/;token={token}&amp;quot;).getOrCreate()&lt;br /&gt;
spark.range(5).show()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Spark Connect]]&lt;br /&gt;
* [[Spark Connect client]]&lt;br /&gt;
* [[Spark Connect plugin]]&lt;br /&gt;
* [[Executor]]&lt;br /&gt;
* [[Apache Spark]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Navbox open lakehouse}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Concepts]]&lt;br /&gt;
[[Category:Glossary terms]]&lt;br /&gt;
[[Category:Apache Spark]]&lt;/div&gt;</summary>
		<author><name>Open Lakehouse Wiki sync</name></author>
	</entry>
</feed>