Oracle Coherence
Oracle Coherence
Over the last few years, In-Memory Data Grids have become an increasingly popular way to solve many of the problems related to performance and scalability, while improving availability of the system at the same time. Oracle Coherence is an In-Memory Data Grid that allows you to eliminate single points of failure and single points of bottleneck in your application by distributing your application's objects and related processing across multiple physical servers.
Oracle Coherence 3.5 tries to explain, in detail, how Oracle Coherence can work in a business environment. The information provided by the author is based on real-world situations which mean the problems and solutions are never theoretical. These scenarios will most likely happen when working with Oracle Coherence and the solutions is also applicable to real-world settings.
But aside from task-based solutions, the book also provides detailed information on how to start with Oracle Coherence. From basic set-up to working with other programming languages, the reader will be provided with step-by-step instructions so that Oracle Coherence will work as expected.
This Book is available for purchase at packtpub.com
Read Book Review
Oracle Coherence 3.5
As an architect of a large mission-critical website or enterprise application you need to address at least three major non-functional requirements performance scalability and availability. Performance is defined as the amount of time that an operation takes to complete. In a web application it is usually measured as time to last byte"Oracle Coherence: Distributed Caching
One of the easiest ways to improve application performance is to bring data closer to the application and keep it in a format that the application can consume more easily. Most enterprise applications are written in one of the object-oriented languages such as Java or C while most data is stored in relational databases such as Oracle MySQLOracle Coherence: In-place and Parallel Processing
In many situations you can improve performance enormously if you perform the processing where the data is stored instead of retrieving the data that needs to be processed. For example while working with a relational database you can use bulk update or a stored procedure to update many records without moving any data across the network. CoherenceOracle Coherence: Coherence within the Oracle Ecosystem
If you look at Oracle marketing material you will find out that Coherence is a member of the Oracle Fusion Middleware product suite. However if you dig a bit deeper you will find out that it is not just another product in the suite but a foundation for some of the high-profile initiatives that have been announced by Oracle such as Oracle WebLogicOracle Coherence: Querying The Data Grid
So far you have learned how to access data in the Coherence cache using identity-based operations such as get and put. In many cases this will be exactly what you need but there will also be many other situations where you either won t know an object s identity or you will simply need to look up one or more objects based on attributes other thanOracle Coherence: Built-in Filters
Fortunately Coherence provides a number of built-in filters that make custom filter implementation unnecessary in the vast majority of cases. Built-in filters Most queries can be expressed in terms of object attributes and standard logical and relational operators such as AND OR equals less than greater than and so on. For example if weOracle Coherence: Value and Reflection Extractor
Value extractors As you can see from the previous examples a query is typically expressed in terms of object attributes such as accountId or time while the evaluate method defined by the Filter interface accepts a whole object that the attributes belong to such as a Transaction instance. That implies that we need a generic way to extract attributeOracle Coherence: Other built-in value extractors
While the ReflectionExtractor is definitely the one that is used most often there are several other value extractors that ship with Coherence. IdentityExtractor The simplest extractor is the IdentityExtractor which doesn t really extract anything from the target object but returns the target object itself. This extractor can come in handy whenOracle Coherence: Implementing Custom Value Extractor
While the built-in value extractors should be sufficient for most usage scenarios there might be some situations where implementing a custom one makes sense. We have already implemented one custom value extractor PropertyExtractor in order to improve on the built-in ReflectionExtractor and allow ourselves to specify JavaBean property names insteadOracle Coherence: Simplifying Coherence Queries
As you have probably realized by now Coherence queries can become quite cumbersome to create as the number of attributes used within the query grows especially if non-default value extractors need to be used. One and possibly the best approach would be to implement a real query language. We could define a grammar for Coherence queries that wouldOracle Coherence: Obtaining Query Results
The easiest way to obtain query results is to invoke one of the QueryMap.entrySet methods geshibot language C Filter filter ...; Set results cache.entrySet filter ; geshibot This will return a set of Map.Entry instances representing both the key and the value of a cache entry which is likely not what you want. MoreOracle Coherence: Controlling Query Scope using Data Affinity
As we discussed in the previous chapter data affinity can provide a significant performance boost because it allows Coherence to optimize the query for related objects. Instead of executing the query in parallel across all the nodes and aggregating the results Coherence can simply execute it on a single node because data affinity guarantees thatOracle Coherence: Querying Near Cache
One situation where a direct query using the entrySet method might not be appropriate is when you need to query a near cache. Because there is no way for Coherence to determine if all the results are already in the front cache it will always execute the query against the back cache and return all the results over the network even if some or allOracle Coherence: Paging Over Query Results
The LimitFilter is somewhat special and deserves a separate discussion. Unlike other filters which are used to compose query criteria the LimitFilter is used to control how many result items are returned at a time. Basically it allows you to page through query results n items at a time. This also implies that unlike other filters which are constructedOracle Coherence: Anatomy of an Index
A Coherence index is an instance of a class that implements the com.tangosol.util.MapIndex interface geshibot language C public interface MapIndex ValueExtractor getValueExtractor ; boolean isOrdered ; Map getIndexContents ; Object get Object key ; geshibot The getValueExtractor methodOracle Coherence: Creating Indexes
Now that we know how Coherence indexes are structured and why we should use them let s look at how we can create them. At the beginning of this chapter we showed an incomplete definition of a QueryMap interface. What we omitted from it are the two methods that allow us to create and remove cache indexes geshibot language C publicOracle Coherence: Query Limitations
You have probably noticed by now that all the filters we have used as examples are evaluated against a single cache. This is one of the limitations of the Coherence query mechanism--it is not possible to perform an equivalent of a table join and execute the query against it. However while the ability to execute queries across multiple caches wouldOracle Coherence: Aggregators
Coherence filters are great when you need to retrieve a subset of objects from the cache based on a certain criteria but there are cases when you want to process these objects as well in order to return a single result. For example you might want to retrieve the total amount of all orders for a particular customer. One possible solution is to retrieveOracle Coherence: Built-in Aggregators
Just as with filters Coherence ships with a number of useful built-in aggregators and an equivalent of the AverageAggregator is one of them. Actually there are two average aggregators built-in as you can see in the following table geshibot language C ----------------------------------------------------------------------------------Oracle Coherence: Implementing LookupValuesAggregator
Earlier in the chapter we started the implementation of a generic solution that will allow us to extract lookup values that are suitable for data binding to UI controls such as drop-downs and list boxes. So far we have implemented a LookupValueExtractor which allows us to extract a LookupValue instance from any object in any cache. In this section








