How do Configure Index forIn memory Ignite Cache without Persistent Storage

25 Views Asked by At

Ignite - In our Application we are trying to load data to the Cache from File on Startup of the application. We are trying to retrieve the values during Application Processing [ ex an API Request landing to our application trying to validate data in cache with in the request.

Questions

  • Our Cache is configured /externalized [ REfer Example below]

     <bean class="org.apache.ignite.configuration.CacheConfiguration">
       <property name="name" value="AppMaster"/>
       <property name="cacheMode" value="PARTITIONED"/>
       <property name="atomicityMode" value="ATOMIC"/>
    <property name="queryEntities">
    <list>
      <bean class="org.apache.ignite.cache.QueryEntity">
       <property name="keyType" value="java.lang.String"/>
       <property name="valueType" value="java.util.HashMap"/>
       <property name="keyFieldName" value="keyId"/>
      <property name="keyFields">
       <list>
          <value>keyId</value>
       </list>
    </property>
     <property name="fields">
       <map>
        <entry key="keyId" value="java.lang.String"/>
       </map>
      </property>
     <property name="aliases">
       <map>
       <entry key="keyId" value="keyId"/>                                                                         
      </map>
      </property>
     </bean>
     </list>
    </property>
    </bean> 

Issues

  • Normal Key get Operation takes 200ms(approx) on high load
  • The Above operation has Key - Value [ value is hashmap of objects]
  • What could be reason for getting large response time for simple .get Operation while running on 8 core 32 GB VM
  • Stripe Pool is kept default 8 [ number of cores]

How to find the Routecause of the delay,even tried IGNITE_QUIET=N, but couldnt proceed with solution.

1

There are 1 best solutions below

1
user21160483 On

Note that your key is effectively always indexed. So if you are inquiring about adding an index to some other column, then that column must appear as a separate and independent column and not some arbitrary entry in a HashMap. Given the above my recommendation would be as follows: 1.) Identify the types and names for each column from your input file 2.) Create your cache using an SQL create statement with the above names and values. 3.) Load your data into the above SQL table 4.) Use a create index statement to add an index to your desired column. 5.) Query using filters or conditions based on your indexed column.

See the following for details on creating indexes:

https://ignite.apache.org/docs/latest/SQL/indexes

Hope that helps!