1

Our Application has been designed to talk to the Database via Cache. i.e Apache Ignite acts as Layer before Database Application uses Embedded Ignite, where POJO Based Data store is being used.

Table Consists of the Following columns
SAMPLE_TABLE
ID NUMBER
NAME VARCHAR2(50)
PYLD BLOB 

While we insert the data to cache it takes more than 100ms to 300ms to Insert Blob Datatype. where as insert happens quickly for Tables without BLOB type column in it

    <bean
                class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="MessageDataCache" />
                <property name="cacheMode" value="PARTITIONED" />
                <property name="atomicityMode" value="ATOMIC" />
                <property name="expiryPolicyFactory">
                    <bean class="javax.cache.expiry.CreatedExpiryPolicy"
                        factory-method="factoryOf">
                        <constructor-arg>
                            <bean class="javax.cache.expiry.Duration">
                                <constructor-arg value="SECONDS" />
                                <constructor-arg value="30" />
                            </bean>
                        </constructor-arg>
                    </bean>
                </property>

                <property name="cacheStoreFactory">
                    <bean
                        class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
                        <property name="dataSourceBean" value="dataSourceMR" />
                        <property name="dialect">
                            <bean
                                class="org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect">
                            </bean>
                        </property>

                        <property name="types">
                            <list>
                                <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
                                    <property name="cacheName" value="MessageDataCache" />
                                    <property name="keyType" value="java.lang.String" />
                                    <property name="valueType"
                                        value="com.SampleData" />
                                    <property name="databaseSchema" value="SampleBlobDB" />   <!-- Changed name for public posting -->
                                    <property name="databaseTable" value="SampleBlobTable" />

                                    <property name="keyFields">
                                        <list>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.VARCHAR" />
                                                </constructor-arg>
                                                <constructor-arg value="MESSAGE_ID" />
                                                <constructor-arg value="java.lang.String" />
                                                <constructor-arg value="messageId" />
                                            </bean>
                                        </list>
                                    </property>

                                    <property name="valueFields">
                                        <list>
                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.BLOB" />
                                                </constructor-arg>
                                                <constructor-arg value="RAW_DATA" />
                                                <constructor-arg value="byte[]" />
                                                <constructor-arg value="rawData" />
                                            </bean>

                                            <bean
                                                class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                                <constructor-arg>
                                                    <util:constant
                                                        static-field="java.sql.Types.TIMESTAMP" />
                                                </constructor-arg>
                                                <constructor-arg value="CREATED_ON" />
                                                <constructor-arg value="java.sql.Timestamp" />
                                                <constructor-arg value="createdOn" />
                                            </bean>
                                        </list>
                                    </property>
                                </bean>
                            </list>
                        </property>
                    </bean>
                </property>

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

                <property name="queryEntities">
                    <list>
                        <bean class="org.apache.ignite.cache.QueryEntity">
                            <property name="keyType" value="java.lang.String" />
                            <property name="valueType"
                                value="com.SampleData" />
                            <property name="tableName" value="SampleBlobTable" />
                            <property name="keyFieldName" value="messageId" />

                            <property name="keyFields">
                                <list>
                                    <value>messageId</value>
                                </list>
                            </property>

                            <property name="fields">
                                <map>
                                    <entry key="rawData" value="[B" />
                                    <entry key="createdOn" value="java.sql.Timestamp" />
                                    <entry key="messageId" value="java.lang.String" />
                                </map>
                            </property>

                            <property name="aliases">
                                <map>
                                    <entry key="messageId" value="MESSAGE_ID" />
                                    <entry key="rawData" value="RAW_DATA" />
                                    <entry key="createdOn" value="CREATED_ON" />
                                </map>
                            </property>
                        </bean>
                    </list>
                </property>
            </bean>
            <!-- Configuration for MessageMetaCache -->

Questions

  • Do POJO Store always cause Such Delays
  • What is the correct way to persist BLOB via Ignite to the Database [ Note we are not using Ignite Native Persistence]

0 Answers0