Hi,

You could try to use igniteCache.putAll  for write batches by 1000 entries.
Use following script in PostgresDBStore#writeAll method to put data into
the database:
String sqlString = "INSERT INTO test(val) VALUES (:val1)(:val2)(:val3);";


2018-03-14 11:58 GMT+03:00 <[email protected]>:

> Hi,
>
> I try to use Ignite to integrate with PostgreSQL.
>
> And I use “atop” to monitor the data write to PostgreSQL.
>
> Then observed that the writing speed is 1 MB per second.
>
> This performance is not really good. Below is my configuration and code.
> Please help me to improve it.
>
> Thanks.
>
>
>
> There is my cache configuration:
>
>                               <bean class="org.apache.ignite.
> configuration.CacheConfiguration">
>
>                                     <property name="name" value=
> "testCache"/>
>
>                                     <property name="cacheMode"
> value="PARTITIONED"/>
>
>                                     <property name="atomicityMode" value="
> ATOMIC"/>
>
>                                     <property name="atomicWriteOrderMode"
> value="PRIMARY"/>
>
>                      <property name="readThrough" value="true"/>
>
>                                         <property name="writeThrough"
> value="true"/>
>
>                              <property name="writeBehindEnabled"
> value="true"/>
>
>
>
>                              <property name="writeBehindFlushThreadCount"
> value="64"/>
>
>                              <property name="writeBehindBatchSize"
> value="131072" />
>
>                              <property name="writeBehindFlushSize"
> value="131072" />
>
>
>
>                              <property name="offHeapMaxMemory" value="0" />
>
>                          <property name="cacheStoreFactory">
>
>                         <bean class="javax.cache.
> configuration.FactoryBuilder$SingletonFactory">
>
>                              <constructor-arg>
>
>                                  <bean class="com.blu.imdg.jdbc.
> PostgresDBStore">
>
>                                  </bean>
>
>                              </constructor-arg>
>
>                                                 </bean>
>
>                                     </property>
>
>                                     <property name="backups" value="0"/>
>
>                                     <property name="indexedTypes">
>
>                                                 <list>
>
>
> <value>java.lang.String</value>
>
>
> <value>java.lang.String</value>
>
>                        </list>
>
>                                     </property>
>
>                 </bean>
>
>
>
>
>
> Main function:
>
>         Ignite ignite = Ignition.start("PATH/example-cache.xml");
>
>         IgniteCache<String, String> igniteCache = 
> ignite.getOrCreateCache("testCache
> ");
>
>         int seqint = 0;
>
>         while(true)
>
>         {
>
>                         igniteCache.put(Integer.toString(seqint),
> "valueString");
>
>                         seqint++;
>
>         }
>
>
>
>
>
> Write behind to PostgreSQL through JDBC:
>
> @Override
>
> public void write(Cache.Entry<? extends String, ? extends String> entry)
> throws CacheWriterException {
>
> Map<String, Object> parameterMap = new HashMap<>();
>
> parameterMap.put(“val”, entry.getValue());
>
> String sqlString = "INSERT INTO test(val) VALUES (:val);";
>
> jdbcTemplate.update(sqlString, parameterMap);
>
> }
>
>
>
>
> --
> 本信件可能包含工研院機密資訊,非指定之收件者,請勿使用或揭露本信件內容,並請銷毀此信件。 This email may contain
> confidential information. Please do not use or disclose it in any way and
> delete it if you are not the intended recipient.
>



-- 

Regards

Pavel Vinokurov

Reply via email to