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 6A2112009C5 for ; Mon, 16 May 2016 15:41:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 68BA9160A16; Mon, 16 May 2016 13:41:14 +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 B1380160131 for ; Mon, 16 May 2016 15:41:13 +0200 (CEST) Received: (qmail 68741 invoked by uid 500); 16 May 2016 13:41:12 -0000 Mailing-List: contact issues-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 issues@ignite.apache.org Received: (qmail 68726 invoked by uid 99); 16 May 2016 13:41:12 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 May 2016 13:41:12 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C9F512C14F8 for ; Mon, 16 May 2016 13:41:12 +0000 (UTC) Date: Mon, 16 May 2016 13:41:12 +0000 (UTC) From: "Artem Shutak (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (IGNITE-2921) ScanQueries over local partitions are not optimal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 16 May 2016 13:41:14 -0000 [ https://issues.apache.org/jira/browse/IGNITE-2921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Artem Shutak closed IGNITE-2921. -------------------------------- > ScanQueries over local partitions are not optimal > ------------------------------------------------- > > Key: IGNITE-2921 > URL: https://issues.apache.org/jira/browse/IGNITE-2921 > Project: Ignite > Issue Type: Bug > Components: cache > Affects Versions: 1.5.0.final > Reporter: Denis Magda > Assignee: Artem Shutak > Priority: Blocker > Labels: community, important, performance > Fix For: 1.6 > > Attachments: LocalIteratorStuff.java, ScanQueryStuff.java > > > Presently scan queries over local partitions are not executed optimally. > If to run a scan query over a specific partition (by setting {{query.setPartition(...)}} parameter and or {{query.setLocal(true)}}) and start iterating over entries we will see that the Thread, that iterates over the data, waits for some event to happen. > In fact the Thread waits while a system pool's thread prepares an iterator with entries for it and only after that iterates over the returned result set. The flow looks this way: > - {{GridCacheLocalQueryFuture}} is created; > - when {{QueryCursor.iterator().next}} is called from the app thread (the Thread above), {{GridCacheLocalQueryFuture.execute()}} methods puts closure that will prepare content for the iterator in the system pool. > - a system Thread execute {{GridCacheQueryManager.runQuery()}} reading all the entries from partition and passing them back to the Thread at line 1553 by calling {{onPageReady(...)}} method. > The other bottleneck is that a system thread gets all the entries and passes them to the Thread which will lead to more garbaged Java heap especially if cache is {{OFFHEAP_TIRED}}. > Run attached test ({{ScanQueryStuff}}) and you will see with Visual VM that most of the time the test spends executing the code from system threads. > Finally, what have to be done: > - if ScanQuery is supposed to be executed locally (setPartition() refers to local partition or setLocal is set to true) then the calling application thread has to iterate over the data avoiding usage of the system pool; > - internal code mustn't read all entries from a partition initially. The iterator has to get one entry next after another. This will be a memory backpressure mechanism especially for {{OFFHEAP_TIRED}}. > My assumption is that the fixed version has to work in a similar way to iteration over local entries - {{cache.localEntries(CachePeekMode.PRIMARY);}}. Run attached {{LocalIteratorStuff}} to see with Visual VM that the application thread is fully utilized and system threads are idle. -- This message was sent by Atlassian JIRA (v6.3.4#6332)