domino logo
Tech Ecosystem
Get started with Python
Step 0: Orient yourself to DominoStep 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Get started with R
Step 0: Orient yourself to Domino (R Tutorial)Step 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Get Started with MATLAB
Step 1: Orient yourself to DominoStep 2: Create a Domino ProjectStep 3: Configure Your Domino ProjectStep 4: Start a MATLAB WorkspaceStep 5: Fetch and Save Your DataStep 6: Develop Your ModelStep 7: Clean Up Your Workspace
Step 8: Deploy Your Model
Scheduled JobsLaunchers
Step 9: Working with Domino Datasets
Domino Reference
Projects
Projects Overview
Revert Projects and Files
Revert a ProjectRevert a File
Projects PortfolioReference ProjectsProject Goals in Domino 4+
Git Integration
Git Repositories in DominoGit-based Projects with CodeSyncWorking from a Commit ID in Git
Jira Integration in DominoUpload Files to Domino using your BrowserFork and Merge ProjectsSearchSharing and CollaborationCommentsDomino Service FilesystemCompare File RevisionsArchive a Project
Advanced Project Settings
Project DependenciesProject TagsRename a ProjectSet up your Project to Ignore FilesUpload files larger than 550MBExporting Files as a Python or R PackageTransfer Project Ownership
Domino Runs
JobsDiagnostic Statistics with dominostats.jsonNotificationsResultsRun Comparison
Advanced Options for Domino Runs
Run StatesDomino Environment VariablesEnvironment Variables for Secure Credential StorageUse Apache Airflow with Domino
Scheduled Jobs
Domino Workspaces
WorkspacesUse Git in Your WorkspaceRecreate A Workspace From A Previous CommitUse Visual Studio Code in Domino WorkspacesPersist RStudio PreferencesAccess Multiple Hosted Applications in one Workspace Session
Spark on Domino
On-Demand Spark
On-Demand Spark OverviewValidated Spark VersionConfigure PrerequisitesWork with your ClusterManage DependenciesWork with Data
External Hadoop and Spark
Hadoop and Spark OverviewConnect to a Cloudera CDH5 cluster from DominoConnect to a Hortonworks cluster from DominoConnect to a MapR cluster from DominoConnect to an Amazon EMR cluster from DominoRun Local Spark on a Domino ExecutorUse PySpark in Jupyter WorkspacesKerberos Authentication
On-Demand Ray
On-Demand Ray OverviewValidated Ray VersionConfigure PrerequisitesWork with your ClusterManage DependenciesWork with Data
On-Demand Dask
On-Demand Dask OverviewValidated Dask VersionConfigure PrerequisitesWork with Your ClusterManage DependenciesWork with Data
Customize the Domino Software Environment
Environment ManagementDomino Standard EnvironmentsInstall Packages and DependenciesAdd Workspace IDEsAdding Jupyter Kernels
Partner Environments for Domino
Use MATLAB as a WorkspaceUse Stata as a WorkspaceUse SAS as a WorkspaceNVIDIA NGC Containers
Advanced Options for Domino Software Environment
Install Custom Packages in Domino with Git IntegrationAdd Custom DNS Servers to Your Domino EnvironmentConfigure a Compute Environment to User Private Cran/Conda/PyPi MirrorsUse TensorBoard in Jupyter Workspaces
Publish your Work
Publish a Model API
Model Publishing OverviewModel Invocation SettingsModel Access and CollaborationModel Deployment ConfigurationPromote Projects to ProductionExport Model Image
Publish a Web Application
App Publishing OverviewGet Started with DashGet Started with ShinyGet Started with FlaskContent Security Policies for Web Apps
Advanced Web Application Settings in Domino
App Scaling and PerformanceHost HTML Pages from DominoHow to Get the Domino Username of an App Viewer
Launchers
Launchers OverviewAdvanced Launcher Editor
Assets Portfolio Overview
Model Monitoring and Remediation
Monitor WorkflowsData Drift and Quality Monitoring
Set up Monitoring for Model APIs
Set up Prediction CaptureSet up Drift DetectionSet up Model Quality MonitoringSet up NotificationsSet Scheduled ChecksSet up Cohort Analysis
Set up Model Monitor
Connect a Data SourceRegister a ModelSet up Drift DetectionSet up Model Quality MonitoringSet up Cohort AnalysisSet up NotificationsSet Scheduled ChecksUnregister a Model
Use Monitoring
Access the Monitor DashboardAnalyze Data DriftAnalyze Model QualityExclude Features from Scheduled Checks
Remediation
Cohort Analysis
Review the Cohort Analysis
Remediate a Model API
Monitor Settings
API TokenHealth DashboardNotification ChannelsTest Defaults
Monitoring Config JSON
Supported Binning Methods
Model Monitoring APIsTroubleshoot the Model Monitor
Connect to your Data
Data in Domino
Datasets OverviewProject FilesDatasets Best Practices
Connect to Data Sources
External Data VolumesDomino Data Sources
Connect to External Data
Connect Domino to DataRobotConnect to Amazon S3 from DominoConnect to BigQuery from DominoConnect to Generic S3 from DominoConnect to IBM DB2 from DominoConnect to IBM Netezza from DominoConnect to Impala from DominoConnect to MSSQL from DominoConnect to MySQL from DominoConnect to Okera from DominoConnect to Oracle Database from DominoConnect to PostgreSQL from DominoConnect to Redshift from DominoConnect to Snowflake from DominoConnect to Teradata from Domino
Work with Data Best Practices
Work with Big Data in DominoWork with Lots of FilesMove Data Over a Network
Advanced User Configuration Settings
User API KeysDomino TokenOrganizations Overview
Use the Domino Command Line Interface (CLI)
Install the Domino Command Line (CLI)Domino CLI ReferenceDownload Files with the CLIForce-Restore a Local ProjectMove a Project Between Domino DeploymentsUse the Domino CLI Behind a Proxy
Browser Support
Get Help with Domino
Additional ResourcesGet Domino VersionContact Domino Technical SupportSupport Bundles
domino logo
About Domino
Domino Data LabKnowledge BaseData Science BlogTraining
User Guide
>
Domino Reference
>
Spark on Domino
>
On-Demand Spark
>
Work with your Cluster

