1. For systems where low latency is critical, there is nothing better than caching the data in memory in a distributed cluster. While storing data in memory provides fast data access, distributing it on a cluster of nodes increases application performance and scalability. And Apache Ignite helps you achieve exactly that.

    Ignite data grid is a distributed in-memory key-value store. It can also be viewed as a partitioned hash map that enables caching data in-memory over multiple server nodes. You can store as much data as you want, in memory, by adding new nodes to the Ignite cluster at anytime. As a key-value store, Ignite data grid supports:

    Partitioning & Replication
    Ignite can be configured to either replicate or partition the data in memory. In a replicated cache, data is fully replicated on all the nodes in the cluster. In a partitioned cache, the data is evenly split and distributed cluster-wide so that each node contains only a subset of the total data.

    Redundancy
    Ignite allows you to store multiple backup copies of cached data within your cluster. Configuring backup prevents data loss in case of a node crash. You can configure as many backups as the total number of nodes in the cluster.

    Consistency
    Ignite supports atomic and transactional modes for cache operations. In atomic mode, multiple atomic operations are performed individually. In transactional mode, multiple cache operations are grouped and executed in a single transaction. The transactional mode in Ignite is fully ACID compliant, and the data always remains consistent, regardless of any node failures.

    Data Locality
    Ignite determines data locality using a pluggable hashing algorithm. Every client can determine which node a key belongs to by plugging it into a hashing function. This eliminates the need for any special mapping servers or name nodes that can potentially be a single point of failure. 

    SQL Queries
    To query the Ignite cache, you can simply use standard SQL syntax (ANSI 99). Ignite lets you use any SQL function, aggregation, or grouping. It also supports distributed SQL joins. Here is an example of how to execute an SQL query in Ignite: 
    // ‘Select’ query to concatenate the first and last name of all persons
    // and associate them with organization names.
    SqlFieldsQuery sql = new SqlFieldsQuery(
      "select concat(p.firstName, ' ', p.lastName), o.name " +
      "from Person p, Organization o " +
      "where p.orgId = o.id");
    
    // Execute the query on Ignite cache and print the result.
    try (QueryCursor<List<?>> cursor = cache.query(sql)) {
      System.out.println("Persons and Organizations: " + cursor.getAll());
    }

    Example

    Here is an example of some basic cache operations in Ignite:
    // Store keys in cache.
    cache.put("Hello", "World");
    
    // Retrieve values from cache.
    String val = cache.get("Hello");
    
    // Replace-if-exists operation.
    boolean success = cache.replace("Hello", "Again");
    
    // Remove-if-exists operation.
    success = cache.remove("Hello");

    Screencast

    If you prefer to watch a running example, here is a short screencast.




    Conclusion

    Apache Ignite stores data in distributed caches across multiple nodes providing fast data access. Caches can be configured to store data in either partitioned or replicated manner. Ignite clusters are resilient to node failures and data on Ignite nodes is guaranteed to be consistent as long as the cluster is alive. Ignite is easy to setup and use which helps developers get started in no time.

    For more information, documentation, and screencasts, visit the Apache Ignite website.

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger.