The following deployment patterns are supported for WSO2 ML.
Before deploying WSO2 ML, follow the instructions in Production Deployment Guidelines.
WSO2 ML is bundled with an inbuilt Apache Spark instance. In the standalone deployment pattern of WSO2 ML, Spark runs in local mode with one or more worker threads within the same machine. WSO2 ML is set to run in the standalone mode by default. The ML handles the driver program of the Spark instance which submits jobs to the Spark master.
The number of worker threads with which Spark is run can be set by the property
spark.master in the
WSO2ML_HOME>/repository/conf/etc/spark-config.xml file. Possible values are as follows.
|local||Runs Spark locally with one worker thread. There will be no multiple threads running in parallel.|
|local[k]||Runs Spark locally with k number of threads. (K is ideally the number of cores in your machine).|
|local[*]||Runs Spark locally with a number of worker threads that equals the number of logical cores in your machine.|
With external Spark cluster
By default, WSO2 ML runs with an inbuilt Apache Spark instance. However, when working with big data, you can handle those large data sets in a distributed environment through WSO2 ML. You can carry out data pre-processing and model building processes on an Apache Spark cluster to share the workload between the nodes of the cluster. Using a Spark cluster optimizes the performance and reduces the time consumed to build and train a machine learning model for a large data set.
Follow the steps below to run the ML jobs by connecting WSO2 ML to an external Apache Spark cluster.
- When following the instructions below you need to use Apache Spark version 1.4.1 with Apache Hadoop version 2.6 and later in the Apache Spark cluster.
- The Spark deployment pattern can be Standalone, Yarn or Mesos.
- WSO2 ML is unaware of the underlying configuration of the Spark cluster. It only interacts with the Spark master to which the jobs are submitted.
Press Ctrl+C keys to shutdown the WSO2 ML server. For more information on shutting down WSO2 ML server, see Running the Product .
- Create a directory named <SPARK_HOME>/ml/ and copy the following jar files into it. These jar files can be found in the
Create a file named
<SPARK_HOME>/conf/directory and add the following entries.
Restart the external Spark cluster using the following commands:
<ML_HOME>/repository/conf/etc/spark-config.xmlfile, enter the Spark master URL as the value of the
spark.master>property as shown in the example below.
You can find the Spark Master URL in the Apache Spark Web UI as shown below.
Restart the WSO2 ML server. For more information on restarting WSO2 ML server, see Running the Product.
With DAS as the Spark cluster
WSO2 DAS has an embedded Spark server which automatically creates a Spark cluster when the DAS is started in a clustered mode. Follow the steps below to run the ML jobs by connecting WSO2 ML to a WSO2 DAS cluster that serves as a Spark cluster.
Setup DAS cluster using Carbon clustering. Configure it to have at least one worker node. For more information on setting up a DAS cluster, see Clustering Data Analytics Server.
Machine Learner Commons
Machine Learner Core
Machine Learner Database Service
- Stop all DAS nodes. For more information on stopping DAS nodes, see Running the Product in DAS documentation.
Start DAS cluster again without initializing Spark contexts with CarbonAnalytics and ML features. Use the following options when starting the cluster.
Option Purpose -DdisableAnalyticsSparkCtx=true To disable CarbonAnalytics Spark context. -DdisableMLSparkCtx=true To disable ML Spark context.
To configure ML to use DAS as the Spark cluster, set the following property in the <ML_HOME>/repository/conf/etc/spark-config.xml file.
Add the jars to Spark executor extra class path.
These should also be added to the Spark driver extra class path as Spark configuration properties in the
<ML_HOME>/repository/conf/etc/spark-config.xmlfile as shown below.
- Enter values that are less than or equal to the allocated resources for Spark workers in the DAS cluster for the following two properties in the
<ML_HOME>/repository/conf/etc/spark-config.xmlfile. This ensures that the ML does not call for unsatisfiable resources from the DAS Spark cluster.
- Start the ML server. For more information on starting WSO2 ML server, see Running the Product.