Hi  Slava Koptilin

Thanks for your email.

Cache configuration used at time of cache creation in C# code. Please
suggest me if any configuration changes required in cache level or grid
level
CacheConfiguration.CopyOnRead=false
CacheConfiguration.EagerTtl=true
CacheConfiguration.CacheMode = CacheMode.Partitioned
CacheConfiguration.Backups = 1

*Client node xml bean*

<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
                           http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util.xsd";>
  <bean class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="clientMode" value="true"/>
    <property name="clientFailureDetectionTimeout" value="120000"/>
    <property name="igniteInstanceName" value="DynamicGrid_Prod"/>
    <property name="longQueryWarningTimeout" value="4000"/>
    <property name="failureDetectionTimeout" value="120000"/>
    <property name="localHost" value="1.0.0.3"/>
    <property name="segmentationPolicy" value="RESTART_JVM"/>
    <property name="segmentCheckFrequency" value="20000"/>
    <property name="segmentationResolveAttempts" value="10"/>
    <property name="discoverySpi">
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="localPort" value="55500"/>
        <property name="ipFinder">
          <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
            <property name="addresses">
              <list>
<value>1.0.0.1:55500</value>

<value>1.0.0.2:55500</value>
              </list>
            </property>
          </bean>
        </property>
      </bean>
    </property>
<property name="communicationSpi">
        <bean
class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
   <property name="sharedMemoryPort" value="-1"/>
            <property name="localPort" value="55605"/>
        </bean>
    </property>
  </bean>
</beans>

*Server node xml bean*

<?xml version="1.0" encoding="UTF-8"?>
<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.xsd
                           http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util.xsd";>
  <bean id="expireCache"
class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
    <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="60"/>
                </bean>
            </constructor-arg>
       </bean>
    </property>
  </bean>
  <bean class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="clientMode" value="false"/>
    <property name="clientFailureDetectionTimeout" value="120000"/>
    <property name="igniteInstanceName" value="DynamicGrid_Prod"/>
    <property name="longQueryWarningTimeout" value="4000"/>
    <property name="failureDetectionTimeout" value="120000"/>
    <property name="localHost" value="1.0.0.1"/>
    <property name="segmentationPolicy" value="RESTART_JVM"/>
    <property name="segmentCheckFrequency" value="20000"/>
    <property name="segmentationResolveAttempts" value="10"/>
    <property name="discoverySpi">
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="localPort" value="55500"/>
        <property name="ipFinder">
          <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
            <property name="addresses">
              <list>
                        <value>1.0.0.1:55500</value>
                        <value>1.0.0.2:55500</value>
              </list>
            </property>
          </bean>
        </property>
      </bean>
    </property>
   <property name="cacheConfiguration">
                        <list>
                                <bean parent="expireCache">
                                        <property name="name"
value="TestModel1"/>
                                </bean>
                                <bean parent="expireCache">
                                        <property name="name"
value="TestModel2"/>
                                </bean>
                                <bean parent="expireCache">
                                        <property name="name"
value="TestModel3"/>
                                </bean>
                                <bean parent="expireCache">
                                        <property name="name"
value="TestModel4"/>
                                </bean>
                                <bean parent="expireCache">
                                        <property name="name"
value="TestModel5"/>
                                </bean>
                        </list>
                </property>
        <property name="dataStorageConfiguration">
            <bean
class="org.apache.ignite.configuration.DataStorageConfiguration">
                <property name="defaultDataRegionConfiguration">
                    <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
                        <property name="name"
value="Common_Dynamic_Data_Region"/>
                        <property name="initialSize" value="#{1L * 1024 *
1024 * 1024}"/>
                        <property name="maxSize" value="#{18L * 1024 * 1024
* 1024}"/>
                        <property name="pageEvictionMode"
value="RANDOM_2_LRU"/>
                        <property name="evictionThreshold" value="0.7"/>
                        <property name="emptyPagesPoolSize" value="65536"/>
                    </bean>
                </property>
            </bean>
        </property>
        <property name="communicationSpi">
        <bean
class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
            <property name="sharedMemoryPort" value="-1"/>
            <property name="localPort" value="55605"/>
        </bean>
    </property>
  </bean>
</beans>

Thanks & Regards,
Charlin



On Wed, 12 Jun 2024 at 13:07, Вячеслав Коптилин <slava.kopti...@gmail.com>
wrote:

> Hi Charlin,
>
> I mean that it might be "well-known" behavior if you use `primary sync`
> mode and the `readFromBackup` property equals `true` (which is `true` by
> default).
>
> The first option, to overcome this problem, is using `full sync` mode. In
> that case, the update request will wait for the write to complete on all
> participating nodes (primary and backups).
> The second option, that can be used here, is to use 'primary sync' and set
> 'CacheConfiguration#readFromBackup' flag to false. Ignite will always send
> the request to the primary node and get the value from there.
>
> Thanks,
> S.
>
> пн, 10 июн. 2024 г. в 14:22, Вячеслав Коптилин <slava.kopti...@gmail.com>:
>
>> Hello Charlin,
>>
>> Could you share your cache configuration? Specifically, what values are
>> used for `readFromBackup` and `writeSynchronizationMode`.
>>
>> Thanks,
>> S.
>>
>> ср, 5 июн. 2024 г. в 15:49, Charlin S <charli...@hotelhub.com>:
>>
>>> Hi All,
>>> I am unable to fetch data from cache by reading by
>>> key.intermittently (very rarely).
>>>
>>> Ignite version: 2.10
>>> Cache mode: Partition
>>> Client : C# with Ignite thick client
>>>
>>> Scenario:
>>> My C# application received a request for cache data insertion @ 09:09:35
>>> and successfully insertion initiated at application side.
>>> Thereafter @ 09:10:21 C# application received a request to read cache
>>> data for the same key and Ignite TryGet could not fetch data.
>>> Note: We are able to get cache data by the same key after some time.
>>>
>>> Cache creation code
>>> var IgniteCache= IIgnite.GetCache<string, cacheModel>("cacheModel")
>>>         .WithExpiryPolicy(new ExpiryPolicy(
>>>              TimeSpan.FromMinutes(60),
>>>              TimeSpan.FromMinutes(60),
>>>              TimeSpan.FromMinutes(60)
>>>              ));
>>>
>>> Cache data insertion code
>>> IgniteCache.Put(cacheKey, (T)data);
>>>
>>> Cache data reading code
>>>   IgniteCache.TryGet(Key, out var value);
>>>
>>> Thanks & Regards,
>>> Charlin
>>>
>>>
>>>
>>>

Reply via email to