Let’s first have some basic understanding of Apache Ignite and then we will look more into its life cycle with the help of a demo application.
Apache Ignite is an in-memory computing platform that is durable strongly consistent and highly available with powerful SQL, key value and processing APIs.
- Durable Memory : Apache Ignite is based on the Durable Memory architecture that allows storing and processing data and indexes both in memory and on disk when the Ignite Native Persistent feature is enabled.
- Ignite Persistence : Ignite native persistence is a distributed, ACID, and SQL-compliant disk store that transparently integrates with Ignite’s durable memory. Ignite persistence is optional and can be turned on and off. When turned off Ignite becomes a pure in-memory store.With the the native persistence enabled, Ignite always stores a superset of data on disk, and as much as possible in RAM.
- ACID Compliance : Data stored in Ignite is ACID-compliant both in memory and on disk, making Ignite a strongly consistent system. Ignite transactions work across the network and can span multiple servers. This makes Ignite stand out from the eventually consistent NoSQL systems that hardly support any type of transactions.
Installation Steps :
For installation of Apache Ignite, refer to the following steps:
Step 1 : Download Apache Ignite as ZIP archive from https://ignite.apache.org/
Step 2 : Unzip ZIP archive into the installation folder in your system
Step 3 : Set IGNITE_HOME environment variable to point to the installation folder (Optional)
Step 4 : Go to IGNITE_HOME and hit the following command from terminal:
i) To start a grid node with default configuration,
ii) To pass configuration file explicitly,
When another server is up, below is the screenshot of its result.
The last line tells the number of server and client nodes up. We can have as many nodes up as per our use case.
There are other dependencies which are available.
- ignite-indexing (optional, add if you need SQL indexing)
- ignite-spring (optional, add if you plan to use Spring configuration)
Before moving to the demo application, let’s first have a look at the Ignite Life Cycle.
Ignite Life Cycle
Ignite is JVM-based. JVM represents one or more logical Ignite nodes. Therefore
Ignite runtime == JVM process == Ignite node (in most cases)
The Ignition class starts individual Ignite nodes in the network topology. Note that a physical server (like a computer on the network) can have multiple Ignite nodes running on it. Create cache on all the existing and future server nodes. Now, you can add put and get data from the cache.
My demo application consists of :
- Student – This is a POJO.
- StudentData – It is an interface in which data of student is stored temporarily. From this, the data is fetched and saved into the cache.
- ExtractData – It creates an ignite node.Cache is created where the data of student is added using the method putStudentData. The data is then retrieved from the cache using getStudentData. Then it is simply displayed using displayStudentData. Although all these operations can be performed in a single method, I have created different since it is just a demo code and further creates clarification.
When you run the code, the output will be as follows:
In this case, the number of server node and client node is one each.
Here is the link for the above demo code.
Reference : https://ignite.apache.org/