Terracotta DSO
Shared Work Queue Sample Application
About
The Shared Work Queue sample application shows how to use Terracotta DSO in a
web environment to create a list of computation tasks that is worked on by all
the nodes in the cluster.
Build Instructions
This sample application ships built ready to run. If you modify the
application code, use the provided build.xml
file to re-build the
application with Apache Ant (ant build
).
Run Instructions
- Start a Terracotta Server from the
samples
directory.
Unix: ./start-demo-server.sh
Windows: start-demo-server.bat
- Start multiple copies of application from the
samples/pojo/sharedqueue
directory.
Unix: ./run.sh &
./run.sh &
Windows: run.bat
run.bat
Optionally, a port number may be supplied to the run scripts; otherwise a default
port number will be used, starting at port 1990, and incremented by 1 for each
successive copy of the application that you run.
- View application.
Fire up a web browser and point the URL to one of the web servers - if you relied
on the application to use it's default port number, the following will work:
http://localhost:<1990>/webapp/
Otherwise replace the value 1990, with the port number that you supplied. You can run
as many copies of the application as you like, and the number of workers available
will be reflected on the page.
- Distribute work tasks to clustered processing.
Enter a value for how many units of work to create.
Press Start. You can refresh the browser periodically or wait until
the page refreshes automatically, which is about every quarter of
a second. At the bottom, the results demonstrate that the
processing of the work is automatically split across the nodes of the
cluster.
Source Code
Browse configuration file and source code: source.html