Search code examples
spring-bootignite

Apache Ignite: is my data read from memory or disk?


I need to understand if the following configuration of Ignite will serve my data from memory or from disk.

Ignite configuration:

<property name="dataStorageConfiguration">
    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
        <property name="defaultDataRegionConfiguration">
            <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                <property name="persistenceEnabled" value="true"/>
            </bean>
        </property>
    </bean>
</property>

Java Code:

ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient client = Ignition.startClient(cfg)) {
    ClientCache<Long, SensorsWaiting> cache = client.cache("SQL_PUBLIC_FOO");
    FieldsQueryCursor<List<?>> query = cache.query(new SqlFieldsQuery("select * from foo"));
}

Background of the question: I expect a large number of queries and need the results being served from memory. At the same time I need the data to be stored to disk in case the Ignite Server crashes or needs to be restarted.

  • Is my understanding correct, that in this case my data is served from memory?
  • What if I use the JDBC driver? Is it still the same? What is the difference between the cache and the jdbc driver?

Solution

  • It'll be served from memory if it's in memory, otherwise it will be pulled in from disk. (This distinction is important if you have more data than you have memory or for when the cluster starts up.)

    The different APIs all access the same data. Whether you use the JCache (get, put), SqlFieldsQuery or JDBC/ODBC, it's all the same.