ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: performnace of iBATIS
Date Wed, 01 Mar 2006 01:52:09 GMT
Thanks you for your honesty and the clarification.

Cheers,
Clinton


On 2/28/06, Tony Qian <daqiqian2@aol.com> wrote:
>
> Brandon and all,
>
> I convinced myself now that iBATIS is almost as good as JDBC for simple
> query. I made mistake that I forgot to turn off ibatis debug log. After
> I turned it off, iBATIS and JDBC call were very close.
>
> Sorry for confusion and wish the best for iBATIS and this community.
>
> Thanks,
> Tony
>
> Brandon Goodin wrote on 2/28/2006, 11:15 AM:
>
> > Please post all the code you use to test jdbc and ibatis. There are a
> > few mistakes that people can often make. One is that you don't perform
> > the resultset to object translation. The next is that the test could
> > be loading the sqlmap each time it is run. iBATIS will have initial
> > overhead because it is parsing and loading the sqlmaps into memory.
> >
> > Brandon
> >
> > On 2/28/06, Tony Qian <daqiqian2@aol.com> wrote:
> > >       Clinton and all,
> > >
> > >  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.
> > >
> > >  I used a very simple query which fetches all records in the table (72
> > > rows).  Here are some info for my test.
> > >
> > >  database: MySql 5.0, query cache is turned on.
> > >  iBATIS setting:
> > >
> > >   <settings cacheModelsEnabled="true"       // but no cache is set
> > for query
> > >     enhancementEnabled="true"
> > >     lazyLoadingEnabled="false"
> > >     maxRequests="32"
> > >     maxSessions="10"
> > >     maxTransactions="5"
> > >     useStatementNamespaces="false" />
> > >   <property name="Pool.PingEnabled" value="false"/>
> > >
> > >  xml mapping for query:
> > >    <typeAlias alias="sessionParameter"
> > >
> >
> type="com.netscape.isp.business.management.session.SimpleSessionParameter
> "/>
>
> >
> > >    <select id="getSessionParameterList"
> > resultClass="sessionParameter" >
> > >      SELECT
> > >        parameter_id as parameterId,
> > >        parameter_name as name,
> > >        description as description
> > >      FROM SESSION_PARAMETER ORDER by parameter_name
> > >    </select>
> > >
> > >  Java code:
> > >          try{
> > >              long stime = System.currentTimeMillis();
> > >              Context ctx = new InitialContext();
> > >              DataSource dataSource = (DataSource)
> > > ctx.lookup("java:comp/env/jdbc/quickstart");
> > >              Connection connection = dataSource.getConnection();
> > >              Statement stmt = connection.createStatement();
> > >              String sql = "SELECT parameter_id, parameter_name,
> > description
> > > FROM SESSION_PARAMETER;" ;
> > >              stmt.execute(sql);
> > >              ResultSet rS = stmt.getResultSet();
> > >              List list = new ArrayList();
> > >              if (rS.first()) {
> > >                   do {
> > >                       list.add(new SimpleSessionParameter(
> > >                                rS.getString("parameter_id"),
> > >                                rS.getString("parameter_name"),
> > >                                rS.getString("description")));
> > >              } while (rS.next());
> > >              } else {
> > >                  throw new NotFoundException("no records were found");
> > >              }
> > >              rS.close();
> > >              stmt.close();
> > >              out.println("executing time is " +
> > (System.currentTimeMillis()
> > > - stime) +
> > >                    " current time =" +System.currentTimeMillis() + "
> > > startTime = " + stime);
> > >              stime = System.currentTimeMillis();
> > >              List parameter = new SimpleSessionParameterList();   //
> > > basically it calls "list  =
> > sqlMap.queryForList("getSessionParameterList",
> > > null);"
> > >              out.println("Ibatis executing time is " +
> > > (System.currentTimeMillis() - stime) +
> > >                                 " current time ="
> > > +System.currentTimeMillis() + "startTime = " + stime);
> > >         }catch (Exception e){
> > >              out.println(" get exception" + e.getMessage());
> > >        }
> > >
> > >
> > >  Test results:
> > >  JDBC executing time is 30 current time =1141136720755 startTime =
> > > 1141136720725
> > >  Ibatis executing time is 100 current time =1141136720855startTime =
> > > 1141136720755
> > >
> > >  JDBC executing time is 40 current time =1141136723448 startTime =
> > > 1141136723408
> > >  Ibatis executing time is 110 current time =1141136723558startTime =
> > > 1141136723448
> > >
> > >  JDBC executing time is 20 current time =1141136725741 startTime =
> > > 1141136725721
> > >  Ibatis executing time is 100 current time =1141136725841startTime =
> > > 1141136725741
> > >
> > >  executing time is 30 current time =1141137529882 startTime =
> > 1141137529852
> > >  Ibatis executing time is 101 current time =1141137529983startTime =
> > > 1141137529882
> > >
> > >  I appreciate your help.
> > >  Tony
> > >
> > >  Clinton Begin wrote on 2/28/2006, 1:59 AM:
> > >
> > >
> > >  Post your test code, and I'll show you what's wrong with it.
> > >
> > >  Clinton
> > >
> > >
> > >
> > > On 2/27/06, DaqiQian2@aol.com <DaqiQian2@aol.com> wrote:
> > >
> > > Sven,
> > >
> > >   thanks for your response. I did some preliminary test on 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, it seems to me that iBATIS (no caching and
> > lazyloading) is
> > > 3-5 times slower than using JDBC. Of course, i believe my xml
> > mapping has
> > > room to improve.
> > >
> > >   The reason I asked is that I need some stats to persuade myself and
> > > coworkers to accept iBATIS as a data persistence tool for our
> > relatively
> > > heavily loaded servers.
> > >
> > >   btw, we just pushed a project using iBATIS to QE. For that project,
> > > performance is not big issue.
> > >
> > >   Thanks,
> > >   Tony
> > >
> > >
> >
>
>
>

Mime
View raw message