You must have set up and configured your cluster as shown in the Admin docs.

In particular, you should have already installed Java 8 on your cluster. In order to make subsequent commands work, it is likely necessary to update the default Java version with update-alternatives --config java or equivalent to select Java 8, and set JAVA_HOME to point to the Java 8 installation.

Download the latest release of the Oryx Batch, Speed and Serving Layer, both .jar files and .sh scripts. Alternatively, build them from source and obtain the latest scripts from deploy/bin/.

Copy binaries and scripts to machines that are part of the Hadoop cluster. They may be deployed on different machines, or on one for purposes of testing. The Speed and Batch Layers should run on at most one machine, each. The Serving Layer can run on many.

Create a configuration file for your application. You may start with the example in conf/als-example.conf. Modify host names, ports and directories. In particular, choose data and model directories on HDFS that exist and will be accessible to the user running Oryx binaries.

Copy this config file as oryx.conf to the same directory as binaries and script on each machine.


Run the three Layers with:

./ batch
./ speed
./ serving

--layer-jar your-layer.jar and --conf your-config.conf can be used to specify an alternative location of the layer .jar and/or .conf file. You can use --jvm-args to pass more arguments directly the Spark driver program, like system properties: --jvm-args="-Dkey=value"

These need not be on the same machine, but may be (if configuration specifies different ports for the Batch and Speed Layer Spark web UI, and the Serving Layer API port). The Serving Layer may be run on several machines.

You can see, for example, the Batch Layer Spark UI running on port 4040 of the machine on which you started it (unless your configuration changed this). A simple web-based console for the Serving Layer is likewise available on port 8080 by default.

That’s all!

Trying the ALS Example

If you’ve used the configuration above, you are running an instance of the ALS-based recommender application.

Obtain the GroupLens 100K data set and find the file within. This needs to be converted to csv:

tr '\t' ',' < > data.csv

Push the input to a Serving Layer, with a local command line tool like curl:

wget --quiet --post-file data.csv --output-document - \
  --header "Content-Type: text/csv" \

If you are tailing the input topic, you should see a large amount of CSV data flow to the topic:


Soon, you should also see the Batch Layer trigger a new computation. The example configuration starts one every 5 minutes.

The data is first written to HDFS. The example configuration has it written to directories under hdfs:///user/example/Oryx/data/. Within are directories named by timestamp, each containing Hadoop part-r-* files, which contain the input as SequenceFiles of Text. Although not pure text, printing them should yield some recognizable data because it is in fact text.����^�]�XسN�22,377,1.0,87888711662...

A model computation then begins. This should show as a number of new distributed jobs the Batch Layer. Its Spark UI is started at http://your-batch-layer:4040 in the example configuration.

Soon the model will complete, and it will be persisted as a combination of PMML and supporting data files in a subdirectory of hdfs:///user/example/Oryx/model/. For example, the model.pmml files are PMML files containing elements like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PMML xmlns="" version="4.3">
        <Application name="Oryx"/>
    <Extension name="X" value="X/"/>
    <Extension name="Y" value="Y/"/>
    <Extension name="features" value="10"/>
    <Extension name="lambda" value="0.001"/>
    <Extension name="implicit" value="true"/>
    <Extension name="alpha" value="1.0"/>
    <Extension name="implicit" value="false"/>
    <Extension name="XIDs">56 168 222 343 397 ...

The X/ and Y/ subdirectories next to it contain feature vectors, like:


If you are tailing the update topic, you should also see these values published to the topic.

The Serving Layer will pick this up soon thereafter, and the /ready endpoint will return status 200 OK:

wget --quiet --output-document - --server-response \
  HTTP/1.1 200 OK
  Content-Length: 0
  Date: Tue, 1 Sep 2015 13:26:53 GMT
  Server: Oryx
wget --quiet --output-document -  http://your-serving-layer:8080/recommend/17

Congratulations, it’s a live recommender! When done, all processes can be killed with Ctrl-C safely.

API Endpoint Reference

Oryx bundles several end-to-end applications, including a Serving Layer with REST endpoints.

Classification / Regression



Refer to the default configuration file for a list and explanation of configuration parameters: reference.conf

Or see one of the following examples:

Back to top

Reflow Maven skin by Andrius Velykis.