Work with your Cluster

Create a cluster with workspaces

To create an on-demand Spark cluster attached to a Domino Workspace, click New Workspace from the Workspaces menu. On the Launch New Workspace dialog select the Compute Cluster step. Specify the desired cluster settings and launch you workspace. After the workspace is up, it will have access to the Spark cluster you configured.

The Hardware Tier for your workspace will determine the compute resources available to your Spark driver process.

new workspace with spark

Create a cluster with jobs

Similarly to workspaces, to create and on-demand Spark cluster attached to a Domino job, click on Run from the Jobs menu. One the Start a Job dialog select the Compute Cluster step. Specify the desired cluster settings and launch your job. The job will have access to the Spark cluster you configured.

new job with spark

As your command, you can use any Python script that contains a PySpark job.

You can also submit jobs using spark-submit but since it is not recognized automatically as one of the Domino supported job types you will need to wrap it with a shell script unless you included a copy as spark-submit.sh as part of preparing your compute environment.

The following is an example of a simple wrapper my-spark-submit.sh

#!/usr/bin/env bash

spark-submit $@

Understand your cluster settings

Domino makes it simple to specify key settings when creating a Spark cluster.

cluster settings spark

  • Min Executors

    Number of Executors that will be available to your Spark application when the cluster starts. If Auto-scale workers is not enabled, this will always be the size of the cluster. The combined capacity of the executors will be available for your workloads.

    When you instantiate Spark context with the default settings, the spark.executor.instances Spark setting will be set to the number specified in the above dialog.

  • Max Executors

    The maximum number of Spark executors that the cluster can reach when Auto-scale workers is enabled. See cluster autoscaling for more details.

  • Cluster size: Limit

    The maximum number of executors that you can make available to your cluster is limited by the number of per-user executions that your Domino administrator has configured for your deployment.

    In addition to the number of Spark application executors, you will need 1 slot for your cluster master and 1 slot for your workspace or job.

  • Executor Hardware Tier

    The amount of compute resources (CPU and memory) that will be made available to Spark executors.

    When you instantiate Spark context with the default settings, the spark.executor.cores and spark.executor.memory Spark settings will be set to the values corresponding to the Hardware Tier.

    For cores, the number of cores will be rounded up to the nearest integer. For example, a HW Tier with 1.5 cores will result in spark.executor.cores set to 2 when creating the default context.

  • Master Hardware Tier

    Same mechanics as the Executor Hardware Tier, but applied to the resources that will be available for your Spark cluster master.

    The master in the Domino configuration has a pretty limited role in Spark application scheduling, and it does not need a significant amount of resources.

    By default, any Hardware Tier is available when selecting resources for your Executor and Master. Domino administrators can optionally configure compute cluster dedicated Hardware tiers.

  • Cluster Compute Environment

    Designates your environment. Projects already using this environment will be allowed to continue to use it until a new project environment is set.

  • Dedicated local storage per executor

    The amount of dedicated storage in Gigabytes (2^30 bytes) that will be available to each executor.

    The storage will be automatically mounted to /tmp which is the default location for spark.local.dir that serves as the location for RDDs, when they need to be on disk, and for shuffle data.

    The storage will be automatically provisioned when the cluster is created and de-provisioned when it is shut down.

    Warning

    The local storage per executor should not be used for storing any data which needs to be available after the cluster is shut down.

