You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Chris O'Connell <oc...@gorillachicago.com> on 2009/04/27 21:26:39 UTC

Looks like iBatis is processing data slowly...

I know that if I were to get a DBA involved, I could get some further
details, but I'm trying to get as much information as I can before I start
to get the bureaucracy involved...
Anyway, I am able to log my sql and the results with no problems.  The issue
I have is that stuff is just running so slowly on my test server.  When I
test my code on my local development server (which is talking to a remote
database), my 'queryForList' method takes a total of about 2.5 seconds.
 When I push the code out to my test server (more powerful hardware, etc.),
the method takes 10 or 11 seconds.  So, I'm trying to figure out if the
extra time is occurring on the database server or on the application server.

So, I turned up all the logging and I looked at what it is spitting out at
me.  Of course, takes a bit longer with logging turned on, but not hugely
so.  I looked at the times of the different statements, and the 'About to
execute SQL' log statement shows up at second 0.  The next line of the log
file is each row of the result set. This is logged in the same 'second' as
the line of the 'About to execute'.  The next 2000 rows in the log are each
of the lines of the result set and it takes 9 or 10 seconds for this to
occur.

My question is, is this an indication of the database slowly returning the
data, or does iBatis really get all of the data back to the application
server by the time that first result set record is logged and it really is
taking iBatis 10 seconds to go through data on my review server that takes 2
seconds to go through on my dev server.

This is a 'hierarchical' query (if that makes sense).  The data is in the
form of product information and product attribute information.  I am using
the iBatis 'groupBy' clause in the resultMap to tell iBatis which columns
constitute the objects lower down on the hierarchy.  Does it makes sense
that iBatis would take this long to process the data?  Should I look at
writing a RowHandler to process this data?

Thanks in advance for any comments/help,
Chris

Re: Looks like iBatis is processing data slowly...

Posted by Nicholoz Koka Kiknadze <ki...@gmail.com>.
Well, let DBA optimize query, but from the iBatis side maybe it makes sense
to increase fetchSize. See e.g.

http://markmail.org/message/3vy7p455yr5qkzbk#query:ibatis%20fetchsize+page:1+mid:tgs7lyqlyetn2jfv+state:results

On Wed, Apr 29, 2009 at 2:01 AM, Chris O'Connell <
oconnell@gorillachicago.com> wrote:

> Thanks for the response.  I finally got the DBA involved and it looks like
> the query was executing very slowly on the server.  I don't understand
> everything that goes on in the communication between the driver and the
> database, but it looks like I was seeing those first results coming back
> because the database was sending the data over as it got it.  Since the
> query takes 11 seconds to execute, it took 11 seconds for the last row to
> get sent over.
> Chris
>
>
> On Tue, Apr 28, 2009 at 4:55 PM, Nathan Maves <na...@gmail.com>wrote:
>
>> Are the queries being run against the same database?
>> Are the connection pools set up the same on both servers?
>>
>> Is your test(slower) server located somewhere else geographically?
>>
>> Maybe just provide us with a bit more data.
>>
>>
>> On Mon, Apr 27, 2009 at 1:26 PM, Chris O'Connell <
>> oconnell@gorillachicago.com> wrote:
>>
>>> I know that if I were to get a DBA involved, I could get some further
>>> details, but I'm trying to get as much information as I can before I start
>>> to get the bureaucracy involved...
>>> Anyway, I am able to log my sql and the results with no problems.  The
>>> issue I have is that stuff is just running so slowly on my test server.
>>>  When I test my code on my local development server (which is talking to a
>>> remote database), my 'queryForList' method takes a total of about 2.5
>>> seconds.  When I push the code out to my test server (more powerful
>>> hardware, etc.), the method takes 10 or 11 seconds.  So, I'm trying to
>>> figure out if the extra time is occurring on the database server or on the
>>> application server.
>>>
>>> So, I turned up all the logging and I looked at what it is spitting out
>>> at me.  Of course, takes a bit longer with logging turned on, but not hugely
>>> so.  I looked at the times of the different statements, and the 'About to
>>> execute SQL' log statement shows up at second 0.  The next line of the log
>>> file is each row of the result set. This is logged in the same 'second' as
>>> the line of the 'About to execute'.  The next 2000 rows in the log are each
>>> of the lines of the result set and it takes 9 or 10 seconds for this to
>>> occur.
>>>
>>> My question is, is this an indication of the database slowly returning
>>> the data, or does iBatis really get all of the data back to the application
>>> server by the time that first result set record is logged and it really is
>>> taking iBatis 10 seconds to go through data on my review server that takes 2
>>> seconds to go through on my dev server.
>>>
>>> This is a 'hierarchical' query (if that makes sense).  The data is in the
>>> form of product information and product attribute information.  I am using
>>> the iBatis 'groupBy' clause in the resultMap to tell iBatis which columns
>>> constitute the objects lower down on the hierarchy.  Does it makes sense
>>> that iBatis would take this long to process the data?  Should I look at
>>> writing a RowHandler to process this data?
>>>
>>> Thanks in advance for any comments/help,
>>> Chris
>>>
>>
>>
>
>
> --
> --
> Chris O'Connell
> Application Developer
> Gorilla
> 312.243.8777 x19
>
>

