Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MyBatis very slow
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
maelstrom3  
View profile  
 More options Oct 25 2012, 12:55 pm
From: maelstrom3 <rookiehyd-...@yahoo.co.in>
Date: Thu, 25 Oct 2012 09:55:14 -0700 (PDT)
Local: Thurs, Oct 25 2012 12:55 pm
Subject: MyBatis very slow
I'm wondering why MyBatis is slow in my application.

For a SELECT COUNT(*), the time taken is:

    20 secs - first request
    2-3 secs - subsequent requests

Caching, most likely, is making the subsequent requests faster.

Configuration

-    3-tier (WPF UI - Java Backend - Oracle Database)
-    JBoss Server exposes the Java Backed as a Web-Service for the WPF UI
-    Request time == time taken between when the WPF UI sends and receives
the result

Approaches tried

 1.   *Disabled logging*

    I don't know if disabling both the logging subsystem and log4j makes a
difference; but, the best I got was 15 secs for the SELECT COUNT(*).

2.    *Disabled Caching and Lazy loading*

    This too probably made a 5 sec difference at most.

Do the following help?

1.    Using explicit* result mapping*, by turning off auto-mapping. (See
Result Maps here).
2.   Using *Pooling*. (See environments here).

I gathered these techniques from:  here.
<http://mybatis-user.963551.n3.nabble.com/myBatis-is-slow-td2236249.html>  

Another example

For a nested SQL statement with 2 joins and 1 sub-query, the time taken is:

    60-90 secs - first request
    2-3 secs - subsequent requests

--
View this message in context: http://mybatis-user.963551.n3.nabble.com/MyBatis-very-slow-tp4025893....
Sent from the mybatis-user mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry Meadors  
View profile  
 More options Oct 26 2012, 7:30 am
From: Larry Meadors <larry.mead...@gmail.com>
Date: Fri, 26 Oct 2012 05:29:55 -0600
Local: Fri, Oct 26 2012 7:29 am
Subject: Re: MyBatis very slow
Is this a joke?

There is nowhere near enough context for anyone to help you in a
material way here.

You have a TON of moving parts here and any one of them could be the bottleneck:
 - UI
 - who knows what
 - web service
 - who knows what
 - mybatis
 - who knows what
 - database

Isolate this to a unit test that demonstrates that the issue is
mybatis and try again.

Larry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Lyons  
View profile  
 More options Oct 26 2012, 10:18 am
From: Daniel Lyons <fus...@storytotell.org>
Date: Fri, 26 Oct 2012 07:18:47 -0700 (PDT)
Local: Fri, Oct 26 2012 10:18 am
Subject: Re: MyBatis very slow

I strongly suspect all your issues are in the database layer, not myBatis.
The database itself is probably making subsequent requests faster with its
own caching; the OS also caches requests for disk blocks, which can speed
up subsequent queries. Complaints about SELECT COUNT(*) are pretty common
among people switching to Postgres from MySQL--if that's your use-case,
there are specific things you can do to ameliorate the problem, such as
tracking the count yourself somewhere, better indexing or using the query
planner's guess instead of the actual count.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
maelstrom3  
View profile  
 More options Nov 15 2012, 11:20 am
From: maelstrom3 <rookiehyd-...@yahoo.co.in>
Date: Thu, 15 Nov 2012 08:03:21 -0800 (PST)
Local: Thurs, Nov 15 2012 11:03 am
Subject: Re: MyBatis very slow
I got the problems solved! /MyBatis/ now takes the same time to query as
running directly against the database.

It was the *N+1 selects problem* (nicely described  here
<http://www.mybatis.org/core/sqlmap-xml.html#Result_Maps>  ).

Solution

*Nested Results* (as opposed to *Nested Select*), which is also described on
the same page mentioned above.

The difference it made to my SQL query with 4 joins was enormous:

    *Before:* 38 s
    *After:* 3 s

I tracked the problem down by isolating it to a *JUnit test-case* around
/MyBatis-Spring/ (removing the /JBoss/ part).

I had inherited the code-base from someone and was totally new to MyBatis,
Spring and JBoss. Took me a lot of time to solve it.  Thanks Larry for that
JUnit tip!

--
View this message in context: http://mybatis-user.963551.n3.nabble.com/MyBatis-very-slow-tp4025893p...
Sent from the mybatis-user mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »