Return-Path: X-Original-To: apmail-ignite-dev-archive@minotaur.apache.org Delivered-To: apmail-ignite-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49DCD18A41 for ; Fri, 12 Feb 2016 16:47:19 +0000 (UTC) Received: (qmail 60263 invoked by uid 500); 12 Feb 2016 16:47:19 -0000 Delivered-To: apmail-ignite-dev-archive@ignite.apache.org Received: (qmail 60227 invoked by uid 500); 12 Feb 2016 16:47:19 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 60198 invoked by uid 99); 12 Feb 2016 16:47:18 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Feb 2016 16:47:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 52823C0C99 for ; Fri, 12 Feb 2016 16:47:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.279 X-Spam-Level: * X-Spam-Status: No, score=1.279 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gridgain-com.20150623.gappssmtp.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id cZTReObY_wm2 for ; Fri, 12 Feb 2016 16:47:16 +0000 (UTC) Received: from mail-vk0-f54.google.com (mail-vk0-f54.google.com [209.85.213.54]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 429A731ADD for ; Fri, 12 Feb 2016 16:47:15 +0000 (UTC) Received: by mail-vk0-f54.google.com with SMTP id c3so64835974vkb.3 for ; Fri, 12 Feb 2016 08:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gridgain-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WQ+VvWTlEDvp71kiOwn9Qilj8AREkjovadZrpP6E0+0=; b=UTz3evYMjrbnu4hvP6NYDsq673pKRIfE0SFn8TCUnwmKUEjCatHS/3NfCmO158kCTX bRiHlH+eAcz7TZiYmYJMUpoWyXgcyTP/tEuo9qvpXDAz95P/dnPl/9gR4A9Ece/ByXIx C5Xm4UoPXiPva2l6P8bkd+mUgeu2JGiL4PVIgXNGScp3znRk0dI5jZvXa1kfNqa4MAP6 YCT7WA3cWd4WNA+ZZfmtKuiaMdaJWcLDX76yhTpH+xb+MdXBNm1Sqd8DBfqGhVJhJYd0 N31oOXzavZ3OgTXyCBj+PPaM5iEKZ7VW8yzEmMKuKSWYMl1bUvuCtxILwc9Dfbtvdzwh tF1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=WQ+VvWTlEDvp71kiOwn9Qilj8AREkjovadZrpP6E0+0=; b=AKxkhNZgkuV+c+S3C+bKKXanZyVHsDn/sT+7U62hybPjBGTe6AnNKPkEshDOkkMBYE ZwQqu5JC+FaQgdbg1NT/0OguPXf/+IMdJZMc7Tu/H/s6IFQWMVYety2tFw9yT00s64IC IVn0XIakl46yTNlikjxgZqQcsAFOKHQPCZ2gLTs1f1SbVhgddfgUhoGYZzlhZMlkZRzE huGyCo2lOM5RX++NOaDfkCbglbzA2QFUsg9LYhZqCX9vAIdI3J46JD9jnB14BGl+VbEB OeNeRc2blTtx4/i+IsmIKDUIS//8yU4ZcHwyJnQl5B+rIfj2l77NkkAe8hiM9++MIS6x 9f5Q== X-Gm-Message-State: AG10YOSVMp9eCkeMvYR9L44VfBZXei5CaM0gQjb+Oj2cQquxJqU8KPabwJB66Z7i7v83ZS2SF4ZHEK0ox1XKeFPk MIME-Version: 1.0 X-Received: by 10.31.47.205 with SMTP id v196mr2123728vkv.18.1455295634214; Fri, 12 Feb 2016 08:47:14 -0800 (PST) Received: by 10.159.37.74 with HTTP; Fri, 12 Feb 2016 08:47:14 -0800 (PST) In-Reply-To: References: Date: Fri, 12 Feb 2016 19:47:14 +0300 Message-ID: Subject: Re: IgniteCompute.withAsync can execute tasks synchronously From: Andrey Gura To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a1143920e52923b052b956b7c --001a1143920e52923b052b956b7c Content-Type: text/plain; charset=UTF-8 I've created ticket https://issues.apache.org/jira/browse/IGNITE-2646 On Thu, Feb 11, 2016 at 4:12 PM, Andrey Gura wrote: > Dmitry, > > GridTaskProcessor does't know what kind of IgniteCompute implementation > was used by client code. So we need some kind of flag that will talk to > GridTaskProcessor: "execute task in pool, not in caller thread". > > > On Wed, Feb 10, 2016 at 11:56 PM, Dmitriy Setrakyan > wrote: > >> Andrey, >> >> I think we should keep it simple. From the API standpoint, I am not sure >> why not just always execute the task asynchronously every time when >> withAsync() API is invoked? Why add additional parameters to the API? >> >> D. >> >> On Wed, Feb 10, 2016 at 6:53 AM, Andrey Gura wrote: >> >> > Guys, >> > >> > during debugging of failed test >> > (GridSessionCheckpointSelfTest.testSharedFsCheckpoint) I've noticed that >> > GridTaskWorker can invoke reduce() method in caller thread. >> > >> > If task isn't annotated by @ComputeTaskMapAsync then mapping job will be >> > run in caller thread. Since job mapping will be finished >> > processDelayedResponses() method will be invoked and if delayed >> responses >> > queue isn't empty then caller thread can invoke reduce() method >> eventually >> > and perform reducing synchronously. >> > >> > It can be usefull in case of synchronous execution but, IMHO, it is very >> > strange behavior for asynchronous case because user expects that method >> > will return after creation of task. >> > >> > Similar behavior is possible for all places where code invokes >> > GridTaskProcessor.execute() method (IgniteCompute.broadcast(), >> > IgniteCAche.size(), REST handlers, etc.) >> > >> > I see three options in order to fix the problem: >> > >> > 1. Remove GridTaskWorker.processDelayedResponses() method and all calls. >> > Perhaps, performance can sufer a little bit (but I'm not sure). >> > >> > 2. Add special flag to execute method (e.g. usePool) that will give >> > guarantees that task will not be executed in caller thread. Of course >> this >> > flag should be add for all methods in call chain. >> > >> > 3. Use task process thread context (GridTaskProcessor.thCtx) and special >> > key that will represent requirement about execution task in pool >> similar to >> > usePool flag. >> > >> > In case of 2nd and 3rd options we should analyze every usage of >> > GridTaskProcessor.execute() method and solve should caller thread >> execute >> > task or not. >> > >> > Maybe I missed something and there is better way to solve this problem. >> > >> > I will be grateful for any advice or idea. >> > >> > -- >> > Andrey Gura >> > GridGain Systems, Inc. >> > www.gridgain.com >> > >> > > > > -- > Andrey Gura > GridGain Systems, Inc. > www.gridgain.com > -- Andrey Gura GridGain Systems, Inc. www.gridgain.com --001a1143920e52923b052b956b7c--