Re: Looks like iBatis is processing data slowly...

Posted by Chris O'Connell <oc...@gorillachicago.com>.
Thanks for the response.  I finally got the DBA involved and it looks like
the query was executing very slowly on the server.  I don't understand
everything that goes on in the communication between the driver and the
database, but it looks like I was seeing those first results coming back
because the database was sending the data over as it got it.  Since the
query takes 11 seconds to execute, it took 11 seconds for the last row to
get sent over.
Chris

On Tue, Apr 28, 2009 at 4:55 PM, Nathan Maves <na...@gmail.com>wrote:

> Are the queries being run against the same database?
> Are the connection pools set up the same on both servers?
>
> Is your test(slower) server located somewhere else geographically?
>
> Maybe just provide us with a bit more data.
>
>
> On Mon, Apr 27, 2009 at 1:26 PM, Chris O'Connell <
> oconnell@gorillachicago.com> wrote:
>
>> I know that if I were to get a DBA involved, I could get some further
>> details, but I'm trying to get as much information as I can before I start
>> to get the bureaucracy involved...
>> Anyway, I am able to log my sql and the results with no problems.  The
>> issue I have is that stuff is just running so slowly on my test server.
>>  When I test my code on my local development server (which is talking to a
>> remote database), my 'queryForList' method takes a total of about 2.5
>> seconds.  When I push the code out to my test server (more powerful
>> hardware, etc.), the method takes 10 or 11 seconds.  So, I'm trying to
>> figure out if the extra time is occurring on the database server or on the
>> application server.
>>
>> So, I turned up all the logging and I looked at what it is spitting out at
>> me.  Of course, takes a bit longer with logging turned on, but not hugely
>> so.  I looked at the times of the different statements, and the 'About to
>> execute SQL' log statement shows up at second 0.  The next line of the log
>> file is each row of the result set. This is logged in the same 'second' as
>> the line of the 'About to execute'.  The next 2000 rows in the log are each
>> of the lines of the result set and it takes 9 or 10 seconds for this to
>> occur.
>>
>> My question is, is this an indication of the database slowly returning the
>> data, or does iBatis really get all of the data back to the application
>> server by the time that first result set record is logged and it really is
>> taking iBatis 10 seconds to go through data on my review server that takes 2
>> seconds to go through on my dev server.
>>
>> This is a 'hierarchical' query (if that makes sense).  The data is in the
>> form of product information and product attribute information.  I am using
>> the iBatis 'groupBy' clause in the resultMap to tell iBatis which columns
>> constitute the objects lower down on the hierarchy.  Does it makes sense
>> that iBatis would take this long to process the data?  Should I look at
>> writing a RowHandler to process this data?
>>
>> Thanks in advance for any comments/help,
>> Chris
>>
>
>


-- 
-- 
Chris O'Connell
Application Developer
Gorilla
312.243.8777 x19

Re: Looks like iBatis is processing data slowly...

Posted by Nathan Maves <na...@gmail.com>.
Are the queries being run against the same database?
Are the connection pools set up the same on both servers?

Is your test(slower) server located somewhere else geographically?

Maybe just provide us with a bit more data.

On Mon, Apr 27, 2009 at 1:26 PM, Chris O'Connell <
oconnell@gorillachicago.com> wrote:

> I know that if I were to get a DBA involved, I could get some further
> details, but I'm trying to get as much information as I can before I start
> to get the bureaucracy involved...
> Anyway, I am able to log my sql and the results with no problems.  The
> issue I have is that stuff is just running so slowly on my test server.
>  When I test my code on my local development server (which is talking to a
> remote database), my 'queryForList' method takes a total of about 2.5
> seconds.  When I push the code out to my test server (more powerful
> hardware, etc.), the method takes 10 or 11 seconds.  So, I'm trying to
> figure out if the extra time is occurring on the database server or on the
> application server.
>
> So, I turned up all the logging and I looked at what it is spitting out at
> me.  Of course, takes a bit longer with logging turned on, but not hugely
> so.  I looked at the times of the different statements, and the 'About to
> execute SQL' log statement shows up at second 0.  The next line of the log
> file is each row of the result set. This is logged in the same 'second' as
> the line of the 'About to execute'.  The next 2000 rows in the log are each
> of the lines of the result set and it takes 9 or 10 seconds for this to
> occur.
>
> My question is, is this an indication of the database slowly returning the
> data, or does iBatis really get all of the data back to the application
> server by the time that first result set record is logged and it really is
> taking iBatis 10 seconds to go through data on my review server that takes 2
> seconds to go through on my dev server.
>
> This is a 'hierarchical' query (if that makes sense).  The data is in the
> form of product information and product attribute information.  I am using
> the iBatis 'groupBy' clause in the resultMap to tell iBatis which columns
> constitute the objects lower down on the hierarchy.  Does it makes sense
> that iBatis would take this long to process the data?  Should I look at
> writing a RowHandler to process this data?
>
> Thanks in advance for any comments/help,
> Chris
>