uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <richard.eck...@gmail.com>
Subject Re: Running Uima in Tomcat (memory issue)
Date Wed, 17 Jul 2013 10:03:23 GMT
Am 17.07.2013 um 10:19 schrieb swirl <swirlobt@yahoo.com>:

> Richard Eckart de Castilho <richard.eckart@...> writes:
> 
>> 
>> Am 17.07.2013 um 05:11 schrieb swirl <swirlobt@...>:
>> 
>>> I am wrapping a Uima analysis engine in a Tomcat JSF webapp.
>>> 
>>> This AE loads and parses a large model file (300Mb).
>>> 
>>> I can call the AE and run it using SimplePipeline.runPipeline() via the 
>>> webapp UI.
>>> 
>>> However, the large model took up a large memory chunk that won't go away even

>>> after the AE is run to completion. 
>>> 
>>> Does Uima do any clean up of in-memory object instances after the AE is 
>>> completed?
> 
>> In a webapp context, to avoid long initialization times, I would
>> recommend creating an instance of the AnalysisEngine and keep it
>> around. Use some queuing to make sure it never used by more than
>> one request at a time. UIMA AEs are not really thread safe.  
>> No worries about garbage collection here, because the AE will
>> live as long as your application is running.
>> 
> 
> Thanks Richard for your quick and informative response.
> 
> You mentioned keeping around a instance of the AE, sorry for the noob 
> question but what is the method you propose? 
> 
> This? http://stackoverflow.com/questions/5668820/sharing-a-class-instance-
> between-all-users-with-tomcat 

There are many ways to do that I suppose. Since I usually build my applications
with Spring, I'd just turn the AE into a Spring bean. You can store it in the
Tomcat application context. You could also just apply the singleton pattern.

Whatever works best for you.

Cheers,

-- Richard


Mime
View raw message