We are excited to announce that the new “Coherence-Demo” is now available on GitHib. The demo showcases the latest Coherence features via a fully self-contained web based “Stock” application written using Angular & Bootstrap and accessing Coherence via our REST API.
The demo showcases core Coherence features around reliability, availability, scalability and performance, as well as the following new features included in Coherence 12.2.1:
- Federated Caching – Provides the ability to easily send (federate) caches across data centres.
- Cache Persistence – Provides the ability to persist and recover the contents of caches/ services as well as persist data across full cluster outages.
- Java 8 support – Including Remote/Distributed Lambdas and Streams.
Included within the demo is a feature we call “Demo Insight”, which explains functionality you are using as you navigate through the application. For example, when you start an additional server the following screen will be displayed explaining what happens behind the scenes when the server is started.
You can also click on the “Information” (i) icon to see more information on a particular topic such as how the portfolio composition is calculated. You can also disable/enable “Insight” via the tools menu.
Building the Demo
The full source code of the demo is available on GitHub at https://github.com/coherence-community/coherence-demo where you can either download the source code or clone via git command line or by using your favourite IDE:
To build the demo you must also have maven and Coherence 188.8.131.52 installed. See the README on the GitHub site for step by step details to build and install.
Running the Coherence-Demo
Once you have built the demo, you can use the following from a command prompt to launch it. You must ensure that you have Java 8 in your PATH.
java -jar target/coherence-demo-2.0.1-SNAPSHOT.jar
The demo starts a Coherence cache server for data storage, plus a a Grizzly HTTP server for serving Coherence REST requests and the actual demonstration content HTML/js files.
Within the application Oracle Bedrock (which provides a general purpose Java framework for the development, orchestration and testing of highly concurrent distributed applications) is used to start additional cache servers and an additional cluster when you start Federation.
There are four main regions in the application.
- Portfolio Composition (top left) shows an aggregation of all the positions and their values across symbols. If you check the ‘Real-Time Price Updates’ check-box, the prices will be randomly updated every 2 seconds and with Federation enabled, this will be federated to the second cluster.
- Aggregation Performance (top right) shows rolling aggregation times for calculating the portfolio above. As you add additional cache servers, you can see the reduction in the aggregation time as the additional cores are utilised for parallel query processing.
- Data Distribution (bottom left) shows the data distribution of primary across cache servers as additional servers are added/ removed.
- Cluster Management (bottom right) shows the currently running cache servers and provides the ability to start and stop cache servers.
There are also a number of menu items in the top right:
- Federation – Starts, stops and pauses federation (see below).
- Persistence – Create and recover snapshots.
- Tools – Start JVisualVM, add additional trades, clear the cache, shutdown the application and disable “Insight”.
When you select the “Start Federation” menu option, Oracle Bedrock will start an additional Coherence Cluster on a different port, and start federating data to that new cluster.
Once the cluster has started, you will see a menu option, under the Federation menu, to open the second cluster dashboard. The demo chooses cluster names for you based upon your locale. To change these default names see the README.
The clusters are setup as active-active which means that updates from either cluster will be transmitted to the other cluster. You can exercise this by choosing the “Add Trades” option from the “Tools” menu.
Shutting Down the Demo
When you have finished with the demo you can choose the “Shutdown” option from the “Tools” menu or simple kill the java command you used to start it. All additional cache servers and clusters that were started during the demo will be automatically closed.