ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Qian" <daqiqi...@aol.com>
Subject Re: performnace of iBATIS
Date Tue, 28 Feb 2006 14:41:22 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<font face="Arial,sans-serif"><font size="2">Clinton and all,<br>
<br>
Let me first thank you guys for quick response. I believe we have the
best tech support among open source community, either from iBATIS team
or from iBATIS users.&nbsp; <br>
<br>
I used a very simple query which fetches all records in the table (72
rows).&nbsp; Here are some info for my test.<br>
<br>
database: MySql 5.0, query cache is turned on.<br>
iBATIS setting:<br>
<br>
&nbsp;&lt;settings cacheModelsEnabled="true"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// but no cache is set
for query<br>
&nbsp;&nbsp; enhancementEnabled="true"<br>
&nbsp;&nbsp; lazyLoadingEnabled="false"<br>
&nbsp;&nbsp; maxRequests="32"<br>
&nbsp;&nbsp; maxSessions="10"<br>
&nbsp;&nbsp; maxTransactions="5"<br>
&nbsp;&nbsp; useStatementNamespaces="false" /&gt;<br>
&nbsp;&lt;property name="Pool.PingEnabled" value="false"/&gt;<br>
<br>
xml mapping for query:<br>
&nbsp; &lt;typeAlias alias="sessionParameter"
type="com.netscape.isp.business.management.session.SimpleSessionParameter"/&gt;<br>
&nbsp; &lt;select id="getSessionParameterList"
resultClass="sessionParameter" &gt;<br>
&nbsp;&nbsp;&nbsp; SELECT <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parameter_id as parameterId,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parameter_name as name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description as description<br>
&nbsp;&nbsp;&nbsp; FROM SESSION_PARAMETER ORDER by parameter_name<br>
&nbsp; &lt;/select&gt;<br>
<br>
Java code:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
long stime = System.currentTimeMillis();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Context ctx = new InitialContext();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DataSource dataSource = (DataSource)
ctx.lookup(<a class="moz-txt-link-rfc2396E" href="java:comp/env/jdbc/quickstart">"java:comp/env/jdbc/quickstart"</a>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Connection connection = dataSource.getConnection();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Statement stmt = connection.createStatement();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String sql = "SELECT parameter_id, parameter_name,
description FROM SESSION_PARAMETER;" ;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
stmt.execute(sql);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ResultSet rS = stmt.getResultSet();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
List list = new ArrayList();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (rS.first()) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
do {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
list.add(new SimpleSessionParameter(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
rS.getString("parameter_id"),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
rS.getString("parameter_name"),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
rS.getString("description")));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} while (rS.next());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
throw new NotFoundException("no records were found");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
rS.close();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
stmt.close();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
out.println("executing time is " +
(System.currentTimeMillis() - stime) +<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
" current time =" +System.currentTimeMillis() + "
startTime = " + stime); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
stime = System.currentTimeMillis();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
List parameter = new SimpleSessionParameterList();&nbsp;&nbsp; </font></font><font
 face="Arial,sans-serif" size="2"><font size="2"><font color="#0000ff">//
basically it calls "list&nbsp; =
sqlMap.queryForList("getSessionParameterList", null);"</font></font></font><br>
<font face="Arial,sans-serif"><font size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
out.println("Ibatis executing time is " + (System.currentTimeMillis() -
stime) + <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
" current time ="
+System.currentTimeMillis() + "startTime = " + stime); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }catch (Exception e){<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
out.println(" get exception" + e.getMessage());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
Test results:<br>
JDBC executing time is 30 current time =1141136720755 startTime =
1141136720725<br>
Ibatis executing time is 100 current time =1141136720855startTime =
1141136720755<br>
<br>
JDBC executing time is 40 current time =1141136723448 startTime =
1141136723408<br>
Ibatis executing time is 110 current time =1141136723558startTime =
1141136723448<br>
<br>
JDBC executing time is 20 current time =1141136725741 startTime =
1141136725721<br>
Ibatis executing time is 100 current time =1141136725841startTime =
1141136725741<br>
<br>
executing time is 30 current time =1141137529882 startTime =
1141137529852<br>
Ibatis executing time is 101 current time =1141137529983startTime =
1141137529882<br>
<br>
I appreciate your help.<br>
Tony<br>
<br>
<span type="cite">Clinton Begin wrote on 2/28/2006, 1:59 AM:</span>
</font></font>
<p><font face="Arial,sans-serif" size="2"></font></p>
<blockquote type="cite"  style="border-left: thin solid blue; padding-left: 10px; margin-left:
0pt;"><font  face="Arial,sans-serif" size="2"><br>
Post your test code, and I'll show you what's wrong with it.<br>
  <br>
Clinton<br>
  <br>
  <br>
  </font>
  <div><font face="Arial,sans-serif" size="2"><span class="gmail_quote">On
2/27/06, <b class="gmail_sendername"><a href="mailto:DaqiQian2@aol.com">DaqiQian2@aol.com</a></b>
&lt;<a href="mailto:DaqiQian2@aol.com">DaqiQian2@aol.com</a>&gt; wrote:</span></font>
  <blockquote class="gmail_quote"  style="border-left: 1px solid rgb(204, 204, 204); margin:
0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font  face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">Sven,</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">&nbsp;</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">thanks for your
response. I did some preliminary test&nbsp;on&nbsp;iBATIS' performance. For JDBC
(MySql 5.0), i recorded time from establishing connection, result set,
and mapping the result to objects. For list of simple objects,&nbsp;it seems
to me that iBATIS (no caching and lazyloading)&nbsp;is 3-5 times slower than
using JDBC. Of course,&nbsp;i believe my xml mapping has room to improve.
    </font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">&nbsp;</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">The reason I asked is
that I need some stats to&nbsp;persuade myself and coworkers to accept
iBATIS as a data persistence tool for our relatively heavily loaded
servers. </font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">&nbsp;</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">btw,&nbsp;we just pushed a
project using iBATIS to QE. For that project, performance is not big
issue.</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">&nbsp;</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">Thanks,</font></div>
    <font face="Arial,sans-serif" size="2"></font>
    <div><font face="Arial,sans-serif" size="2">Tony&nbsp;&nbsp;</font></div>
    <font face="Arial,sans-serif" size="2"></font></blockquote>
  </div>
  <font face="Arial,sans-serif" size="2"><br>
  </font></blockquote>
</body>
</html>


Mime
View raw message