Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B7404200C77 for ; Mon, 1 May 2017 15:45:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B5BE9160BAE; Mon, 1 May 2017 13:45:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D81D1160BAB for ; Mon, 1 May 2017 15:45:31 +0200 (CEST) Received: (qmail 28324 invoked by uid 500); 1 May 2017 13:45:31 -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 28313 invoked by uid 99); 1 May 2017 13:45:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2017 13:45:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 6074B1B13CA for ; Mon, 1 May 2017 13:45:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.749 X-Spam-Level: X-Spam-Status: No, score=0.749 tagged_above=-999 required=6.31 tests=[KAM_INFOUSMEBIZ=0.75, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id K5YFDR_HU5s8 for ; Mon, 1 May 2017 13:45:28 +0000 (UTC) Received: from gateway31.websitewelcome.com (gateway31.websitewelcome.com [192.185.143.39]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 49AC15FCE3 for ; Mon, 1 May 2017 13:45:28 +0000 (UTC) Received: from cm1.websitewelcome.com (cm.websitewelcome.com [192.185.0.102]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 00B5A1BAEC for ; Mon, 1 May 2017 08:45:22 -0500 (CDT) Received: from gator3253.hostgator.com ([198.57.247.217]) by cm1.websitewelcome.com with id F1gK1v00B4i9tuE011gLWk; Mon, 01 May 2017 08:40:20 -0500 Received: from ool-4a5a0cb8.dyn.optonline.net ([74.90.12.184]:57778 helo=[192.168.1.217]) by gator3253.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1d5BYp-0007JX-1V for user@uima.apache.org; Mon, 01 May 2017 08:40:19 -0500 Subject: Re: Limiting the memory used by an annotator ? To: user@uima.apache.org References: <6161BFD5-2973-4A36-BBA9-7B567F2B4E07@mazancourt.com> <928a39c8-d3b8-c0f3-a798-8eb20fc74fbf@averbis.com> <12CDDB49-F18C-41FF-81AE-045E40CE8303@mazancourt.com> From: Marshall Schor Message-ID: Date: Mon, 1 May 2017 09:40:27 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <12CDDB49-F18C-41FF-81AE-045E40CE8303@mazancourt.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3253.hostgator.com X-AntiAbuse: Original Domain - uima.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - schor.com X-BWhitelist: no X-Source-IP: 74.90.12.184 X-Exim-ID: 1d5BYp-0007JX-1V X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ool-4a5a0cb8.dyn.optonline.net ([192.168.1.217]) [74.90.12.184]:57778 X-Source-Auth: msa+schor.com X-Email-Count: 2 X-Source-Cap: bWlzY2hvcjttaXNjaG9yO2dhdG9yMzI1My5ob3N0Z2F0b3IuY29t archived-at: Mon, 01 May 2017 13:45:32 -0000 Hi, I'm not sure that a limited size FsIndexRepository would work, because it only would limit those Feature Structures that were added to the index. Many times, Feature Structures are made which are referenced from other Feature Structures, but are not added to the index. One example is instances of NonEmptyXxxList kinds of objects - these are used to hold items in a list, and typically are not (individually) added to the index, since the normal way to access these is via the head of the list. Even if they are not in the FsIndexRepository indexes, they still take up room in the main storage on the heap for storing Feature Structures. -Marshall On 4/30/2017 4:15 PM, Hugues de Mazancourt wrote: > Thanks to all for your advices. > In my specific case, this was a Ruta problem - Peter, I filed a JIRA issue with a minimal example - which would advocate for the « TooManyMatchesException » feature you propose. I vote for it. > > Of course, I already limit the size of input texts, but this is not enough. > One of the main strengths of UIMA is to be able to integrate annotators produced by third-parties. And each annotator is based on assumptions, at least to have a text as an input, formed by words, etc. Thus, pipelines get more and more complex, without the need to code all processig. But, in a production environment, anything can happen, assumptions may not be respected (e.g. non-textual data can be sent to the engine(s), etc). Sh** always happen in production. > > My case is a more specific one, but I’m sure it can be generalized. > > Thus, any feature that can help limiting the damage of non-expected input would be welcome. And a limited-size FsIndexRepository seems to me a simple yet powerful enough solution to many problems. > > Best, > > — Hugues > > > PS: appart from occasional problems, Ruta is a great platform for information extraction. I love it! > >> Le 30 avr. 2017 à 12:57, Peter Klügl a écrit : >> >> Hi, >> >> >> here are some ruta-specific comments additionally to Thilo and Marshall's answers. >> >> - if you do not want to split the CAS in smaller ones, you can also sometimes apply the rules just on some parts of the document (-> less annotations/rule matches created) >> >> - there is an discussion related to this topic (about memory usage in ruta): https://issues.apache.org/jira/browse/UIMA-5306 >> >> - I can include configuration parameters which limit the allowed amount of rule matches and rule element matches of one rule/rule element. If a rule or rule element exceeds it, a new runtime exception is thrown. I'll open a jira ticket for that. This is not a solution for the problem in my opinion, but it can help to identify and fix the problematic rules. >> >> - I do not want to include code to directly restrict the max memory in ruta. That should rather happen in the framework or in the code that calls/applies the ruta analysis engine. >> >> - I think there is a problem in ruta and there are several aspects that need to be considered here: the actual rules, the partitioning with RutaBasic, flaws in the implementation and the configuration parameters of the analysis engine >> >> - Are the rules inefficient (combinatory explosion)? I see ruta more and more as a programming language for faster creating maintainable analysis engines. You can write efficient and ineffiecient code. If the code/rules are too slow or take too long, you should refactor it and replace them with a more efficient approach. Something like ANY+ is a good indicator that the rules are not optimal, you should only match on things if you have to. There is also profiling functionality in the Ruta Workbench which shows you how long which rule took and how long specific conditions/action took. Well, this is information about the speed but not about the memory, but many rule matches take longer and require more memory, so it could be an indicator. >> >> - There are two specific aspects how ruta spends its memory: RutaBasic and RuleMatches. RutaBasic stores additional information which speeds up the rule inference and enables specific functionality. The rule matches are needed to remember where something matched, for the conditions and actions. You can reduce the memory usage by reducing the amount of RutaBasic annotations, the amount of the annotations indexed in the RutaBasic annotations, or by reducing the amount of RuleMatches -> refactoring the rules. >> >> - There are plans to make the implementation of RutaBasic more efficient, by using more efficient data structures (there are some prototypes mentioned in the issue linked above). And I added some new configuration parameters (in ruta 2.6.0 I think) which control which information is stored in RutaBasic, e.g, you do not need information about annotations if they or their types are not used in the rules. >> >> - I think there is a flaw in the implementation which causes your problem, and which can be fixed. I'll investigate it when I find the time. If you can provide some minimal (synthetic) example for reproducing it, that would be great. >> >> - There is the configuration parameter lowMemoryProfile for reducing the stuff stored in RutaBasic which reduces the memory usage but makes the rules run slower. >> >> >> Best, >> >> >> Peter >> >> >> >> Am 29.04.2017 um 12:53 schrieb Hugues de Mazancourt: >>> Hello UIMA users, >>> >>> I’m currently putting a Ruta-based system in production and I sometimes run out of memory. >>> This is usually caused by combinatory explosion in Ruta rules. These rules are not necessary faulty: they are adapted to the documents I expect to parse. But as this is an open system, people can upload whatever they want and the parser crashes by multiplying annotations (or at least takes 20 minutes in garbage-collecting millions of annotations). >>> >>> Thus, my question is: is there a way to limit the memory used by an annotator, or to limit the number of annotations made by an annotator, or to limit the number of matches made by Ruta ? >>> I prefer cancelling a parse for a given document than a 20 minutes downtime of the whole system. >>> >>> Several UIMA-based services run in production, I guess that others certainly have hit the same problem. >>> >>> Any hint on that topic would be very helpful. >>> >>> Thanks, >>> >>> Hugues de Mazancourt >>> http://about.me/mazancourt >>> >>> >>> >>> >>> >