You are previewing Infinispan Data Grid Platform Definitive Guide.
O'Reilly logo
Infinispan Data Grid Platform Definitive Guide

Book Description

Master Infinispan to create scalable and high-performance applications

In Detail

Infinispan is an extremely scalable, highly available key/ value data store and data grid platform. In-memory data grids (IMDG) have recently been gaining a lot of attention, and the market for this technology is steadily increasing.

This book is a practical guide that covers all Infinispan features in a progressive manner with the help of real-world and ready-to-use examples. You will learn how to install Infinispan and create a perfect development environment. Next, you will learn how to persist data to a permanent store and integrate Infinispan with technologies such as Hibernate OGM, Amazon Web Services (AWS), and CDI. Finally, we will present a sample application that you can download from the JBoss Developer Framework. By the end of this book, you will be able to build extremely scalable applications, providing a highly available key/value data store.

What You Will Learn

  • Install Infinispan and create the perfect development environment

  • Get acquainted with topologies and strategies for different situations and data access patterns

  • Familiarize yourself with scaling techniques and concepts including distributed transactions, ACID, and database sharding

  • Monitor your Infinispan instances by using RHQ or JMX clients

  • Control and manage transactions using JTA and use the available APIs to manipulate your cache data

  • Create an application called TicketMonster and learn how to implement Infinispan

  • Learn about JGroups and how to use it with Infinispan for reliable communication

  • Learn the concepts behind big data and how to work with Infinispan MapReduce API

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Infinispan Data Grid Platform Definitive Guide
      1. Table of Contents
      2. Infinispan Data Grid Platform Definitive Guide
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Getting Started
        1. Introducing the Infinispan data grid
        2. Infinispan and JSR 107 – Java Temporary Caching API
        3. Getting started with Infinispan
          1. Installing Infinispan
          2. Looking inside the box
          3. Using Maven
        4. Running the sample application
        5. Creating your first project
          1. Creating a Maven project manually
        6. Building Infinispan from source
          1. Setting up the environment
        7. Contributing to the project
        8. Summary
      10. 2. Barriers to Scaling Data
        1. Understanding performance and scalability
        2. Improving performance using Infinispan
          1. An introduction to performance tuning
          2. Infinispan and performance
        3. Improving scalability
          1. Vertical scalability
          2. Horizontal scalability
          3. Design tradeoffs
        4. Points to consider about relational databases
          1. Distributed transactions and ACID
          2. CAP theorem
          3. BASE
          4. Infinispan, CAP, and BASE
        5. Scaling out your database
          1. Scaling options
            1. Master-Slave replication
            2. Active/Passive configuration
            3. Database clustering
            4. Database sharding
          2. Infinispan and network partitions
            1. Configuring partition handling
          3. Infinispan and high availability
        6. Summary
      11. 3. Using the APIs
        1. Infinispan architecture
        2. Anatomy of an Infinispan clustered cache
          1. The embedded (P2P) mode
          2. The client/server mode
          3. The cache container
          4. Default cache
          5. Naming your caches
        3. Configuring an Infinispan cache
          1. Declarative configuration on Infinispan 6.0.x
            1. Global configuration (globalType)
            2. Configuration settings
          2. Declarative configuration on Infinispan 7.0.x
            1. Understanding the JGroups element
            2. Configuring the threads subsystem
            3. Configuring the cache-container element
          3. Programmatic configuration
        4. Infinispan APIs
          1. Learning the cache API
            1. Understanding cache evictions
            2. Configuring cache expiration
            3. Eviction v/s Expiration
        5. Persisting data in Infinispan
          1. Configuring a cache loader
          2. Filesystem-based cache loaders
          3. JDBC-based cache loaders
          4. JPA cache store
          5. Selecting a JDBC cache loader
          6. Using passivation in your application
        6. Writing event listeners and notifications
          1. The listener API
            1. Cluster listeners in Infinispan 7.0
          2. Listening to cache-level events
          3. Writing cache manager-level events
          4. Registering event listeners
            1. Configuring logging in Infinispan
        7. Introducing JSR-107 – The Java Caching API
        8. Summary
      12. 4. Infinispan Topologies
        1. Clustering modes
          1. The local mode
          2. The invalidation mode
          3. The replicated mode
            1. Understanding synchronous and asynchronous replication
              1. The synchronous replication
              2. The asynchronous replication
                1. The asynchronous marshalling
                2. The replication queue
          4. The distribution mode
            1. Server Hinting
          5. L1 caching
        2. Summary
      13. 5. Data Access Patterns
        1. Data access patterns
        2. Understanding and configuring second-level cache in Hibernate with Infinispan
          1. Introducing first-level and second-level caching
            1. Configuring Infinispan as Hibernate second-level cache
        3. Implementing the cache-aside programming pattern
        4. Reading and writing through cache
        5. Writing behind caching
          1. The Unscheduled Write-behind strategy
          2. The Scheduled Write-behind strategy
        6. Summary
      14. 6. Case Study – The TicketMonster Application
        1. The JBoss developer framework
        2. Installing and running the TicketMonster application
          1. Project structure
            1. In Eclipse
            2. In IntelliJ
        3. The TicketMonster application use cases
          1. Administrators use cases
            1. Building the administration UI using JBoss Forge
              1. JBoss Forge installation and setup
                1. Forge Plugin for Eclipse
        4. Architecture and design of TicketMonster
          1. The TicketMonster domain model
          2. Utility classes in TicketMonster
          3. The service layer of TicketMonster
        5. Scaling TicketMonster
          1. Clustered Web servers versus stateful session
          2. Which pattern to use?
        6. Adding Infinispan to Ticket Monster
          1. Configuring the infrastructure
          2. Using caches for seat reservations
          3. Implementing shopping carts
        7. Summary
      15. 7. Understanding Transactions and Concurrency
        1. Transaction fundamentals
        2. Java Transaction API
        3. Transactional modes
          1. Non-transactional data access
        4. Transactional models
          1. Optimistic transaction
          2. Pessimistic transaction
          3. Choosing the better transaction model
        5. Batch mode
        6. Transaction recovery
          1. Integrating with Transaction Manager
        7. Locking and concurrency control
          1. Multiversion concurrency control
          2. Configuring isolation levels in Infinispan
          3. Implicit and explicit locking
          4. Lock timeouts
          5. Deadlock detection
          6. Data versioning
        8. Summary
      16. 8. Managing and Monitoring Infinispan
        1. An overview of monitoring and managing with Java
          1. Monitoring and managing Java applications with JMX
        2. Interacting with Infinispan via JMX
          1. The CacheManager level
          2. The cache level
          3. Monitoring Infinispan with JConsole
          4. Monitoring Infinispan with VisualVM
          5. Infinispan's MBeans
        3. Other management tools
          1. Introducing RHQ
            1. Installing and configuring RHQ
              1. Installing RHQ Server
              2. Installing the Infinispan plugin
              3. Installing the RHQ Agent
            2. Monitoring Infinispan
              1. Planning and scheduling operations
              2. Creating alerts
        4. Summary
      17. 9. Server Modules
        1. Client/Server access
        2. Introduction to server modules
          1. Starting the server
          2. Configuration
            1. Customizing the endpoint and Infinispan subsystem
            2. Enabling protocol interoperability
        3. Infinispan REST server
          1. Introduction to REST services
          2. Configuring the Infinispan REST Server on earlier versions
          3. Introducing the REST API
            1. Using HTTP request headers for GET and HEAD operations
              1. Accept
            2. Using HTTP request headers for POST and PUT operations
              1. Content-Type
              2. performAsync
              3. timeToLiveSeconds
              4. maxIdleTimeSeconds
            3. Client side code
            4. cURL
              1. Options
            5. Testing REST services with RESTClient
            6. Consuming RESTful web services with Java
              1. Java.net
        4. Using the Hot Rod server
          1. Hot Rod clients
            1. Using the Hot Rod Java Client
          2. Starting a RemoteCacheManager
          3. Configuring authentication for your Hot Rod application
            1. Introducing the SASL framework
            2. Supported SASL mechanisms
            3. Configuring authorization policies
              1. Realm configuration
              2. Authorization configuration
              3. Client configuration
        5. Infinispan memcached server
          1. The memcached protocol
          2. Connecting the Infinispan memcached server by using a Java Client
        6. The Infinispan WebSocket server
          1. Introducing WebSocket
          2. Overview of the WebSocket API
            1. WebSocket in Java
            2. Using the Infinispan JavaScript API
        7. Introducing the command line interface (CLI)
          1. Starting the command line interface
          2. Using Infinispan CLI commands
            1. Defining data types and time values
            2. Basic commands
              1. connect
              2. disconnect
              3. cache
              4. container
              5. quit
            3. Manipulating caches
              1. get
              2. put
              3. clear
              4. evict
              5. remove
              6. replace
            4. Managing caches
              1. upgrade
              2. Arguments
              3. create
              4. encoding
            5. Managing transactions
              1. begin
              2. commit
              3. rollback
            6. Batching
              1. start
              2. end
              3. abort
            7. Getting statistics and system information
              1. locate
              2. site
              3. stats
              4. version
              5. info
        8. Summary
      18. 10. Getting Started with Hibernate OGM
        1. Introducing Hibernate OGM
          1. Hibernate OGM features
          2. Hibernate OGM architecture
          3. Understanding how the mappings work
        2. Installing and using Hibernate OGM
          1. Creating a Hibernate OGM project using Maven
            1. Configuring the persistence unit
              1. Transaction management
              2. Running Hibernate OGM in the Java EE environment
              3. Running Hibernate OGM in a standalone JTA environment
                1. Running Hibernate OGM without JTA
                2. Configuration properties
            2. Configuring Infinispan caches for Hibernate OGM
            3. Creating the domain model
        3. Summary
      19. 11. An Introduction to JGroups
        1. Introduction to group communication
        2. Understanding the JGroups project
        3. The JGroups architecture
        4. Customizing JGroups settings on Infinispan
          1. An Overview of protocols used by JGroups
            1. Transportation
            2. Membership discovery
            3. Merging
            4. Failure detection
            5. Reliable transmission
            6. Fragmentation of large messages
            7. Ordering protocols
            8. Group membership
            9. State transfer
            10. Security
            11. Flow control
            12. Message stability
        5. Summary
      20. 12. Advanced Topics
        1. Cross-site replication
          1. Configuring cross-site replication
          2. Cross-site replication and transactions
            1. Cross-site replication with non-transactional caches
            2. Cross-site replication with transactional caches
          3. Taking a site offline and online again
        2. Integrating Infinispan with CDI
          1. An introduction to CDI
          2. Setting up CDI support in your Maven POM
            1. Injecting an Infinispan cache into your Beans
            2. Customizing the default configuration
            3. Remote cache integration
            4. JBoss AS7 configured Cache
            5. Integrating with JCache annotations
        3. Using the Map/Reduce API
          1. An introduction to Map/Reduce
          2. Map/Reduce in the Infinispan platform
          3. Sample application – find a destination
        4. Improving the serialization process using externalizers
          1. Introducing the Infinispan externalizer API
          2. Creating advanced externalizers
        5. Summary
      21. Index