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 22C73200C77 for ; Mon, 1 May 2017 13:11:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 214AE160BAE; Mon, 1 May 2017 11:11:09 +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 41B92160BAB for ; Mon, 1 May 2017 13:11:08 +0200 (CEST) Received: (qmail 28985 invoked by uid 500); 1 May 2017 11:11:02 -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 28974 invoked by uid 99); 1 May 2017 11:11:02 -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 11:11:02 +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 BA2F71A01B2 for ; Mon, 1 May 2017 11:11:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.046 X-Spam-Level: X-Spam-Status: No, score=-1.046 tagged_above=-999 required=6.31 tests=[KAM_INFOUSMEBIZ=0.75, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id EPllnOAAKK1B for ; Mon, 1 May 2017 11:10:58 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 1D7905F3BC for ; Mon, 1 May 2017 11:10:58 +0000 (UTC) Received: from [192.168.0.24] ([46.223.1.72]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.183]) with ESMTPSA (Nemesis) id 0Lc873-1dlw5f31mP-00jYa8 for ; Mon, 01 May 2017 13:10:50 +0200 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: =?UTF-8?Q?Peter_Kl=c3=bcgl?= Message-ID: Date: Mon, 1 May 2017 13:10:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; 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-Provags-ID: V03:K0:F1o3oOpzEnM0UYufSyaEkuUkMXc/Lfus72IUGmSgiZmnYsWkynU lmzdzKyiborWCc6Y1WsNekaBVhESrpnjWgdISjj8rt4+ZMAz5L7XjeoOVMZB+tPPESuEauw aw3gbh+IIO6qKN1XT+NGZLmRmoAL+dAmJpebL+rPwfL3R9qDRmkBH3TC47pAKqxVvOHpYXa Lv862892ypUqnCCtIuLLQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:GwlvZFzKzm4=:Vnu3CpvHLCpamMQJTLNmtZ GQjckI0SsziUx/FcWh6oiSzyn5uTeBlIFT0Hoi9Eha9Z5wZLPj1xl2EMMSgCzDO8gUtagF99s ViT9wtqCcYUTCtpB/hN5uVUTutGEJZTWJjVr24Ps6unC009X2PvLLyz0FsTo7vPK3jh7A321z gjEgXjY+qJY0bXunr5qvp1UhwtSxh+PaQpJmbGA7jwqb2OQn9X53nteXZcHMiYxyzuI+Fvw1I gWtHC84RVNWYa+xNqd6viftNpVNmlyQxTXGvBvut3Jgsvpj9b1hc5syPeBCzSmTyN14rqnXFb Fabf3Ux92C+cGmY7tjfz93a4Qw0Uih2vdSKOhRPdWcffvbIHLvx1MARLPM360vKb8APC+AwHo yVhIzWbNUqYQFCYCT6cDQ+4a1/sJSKRxn1iDrL3d3KjE8Pyax+QcT/EG1TlMUNvLc9cwOP1TN pfd6IFzUoDKY8QLOtxeMVZLVJFNyo7OE8duKNCW8pUKKpR7FXg6xXzAyE58rxwHbaCP5i9sqi auKavslfF0+NKv4TZplkXtGj/KkzvnBdLeYPQCEAh7OBxkUoWr4YImutL+LbD6Ztkm7ypWDKk zO5+SGrw15ddLGmNJUuKu/TqGrUNertgCGZGhk2A9TxO/7haQF6XYczNT6zFOxhmWyd5b89Sz X52t0AEjTOwU1/kxSBvPiWQc3cfL9FxeAUqQbzm9JAUhlX+ZpqeCY7pln2eZKyoL1JsZjE89+ ToOxJ93L0E4b4Bd/ archived-at: Mon, 01 May 2017 11:11:09 -0000 Hi, Am 30.04.2017 um 22:15 schrieb Hugues de Mazancourt: > 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. Thanks for the ticket. I haven't checked the implementation yet but it looks as much like a bug as it is possible. The rule looks simple, but the problem is quite complicated as you could replace both rule elements after the wildcard with arbitrary complex composed rule elements. I have to check what exactly went wrong there. > > 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. I can't say something about the FsIndexRepository but the limitation within ruta will be included soon. > Best, > > — Hugues > > > PS: appart from occasional problems, Ruta is a great platform for information extraction. I love it! Thanks :-) especially for reporting the problem which greatly helps to improve ruta Best, Peter > >> 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 >>> >>> >>> >>> >>>