--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
log4j-1.2.17.jar
mybatis-ehcache-1.0.1.jar
slf4j-api-1.6.1.jar
hazelcast-2.0.2.jar
mybatis-hazelcast-1.0.1.jar
log4j-1.2.17.jar
mybatis-memcached-1.0.0-beta1.jar
spymemcached-2.8.1.jar
log4j-1.2.17.jar
mybatis-oscache-1.0.1.jar
oscache-2.4.jar
commons-logging-1.1.jar
log4j-1.2.17.jar
<!-- ehcache mapper configuration xml file -->
|
<cache type="org.mybatis.caches.ehcache.EhcacheCache" /> <cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
<?xml version="1.0" encoding="UTF-8" ?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false" monitoring="autodetect" dynamicConfig="true">
<defaultCache timeToIdleSeconds="120" timeToLiveSeconds="120" maxEntriesLocalHeap="10000" maxEntriesLocalDisk="10000000" memoryStoreEvictionPolicy="LRU" />
</ehcache> <!-------------------------------------------------------------------> <!-- hazelcast mapper configuration xml file --> <cache type="org.mybatis.caches.hazelcast.HazelcastCache " /> <cache type="org.mybatis.caches.hazelcast.LoggingHazelcastCache"
/> <!-- hazelcast configuration xml file --> <?xml version="1.0" encoding="UTF-8"?> <hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-2.5.xsd" xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- cofiguration reference site -> http://www.hazelcast.com/docs.jsp -->
</hazelcast> <!-------------------------------------------------------------------> <!-------------------------------------------------------------------> <!-- memcached mapper configuration xml file --> <cache type="org.mybatis.caches.memcached.MemcachedCache" /> <cache type="org.mybatis.caches.memcached.LoggingMemcachedCache"
/> <!-------------------------------------------------------------------> <!-------------------------------------------------------------------> <!-- oscache mapper configuration xml file --> <cache type="org.mybatis.caches.oscache.OSCache" />
<cache
type="org.mybatis.caches.oscache.LoggingOSCache" /> cache.capacity=1000 cache.memory=true
cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache <!-------------------------------------------------------------------> |
====================================================
import java.io.Reader;
import java.util.Calendar;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.Logger;
public class RunCache {
private static Logger logger = Logger.getLogger(RunCache.class);
private static SqlSessionFactory sqlSessionFactory;
static {
try {
String resource = "chapter14/resources/mybatis/config-mybatis.xml";
Reader reader = Resources.getResourceAsReader(resource);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
long intervalTime = 0;
for (int count = 0; count < 100000; count++) {
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
long startIntervalTime = Calendar.getInstance().getTimeInMillis();
sqlSession.selectList("chapter14.org.mybatis.persistence.ShopMapper.selectListShop");
long endIntervalTime = Calendar.getInstance().getTimeInMillis();
intervalTime = intervalTime + (endIntervalTime - startIntervalTime);
} catch (Exception e) {
e.printStackTrace();
} finally {
sqlSession.close();
}
}
logger.debug("Total interval time is : " + intervalTime);
}
}See :
>> report : compare mybatis default cache with third part cache...
4. result
====================================================
# mybatis default cache - 7841ms
Ehcache - 1564msHzelcast - 1990msOSCache - 1775ms
2)It is a join query combining 7 tables.(Please note that I am not making use of nested selects).
Thanks.Krithika
On Monday, 6 January 2014 13:59:13 UTC-5, Guy Rouillier wrote:On 1/6/2014 12:58 PM, Krithika Vittal wrote:What does your SQL and your mapper look like? Are you using nested
> I am using mybatis-3.1.0.jar and mybatis-spring-1.1.0.jar
> It is taking 93 seconds to map 44000 rows to a resultmap containing
> collection of three other objects
> Is there any thing i could do to speed up the process(indexing the table
> is one option) ?
SELECTs for the collections? If so, that may be the source of your
performance issues. See if you can retrieve all the data using a single
SELECT.
--
Guy Rouillier
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Akash Singla , Now I am able to pull around 3000 objects in 18 seconds.