Hi Kai,
Thanks a ton for the reply. Yes we already have the singleton pattern
implementation for our sqlmap client :-((.
Any other ideas are most welcome.
Regards,
Ankur
Kai Grabfelder-3 wrote:
>
> So are you already using a singleton pattern for the sqlmap client? Or do
> you have nothing in common with the
> setup described in the cited text below?
>
> Best Regards
>
> Kai
>
>
> --- Original Nachricht ---
> Absender: ankurgur
> Datum: 12.06.2009 12:58
>> Hi there,
>>
>> I am in dire need of help regarding Memory leak problem i am facing in my
>> application.
>> After analysis it seems there is some problem with the way we are using
>> iBATIS in our application.
>> Actually we are uploading huge amount of data (around 50k) into DB
>> through
>> our application using transaction management and batch insertion and
>> updation facility provided by iBATIS.
>>
>> Our deployment environment has the max JVM heap as 458Mb available for
>> use.
>> After our application reaches to say around 30k records the performance
>> starts degrading with heap utilization getting to a very high limit.
>> Sometimes it starts throwing OutOfMemoryException and the system goes
>> down.
>>
>> The heap analyzing team came up with this Comment
>>
>> "Looks like, the memory leak is coming from iBatis objects being stored
>> inside the
>> com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread."
>>
>> Can anybody please help in what general precautions we can take to avoid
>> this situation created by our iBATIS implementation.
>>
>> pooven wrote:
>>>
>>> Jeff,
>>>
>>> Thanks for your reply. Really what you have replied is very helpful.
>>>
>>> Here with I have attached my code as well as the some screeen shots of
>>> the
>>> heap analyser.
>>>
>>> In our code each action class we called the
>>>
>>> Reader reader = Resources.getResourceAsReader("abatorConfig.xml");
>>> sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
>>>
>>> This is blender mistake I believe.
>>>
>>> Kindly correct me the following set of code to call the above set of
>>> code
>>> with use of singleton pattern.
>>>
>>> In all the 183 action classes the code is same , now only I realized the
>>> problem. For simultaneous access of reports from different users is it
>>> correct to have the following code to call the
>>> SqlMapClientBuilder.buildSqlMapClient(reader); each time
>>>
>>>
>>> public class SqlMapClientBuilderSingleton{
>>> private static final SqlMapClient sqlMap;
>>> static {
>>> try {
>>> Reader reader =
>>> Resources.getResourceAsReader("abatorConfig.xml");
>>> sqlMap =
>>> SqlMapClientBuilder.buildSqlMapClient(reader);
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> throw new RuntimeException ("SqlMap initialisation
>>> Error: " + e);
>>> }
>>> }
>>> public static SqlMapClient getSqlMapInstance () {
>>> return sqlMap;
>>> }
>>>
>>> }
>>>
>>> SqlMapClientBuilderSingleton
>>>
>>> Then when I need it in the code I can use this way
>>>
>>> SqlMapClient
>>> sqlMapper=SqlMapClientBuilderSingleton.getSqlMapInstance ();
>>>
>>>
>>>
>>> Is the above said way is right ? if you have any correction in the above
>>> code pls let me know , we are not using the spring FrameWork hence pls
>>> advise me he best way to call the SqlMapClient each time in the action.
>>> do we need to call the sqlMapper.flushDataCache() wherever is necessary
>>> for flushing the dataCache , where would be the closing all would be
>>> done.
>>>
>>> I am not able to find any easy examples of how to go about with the
>>> iBatis.
>>>
>>>
>>> Thanks for your efforts and time.
>>>
>>> Thanks once again
>>>
>>> Poovendran
>>>
>>>
>>>
>>> Jeff Butler-2 wrote:
>>>>
>>>> I just took a closer look at this. What you are showing is the object
>>>> tree
>>>> related to the SqlMapClient - which is very large in your case. That
>>>> probably means you have a lot of mapped statements (perhaps 8208 of
>>>> them).
>>>> That should be ok - because this object tree should only occur one time
>>>> and
>>>> should not change once it is built.
>>>>
>>>> Are you seeing that this tree is built and destroyed over and over
>>>> again?
>>>> Or are there multiple instances of this tree? This is a common misuse
>>>> of
>>>> iBATIS. You should build the SqlMapClient one and only one time. You
>>>> should keep it for the life of the application somewhere (like a
>>>> singleton,
>>>> or let Spring build it and hold onto it).
>>>>
>>>> Jeff Butler
>>>>
>>>>
>>>>
>>>> On Dec 4, 2007 8:55 PM, Jeff Butler <[email protected]> wrote:
>>>>
>>>>> Interesting. The char[] are inside Strings, which are inside
>>>>> HashMaps,
>>>>> which appear to be inside the parameters you are passing to iBATIS.
>>>>> It
>>>>> appears that you have some large HashMaps being passed into iBATIS. I
>>>>> submit that this is not an iBATIS problem but a problem in the way you
>>>>> are
>>>>> USING iBATIS.
>>>>>
>>>>> Make sure that you are not holding onto these large HashMaps you are
>>>>> using
>>>>> as parameters - it would be very interesting to see higher in the
>>>>> HeapAnalyser than what you've shown - where in your code are these
>>>>> HashMaps
>>>>> being created?
>>>>>
>>>>> Jeff Butler
>>>>>
>>>>>
>>>>>
>>>>> On Dec 4, 2007 8:38 PM, pooven <[email protected]> wrote:
>>>>>
>>>>> >
>>>>> > Hi,
>>>>> >
>>>>> > Here with I am attaching the screen shot of the Heapdump analyser
>>>>> which
>>>>> > shows clearly the break up where in which package of the iBatis
>>>>> class
>>>>> > causing the memory leak.
>>>>> >
>>>>> > Kindly if any one knows how to get rid of this issue , greatly
>>>>> > appreciated.
>>>>> > Thanks and regds,
>>>>> > Poovendran
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > pns77 wrote:
>>>>> > >
>>>>> > > I am also facing a similar issue with ibatis - we arrived at the
>>>>> > > conclusion after an analysis of heap dump. The following was the
>>>>> > response
>>>>> > > that we got for a ticket we had raised with IBM.
>>>>> > >
>>>>> > > " ..Maximum heap was set to 1024m and almost 1000mb of heap is in
>>>>> use.
>>>>> > > Anlaysis of the heapdump shows the com/ibatis/sqlmap/engine/* code
>>>>> > > occupying most of heap(Nearly 900mb). .."
>>>>> > >
>>>>> > > There seems to be too many char[] (character array) objects that
>>>>> get
>>>>> > > created from com.iBatis.sqlmap.engine.impl.SqlMapClientImpl class.
>>>>> In
>>>>> > our
>>>>> > > application side we had explcitly set the "daoManager" object
>>>>> > reference to
>>>>> > > null so that it could be GC'ed. Still, we dont see any
>>>>> improvement.
>>>>> > >
>>>>> > > Would apprecitate if some one could suggest a solution.
>>>>> > >
>>>>> > > We use WebSphere 6 on AIX / ibatis accessing DB2 database.
>>>>> > >
>>>>> > > Thanks,
>>>>> > > P.N.Subramanian
>>>>> > >
>>>>> > >
>>>>> > > pooven wrote:
>>>>> > >>
>>>>> > >> We are using a iBatis 2.3.677 along with CrystalReport
>>>>> 11.8,Websphere
>>>>> > >> AppServer 6.0.23 and DB2 8.2 and Websphere Portal Server 5.1.0.4,
>>>>> in
>>>>> > our
>>>>> > >> struts based portlet application.
>>>>> > >>
>>>>> > >> There are 183 reports we are using.
>>>>> > >>
>>>>> > >> We are facing the outOfMemory issue. After analysing the heapDump
>>>>> > file
>>>>> > >> through the IBM HeapAnalyser we came to know that there is a
>>>>> memory
>>>>> > >> leakage around 8 MB in the
>>>>> > >>
>>>>> > >> com.iBatis.sqlmap.engine.impl.SqlMapClientImpl class,
>>>>> > >>
>>>>> > >> I called flushDataCache from the sqlMapper , still it is of no
>>>>> use.
>>>>> > >>
>>>>> > >> Can any one guide me in this regard.
>>>>> > >>
>>>>> > >>
>>>>> > >> Thanks,
>>>>> > >> P.Poovendran
>>>>> > >>
>>>>> > >
>>>>> > >
>>>>> > http://www.nabble.com/file/p14164086/iBatis%2BMemory%2BLeak.bmp
>>>>> > iBatis+Memory+Leak.bmp
>>>>> > --
>>>>> > View this message in context:
>>>>> >
>>>>> http://www.nabble.com/Memeory-leak-in-com.iBatis.sqlmap.engine.impl.SqlMapClientImpl-class-tf4928332.html#a14164086
>>>>> > Sent from the iBATIS - User - Java mailing list archive at
>>>>> Nabble.com<http://nabble.com/>
>>>>> > .
>>>>> >
>>>>> >
>>>>>
>>>>
>>>>
>>> http://www.nabble.com/file/p14175337/MemoryLeak.zip MemoryLeak.zip
>>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/Memeory-leak-in-com.iBatis.sqlmap.engine.impl.SqlMapClientImpl-class-tp14105662p24010826.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.