Asynchronous Persistent Store Update

classic Classic list List threaded Threaded
2 messages Options
ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Asynchronous Persistent Store Update

Hi,
   I need to update my underlying SQL Server DB asynchronously so that the cache performance is not impacted. But the DB is getting updated as soon as the Put operation is getting executed. Below is my xml config and the code that performs Put operation and from StoreAdapter. Please let me know if I am missing any additional settings.

<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushSize" value="0"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
        </bean>

cache.Put(5, new BusinessUnit
                {
                    BUID = 5,
                    BUName = "BU5",
                    CreatedByID = 5
                });

public override void Write(object key, object val)
        {
            entities.BusinessUnits.Add((BusinessUnit)val);
            entities.SaveChanges();
        }

Thanks,
Satya.
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

RE: Asynchronous Persistent Store Update

Hi,

 

WriteBehindFlushSize has to be set to value bigger than 0.

Synchronous updates happen if the write-behind queue size (writeBehindFlushSize) is exceeded.

You should tune this queue’s size and flush frequency in a way that the write behind flushers clear the queue faster than it’s being filled up.

 

Sent from my Windows 10 phone

 

From: [hidden email]
Sent: Saturday, April 9, 2016 7:41
To: [hidden email]
Subject: Asynchronous Persistent Store Update

 

Hi,

   I need to update my underlying SQL Server DB asynchronously so that the cache performance is not impacted. But the DB is getting updated as soon as the Put operation is getting executed. Below is my xml config and the code that performs Put operation and from StoreAdapter. Please let me know if I am missing any additional settings.

 

<bean class="org.apache.ignite.configuration.CacheConfiguration">

          <property name="writeThrough" value="true"/>

          <property name="readThrough" value="true"/>

          <property name="writeBehindEnabled" value="true"/>

          <property name="writeBehindFlushSize" value="0"/>

          <property name="writeBehindFlushFrequency" value="120000"/>

          <property name="cacheStoreFactory">

            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">

              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>

            </bean>

          </property>

        </bean>

 

cache.Put(5, new BusinessUnit

                {

                    BUID = 5,

                    BUName = "BU5",

                    CreatedByID = 5

                });

 

public override void Write(object key, object val)

        {

            entities.BusinessUnits.Add((BusinessUnit)val);

            entities.SaveChanges();

        }

 

Thanks,

Satya.