This topic describes the core configuration files and parameters of Livy in detail to help you correctly configure Livy Gateway and use related features in Alibaba Cloud EMR Serverless Spark.
spark-defaults.conf
Purpose
The spark-defaults.conf file sets default parameters for Spark jobs submitted through Livy Gateway. When users create Livy batch jobs or sessions, these default values are automatically applied if specific parameters are not explicitly defined.
Example configuration
Below are some common default parameter configurations.
spark.driver.cores 2
spark.driver.memory 7g
spark.dynamicAllocation.enabled true
spark.dynamicAllocation.initialExecutors 2
spark.dynamicAllocation.maxExecutors 100
spark.dynamicAllocation.minExecutors 1Parameter descriptions are as follows:
spark.driver.coresandspark.driver.memory: Define the number of CPU cores and memory size for the Driver.Dynamic resource allocation related parameters:
spark.dynamicAllocation.enabled=true: Enable dynamic resource allocation.spark.dynamicAllocation.minExecutorsandspark.dynamicAllocation.maxExecutors: Limit the minimum and maximum number of Executors.spark.dynamicAllocation.initialExecutors: Initial number of Executors to allocate.
Supported enhanced parameters
Supported enhanced parameters refer to additional features or extended configuration items provided by Alibaba Cloud EMR Serverless Spark to enhance system security, flexibility, or performance. These parameters are typically designed for specific scenarios (such as multitenancy environments, permission management, etc.) to help users better control task behavior and resource allocation.
Parameter | Description |
| Used to specify the proxy user when submitting Spark jobs. The default value is This parameter is only effective when |
livy.conf
Purpose
The livy.conf file is the core configuration file for Livy, used to define the global behavior of Livy Gateway, including authentication methods, timeout settings, session management, and more.
Key parameters
Parameter | Description |
| Whether to allow users to impersonate Spark users through the |
| Session timeout period. Inactive sessions exceeding this time will be automatically closed. The default value is |
| Whether to check for timed-out sessions. The default value is If set to |
| Whether to skip busy sessions when checking for timed-out sessions. If skipped, sessions that are executing tasks will not be closed. The default value is |
| Specifies the authentication method for Livy Gateway. For example, set to |
| LDAP address. For example, |
| LDAP base DN. For example, |
| Whether to enable TLS encryption for LDAP. The default value is |
| LDAP security authentication method. The default value is |
| Retention time of completed sessions in memory. The default value is |
| Maximum number of sessions that can be created simultaneously. The default value is |
| Limits the number of sessions that each user can create. This parameter takes effect only when |
livy-client.conf
Purpose
The livy-client.conf file defines the runtime parameters of the Livy HTTP client, mainly used to optimize the interaction behavior between the client and Livy Gateway.
Key parameters
Parameter | Description |
| Maximum number of statements retained in session memory. The default value is 100. |
| Maximum number of rows returned by the SQL interpreter. The default value is 1000. |
spark-blacklist.conf
Purpose
The spark-blacklist.conf file restricts parameters that users are not allowed to override in tasks submitted through Livy Gateway. Parameters listed in the blacklist will be forcibly ignored by the system, and users cannot modify these parameters.
Example configuration
Below are some examples of common blacklisted parameters.
spark.driver.cores
spark.driver.memory
spark.executor.cores
spark.executor.memoryThis configuration indicates that users cannot set the resources (such as CPU cores and memory size) for Spark Driver and Executor themselves, thus preventing resource abuse.
Supported enhanced parameters
The spark-blacklist.conf also supports the following enhanced parameters to further improve job security and stability.
Parameter | Description |
| Prevents users from setting the time to live (TTL) for sessions. Ensures that session TTL is uniformly managed by administrators, avoiding resource waste or task interruption caused by users setting TTL too long or too short. |
| Prevents users from setting the queue for job submission. All jobs use the default Livy Gateway queue, avoiding uneven resource allocation caused by users arbitrarily selecting queues. |
| Prevents users from setting the proxy user. The default is root user. |