Advanced cluster configuration topics

Spark executors versus workers

Domino gives you the ability to have flexible resource allocation through Hardware Tiers which makes it convenient to plan your cluster resources needed for your application in terms of executors as opposed to workers. When creating on-demand Spark clusters, Domino will automatically manage the relationship between Spark executors and workers (see Spark definitions). By default, there will be one worker for each executor.

Resource overhead

When setting up worker and executor memory limits, Domino ensures that the worker containers have additional memory on top of the Hardware Tier memory definition to account for the recommended overhead of 10% of executor memory with a minimum of 384MB. The usable executor memory will always be based on the value from the actual Hardware Tier.

You might have to take this into account when designing Hardware Tiers to achieve optimal packing of Spark worker containers on the physical instances of the Domino Kubernetes cluster.

Because of the worker memory overhead and the approach of using 1 worker per executor, it is possible that using lots of executors with smaller Hardware Tiers may result in excessive memory overhead.

If this is undesirable, an experienced data scientist can chose a large Hardware Tier when creating the cluster and then overwrite the executor core and memory settings to achieve the desired effect. See Adding and overwriting parameters.

Cluster auto-scaling

images:/image/4.x/cluster_autoscaling.png[]

Cluster auto-scaling allows you to start with a small cluster which then automatically scales up and down in response to the resource consumption of your workload. This approach utilizes resources more efficiently for bursty workloads.

By default, the cluster size will increase when the average CPU utilization of your workload reaches 80%. A Domino admin can further refine the auto-scaling settings by including memory utilization or changing the desired scaling thresholds.

Scale down happens if resource utilization is low for a period of at least 5 minutes. Note that depending on the workload that you are executing, scale down may terminate cluster nodes that contain intermediate results which would need to be recomputed.

Connect to your cluster

When provisioning your on-demand Spark cluster, Domino sets up key default cluster configuration parameters (for example, spark.master, spark.driver.host) to the appropriate cluster URLs so that creating SparkSession or SparkContext with default context will properly connect the cluster to your workspace or job.

Create SparkSession

You can create SparkSession using the following:

from pyspark.sql import SparkSession

spark = SparkSession \
        .builder \
        .appName("MyAppName") \
        .getOrCreate()

 # You can examine the full config
 spark.sparkContext.getConf().getAll()

Create SparkContext

Alternatively, you can create SparkContext using the following:

from pyspark import SparkContext

conf = SparkConf().setAppName(appName).setMaster(master)
sc = SparkContext(conf=conf)

Add and overwrite parameters

It is possible to add additional config parameters or overwrite any of the defaults by manipulating your context configuration.

from pyspark.sql import SparkSession

spark = SparkSession \
        .builder \
        .appName("MyAppName") \
        .config("spark.some.config.option", "some-value") \
        .getOrCreate()

You can also supply additional configuration settings that will apply for any clusters associated with a Domino project from Settings>Integrations>Domino managed on-demand cluster

project cluster settings spark

Warning

Access the Spark UI

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

Domino makes the Spark Web UI available for active on-demand clusters attached to both workspaces and jobs.

Spark UI from Workspaces

The Spark UI is available from a dedicated tab in your workspace.

access ui tabs spark

Spark UI from Jobs

The Spark UI is also available for running jobs from Details tab.

access ui job spark

Spark UI Compatibility mode

With Domino 4.5 and higher, if an on-Demand Spark cluster uses Spark 3.0.1 or earlier some links in the Spark UI will not function properly. This will not affect actual Spark processing.

For cases, where you want to run an older version, you can configure Domino in Spark Web UI compatibility mode using one of the following options:

  • Set for the entire Domino instance

    A Domino administrator can set the Domino central configuration setting com.cerebro.domino.computegrid.computeCluster.spark.proxyCompatibility to legacy.

  • Set on a Domino Project level

    Alternatively, this can be set at a project level from Settings>Integrations>Domino managed on-demand cluster

    Warning

Cluster lifecycle

On workspace or job startup, a Domino on-demand Spark cluster with the desired cluster settings is automatically provisioned and attached to the workspace or job as soon as the cluster becomes available.

On workspace or job termination, the on-demand Spark cluster and all associated resources are automatically terminated and de-provisioned. This includes any compute resources and storage allocated for the cluster.

Cluster network security

The on-demand Spark clusters created by Domino are not meant for sharing between multiple users. Each cluster is associated with a given workspace or a job instance. Access to the cluster and the Spark Web UI is restricted only to users who can access the workspace or the job attached to it. This restriction is enforced at the networking level and the cluster is only reachable from the execution that provisioned it.

Domino Data LabKnowledge BaseData Science BlogTraining
Copyright © 2022 Domino Data Lab. All rights reserved.