Return-Path: X-Original-To: apmail-uima-user-archive@www.apache.org Delivered-To: apmail-uima-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0B79FC3D0 for ; Wed, 17 Jul 2013 10:03:56 +0000 (UTC) Received: (qmail 68658 invoked by uid 500); 17 Jul 2013 10:03:55 -0000 Delivered-To: apmail-uima-user-archive@uima.apache.org Received: (qmail 68290 invoked by uid 500); 17 Jul 2013 10:03:54 -0000 Mailing-List: contact user-help@uima.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@uima.apache.org Delivered-To: mailing list user@uima.apache.org Received: (qmail 68280 invoked by uid 99); 17 Jul 2013 10:03:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 10:03:52 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of richard.eckart@gmail.com designates 209.85.215.169 as permitted sender) Received: from [209.85.215.169] (HELO mail-ea0-f169.google.com) (209.85.215.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 10:03:47 +0000 Received: by mail-ea0-f169.google.com with SMTP id h15so926244eak.14 for ; Wed, 17 Jul 2013 03:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=51PRUF6KCDgOOvaY0lWoDOsh6VJBAT5WjgAq2RKzges=; b=gGHJlkFs+tcwSBHV+1xwquN09CfVC7IwO1MapXk6BS2KKXasbrkd1Z8nGUiH+269eY g/5zkDEqfIv9SRSS+zsCMEyzLpLNpe3cBxgbAJIOU228hnnMDO+iCYRW2uScpXvnTyMd AYApm7X5079UQuF8nPMvUlssOZ0fLXO6S7K516Z0zPJf5Cy7Qb7yCzou31RwrwZtadiv M7Nge//I01IKnOuIu32SrzCe/67PvCY8+GIo0N4gXPvcgPOaXdGXXujQIZHxPx6Dv7Em 5jbMg+xNf8OR095lDokn+1JHphOdV3kJ7/QldxesAOBeJgZv5yqdyzWXa7t0/NO9xD3J zulQ== X-Received: by 10.15.94.142 with SMTP id bb14mr5642938eeb.112.1374055406503; Wed, 17 Jul 2013 03:03:26 -0700 (PDT) Received: from [10.0.1.20] (ip-176-199-182-177.unitymediagroup.de. [176.199.182.177]) by mx.google.com with ESMTPSA id o5sm9545700eef.5.2013.07.17.03.03.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Jul 2013 03:03:25 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: Running Uima in Tomcat (memory issue) From: Richard Eckart de Castilho In-Reply-To: Date: Wed, 17 Jul 2013 12:03:23 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <2DF6EA75-50E6-43D3-A81C-C3F428EEB268@gmail.com> References: To: user@uima.apache.org X-Mailer: Apple Mail (2.1508) X-Virus-Checked: Checked by ClamAV on apache.org Am 17.07.2013 um 10:19 schrieb swirl : > Richard Eckart de Castilho writes: >=20 >>=20 >> Am 17.07.2013 um 05:11 schrieb swirl : >>=20 >>> I am wrapping a Uima analysis engine in a Tomcat JSF webapp. >>>=20 >>> This AE loads and parses a large model file (300Mb). >>>=20 >>> I can call the AE and run it using SimplePipeline.runPipeline() via = the=20 >>> webapp UI. >>>=20 >>> However, the large model took up a large memory chunk that won't go = away even=20 >>> after the AE is run to completion.=20 >>>=20 >>> Does Uima do any clean up of in-memory object instances after the AE = is=20 >>> completed? >=20 >> 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. =20 >> No worries about garbage collection here, because the AE will >> live as long as your application is running. >>=20 >=20 > Thanks Richard for your quick and informative response. >=20 > You mentioned keeping around a instance of the AE, sorry for the noob=20= > question but what is the method you propose?=20 >=20 > This? = http://stackoverflow.com/questions/5668820/sharing-a-class-instance- > between-all-users-with-tomcat=20 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