I'm trying to set up Apache Ignite 2.13 for Hibernate L2 Cache in a Spring Application.
I have it working but compared to Ehcache is really slow (x2 latency). As far as I understand, the replicated cache mode in Ignite works in the same JVM as the application so no network latency is implied.
I also know that performance testing should be done in a distributed environment for Ignite, but even with many instances deployed in Kubernetes, latency is high.
Am I missing something?
I let attached logs from Statistics and my ignite.xml configuration
2022-09-23 13:24:25.268 INFO [xxxx] 1 --- [io-9000-exec-10] i.StatisticalLoggingSessionEventListener : Session Metrics {
513900 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
278500 nanoseconds spent preparing 1 JDBC statements;
1175200 nanoseconds spent executing 1 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
80603200 nanoseconds spent performing 490 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
3686600 nanoseconds spent executing 1 flushes (flushing a total of 306 entities and 573 collections);
328100 nanoseconds spent executing 1 partial-flushes (flushing a total of 1 entities and 1 collections)
}
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
<bean id="hibernateCache" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
<property name="cacheMode" value="REPLICATED"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="writeSynchronizationMode" value="FULL_ASYNC"/>
<property name="onheapCacheEnabled" value="true"/>
<property name="evictionPolicyFactory">
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory">
<!-- 1 GB-->
<property name="maxSize" value="900000000"/>
<property name="maxMemorySize" value="1000000000"/>
</bean>
</property>
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES"/>
<constructor-arg value="10"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="false"/>
<property name="igniteInstanceName" value="hibernate-grid"/>
<property name="metricsLogFrequency" value="0"/>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
</bean>
</property>
</bean>
</property>
<property name="cacheConfiguration">
<list>
<bean parent="hibernateCache">
<property name="name" value="com.example.model0"/>
</bean>
<bean parent="hibernateCache">
<property name="name" value="com.example.model1"/>
</bean>
<bean parent="hibernateCache">
<property name="name" value="com.example.modelN"/>
</bean>
<bean parent="hibernateCache">
<property name="name" value="default-update-timestamps-region"/>
</bean>
<bean parent="hibernateCache">
<property name="name" value="default-query-results-region"/>
</bean>
</list>
</property>
</bean>
</beans>