Search code examples
ignite

Ignite Cache Persistence server for DB with servers for compute


I'm using Ignite 2.5 and have deployed a couple of servers like this:

  1. One computer acts as DB server with persistence enabled.
  2. Three other computers are compute servers with same cache as on DB server but without persistence.

I have classes like this:

public class Address implements Serializable
{
  String streetName;
  String houseNumber;
  String cityName;
  String countryName;
}

public class Person implements Serializable
{
  @QuerySqlField
  String firstName;

  @QuerySqlField
  String lastName;

  @QuerySqlField
  Address homeAddress;
}

The cache is configured on all servers with this XML:

 <bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="Persons" />
    <property name="cacheMode" value="PARTITIONED" />
    <property name="backups" value="0" />
    <property name="storeKeepBinary" value="true" />
    <property name="atomicityMode" value="TRANSACTIONAL"/> 
    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
    <property name="indexedTypes">
        <list>
            <value>java.lang.String</value>
            <value>Person</value>
        </list>
    </property>
 </bean>

On the DB server in addition there is persistence enabled like this:

<property name="dataStorageConfiguration">
    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
        <property name="storagePath" value="/data/Storage" />
        <property name="walPath" value="/data/Wal" />
        <property name="walArchivePath" value="/data/WalArchive" />
        <property name="defaultDataRegionConfiguration">
            <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                <property name="initialSize" value="536870912" />
                <property name="maxSize" value="1073741824" />
                <property name="persistenceEnabled" value="true" />
            </bean>
        </property>
    </bean>
</property>

<property name="binaryConfiguration">
    <bean class="org.apache.ignite.configuration.BinaryConfiguration">
        <property name="compactFooter" value="false" />
    </bean>
</property>

The cache is used with put/get but also with SqlQuery and SqlFieldsQuery.

From time to time I have to update the class definitions, i.e. add another field or so. I'm fine to shut down the whole cluster for updating the classes as it requires an application update anyway.

  • I believe the above configuration is generally OK to use for Ignite?
  • Do I understand this other question (Apache Ignite persistent store recommended way for class versions) correctly that on the DB server I shall not have the Person classes in the classpath? Wouldn't then the XML config fail because it's missing the index classes?
  • On compute servers I shall also not use the Person classes but instead read from cache into BinaryObject? Is the idea to manually fill my Person class from the BinaryObject?

Currently when I update a field in the Person class I get strange errors like:

Unknown pair [platformId=0, typeId=1968448811]

Sorry if there are multiple questions here, I somehow am lost with the "Unknown pair" issues and am now questioning if my complete setup is right.

Thanks for any advise.


Solution

    • I believe the above configuration is generally OK to use for Ignite?

    No, you can't configure persistence only for one node only. So in your case, all nodes will store data, but only one node will persist its data, so only part of data will be persisted and this can lead to unpredictable consequences. If you want only one node to store data you need to configure node filter.

    With the node filter, the cache will be located only on one node and this node will store data, however in this case your compute nodes would have to do network IO to read from cache.

    • Do I understand this other question (Apache Ignite persistent store recommended way for class versions) correctly that on the DB server I shall not have the Person classes in the classpath? Wouldn't then the XML config fail because it's missing the index classes?

    You don't need classes of your model to be in the classpath, but please, make sure that you work with BinaryObjects only on the server side, so all compute tasks should use BinaryObjects. Also as you mentioned, this configuration won't work, you need to use Query Entity instead for index configuration.

    • On compute servers I shall also not use the Person classes but instead read from cache into BinaryObject? Is the idea to manually fill my Person class from the BinaryObject?

    Well, if you don't have the Person class on the server side you just can't create Person class, you need to use BinaryObject in your compute jobs.

    Currently when I update a field in the Person class I get strange errors like: Unknown pair [platformId=0, typeId=1968448811]

    Could you please provide the full stacktrace and say on what operation you get this error?