myBatis vs iBatis Performance - Why myBatis is slower?

41 views
Skip to first unread message

mgumma

unread,
May 26, 2020, 8:43:29 PM5/26/20
to mybati...@googlegroups.com
We have ported all our code from iBatis to myBatis. Also, upgraded all
myBatis dependency libraries.
Upgraded:
* commons-dbcp2-2.7.0.jar
* commons-pool2-2.8.0.jar
*postgresql-42.2.10.jar
upgrade from ibatis-2.3.4.726 to:
*mybatis-3.5.4.jar and mybatis-spring-1.3.3.jar
Note: Using Spring 3.2.x

We are seeing the following performance degradation during our load testing.
Application server - Linux/Apache tomcat web server,
Database server - Linux/PostgreSQL

*With iBatis load testing: Application server CPU utilization at 45% and DB
Server CPU utilization at 85%.
Throughput - 2440 request per minute

*With myBatis load testing: Application server CPU utilization at 70% and DB
Server CPU utilization at 45%.
Throughput - 1697 request per minute, almost 30% performance reduction
compare to iBatis.

The DB Server CPU utilization goes lower and throughput also goes lower, but
app server CPU utilization goes slightly higher during my load testing.
1. Any ideas?Why the behavior is totally changed? I am unable to find the
reason.
2. Adding another application server into the mix will help to get better
throughput? I mean close to iBatis. I am planning to verify this within week
or two.

Thanks,
-Malli



--
Sent from: http://mybatis-user.963551.n3.nabble.com/

Iwao AVE!

unread,
May 28, 2020, 6:28:25 AM5/28/20
to mybatis-user
Hello Malli,

We may need the details about the statement that becomes slower compared to iBATIS.
Could you post the configuration, Java code and mapper files?

Regards,
Iwao

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/1590540203422-0.post%40n3.nabble.com.

mgumma

unread,
Jun 29, 2020, 3:04:26 PM6/29/20
to mybati...@googlegroups.com
Iwao,

Thanks for the reploy. I think we found the root cause. It seems the dbcp2
upgrades is causing the performance degradation and not the myBatis.
* commons-dbcp2-2.7.0.jar

Here is the background, the BasicDataSource has a property testOnBorrow
that validates a connection when connection borrowed from the pool. The
default is true for the property for dbcp and dbcp2. However, the
validation uses a validation query (validateionQuery property) like "select
1" or whatever you set. The difference is that with dbcp, the validation
query is null by default so the validation is not performed with iBatis.
But, with dbcp2 upgrade, the connection is validated and empty transaction
is committed to the DB and causes performance degradation.

Iwao AVE!

unread,
Jul 1, 2020, 10:47:49 AM7/1/20
to mybatis-user
Hello,

Thank you very much for sharing your findings!
I'll remember that DBCP2's testOnBorrow could affect performance.

Regards,
Iwao

--
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.
Reply all
Reply to author
Forward
0 new messages