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 08351200C55 for ; Thu, 13 Apr 2017 19:51:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 036B3160B98; Thu, 13 Apr 2017 17:51:28 +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 241F2160B89 for ; Thu, 13 Apr 2017 19:51:26 +0200 (CEST) Received: (qmail 26052 invoked by uid 500); 13 Apr 2017 17:51:25 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 26039 invoked by uid 99); 13 Apr 2017 17:51:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 17:51:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 95AE0D0428 for ; Thu, 13 Apr 2017 17:51:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.38 X-Spam-Level: ** X-Spam-Status: No, score=2.38 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id yFEUfZRg1zsq for ; Thu, 13 Apr 2017 17:51:21 +0000 (UTC) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id CA36A5F1C2 for ; Thu, 13 Apr 2017 17:51:20 +0000 (UTC) Received: by mail-wm0-f51.google.com with SMTP id u2so52098551wmu.0 for ; Thu, 13 Apr 2017 10:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=P0jCPZksxkYh5iZXnaiKzk8jSWhkOl2g+qM+nNFrx5U=; b=W2SdoaypuEwAkbJga36N0nl20iklme3rNeA17uiq6Ahty/qPaTpfyM4mMhCgt7DXmv oiHRT/HiRxGnkGefE37QQuUSiqBmCgjufEUYv3UgsNOqvdWWYbq7xVV2OSn1/UxwkqW5 ifyWHBMzRjoPKYBPFEGivBU0N5h5K5oF2cKgOwOxdP02uLMPaP23CtM6l+gwQ5gQ0SF6 ZKY+Vt4K2BId2/MdWtST99xwz9ByNgBAnUz9JtamxQKH74/nkb6UQd5qeCmvD1UEahdJ xebXxTWgForlumXuZ2KHl9MwthavNmMcc3akGcKIfaUdUivmVU3xa8A890CnX9rD78iK /kIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=P0jCPZksxkYh5iZXnaiKzk8jSWhkOl2g+qM+nNFrx5U=; b=lTMlseK72+6glmOtwQQvxzv9mAOuah5KmdmtZum3D0e3lfjhJlaM1T0RrG+DhpKPd6 i+Bm7Q5h3fR5Q++0TEmBXT3xmoCDvNbTt/pP12PF81qeBlB2BGLnXW2cheV6ViocmlHq 8liH1p1qeI2rI8+c9taJaiwCrUF2xKQCXSbaQmtEaC/BFaiUmexDapY9w34dWx/pFGqr UaInAaDbz+2gJCOkeXFCndXGX4u9sFr8wG9YeLPNDW3/37BX2SgwBJ8aA38l5quOo2sX FX6sSzpMD0aWqb9uMgufeCImHi68JvsyvQwycQBpxJLrGixa+XTpvTpbIPXODIPM+B8t NqKQ== X-Gm-Message-State: AN3rC/70vnfYZAaI5PH82CBJ/fzuR2usUtPJqKC8XG4JGgvryEZKjim3 GuFap7EWkSR9H9QsONnZZknmbL8CyA== X-Received: by 10.28.210.133 with SMTP id j127mr4191842wmg.10.1492105880341; Thu, 13 Apr 2017 10:51:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.164.138 with HTTP; Thu, 13 Apr 2017 10:51:19 -0700 (PDT) In-Reply-To: References: <0e04d6c8-a3cc-3824-542d-e45024d7876a@elyograg.org> From: Chetas Joshi Date: Thu, 13 Apr 2017 10:51:19 -0700 Message-ID: Subject: Re: Long GC pauses while reading Solr docs using Cursor approach To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a11472176f74d8f054d0ff8c7 archived-at: Thu, 13 Apr 2017 17:51:28 -0000 --001a11472176f74d8f054d0ff8c7 Content-Type: text/plain; charset=UTF-8 Hi Shawn, Thanks for the insights into the memory requirements. Looks like cursor approach is going to require a lot of memory for millions of documents. If I run a query that returns only 500K documents still keeping 100K docs per page, I don't see long GC pauses. So it is not really the number of rows per page but the overall number of docs. May be I can reduce the document cache and the field cache. What do you think? Erick, I was using the streaming approach to get back results from Solr but I was running into some run time exceptions. That bug has been fixed in solr 6.0. But because of some reasons, I won't be able to move to Java 8 and hence I will have to stick to solr 5.5.0. That is the reason I had to switch to the cursor approach. Thanks! On Wed, Apr 12, 2017 at 8:37 PM, Erick Erickson wrote: > You're missing the point of my comment. Since they already are > docValues, you can use the /export functionality to get the results > back as a _stream_ and avoid all of the overhead of the aggregator > node doing a merge sort and all of that. > > You'll have to do this from SolrJ, but see CloudSolrStream. You can > see examples of its usage in StreamingTest.java. > > this should > 1> complete much, much faster. The design goal is 400K rows/second but YMMV > 2> use vastly less memory on your Solr instances. > 3> only require _one_ query > > Best, > Erick > > On Wed, Apr 12, 2017 at 7:36 PM, Shawn Heisey wrote: > > On 4/12/2017 5:19 PM, Chetas Joshi wrote: > >> I am getting back 100K results per page. > >> The fields have docValues enabled and I am getting sorted results based > on "id" and 2 more fields (String: 32 Bytes and Long: 8 Bytes). > >> > >> I have a solr Cloud of 80 nodes. There will be one shard that will get > top 100K docs from each shard and apply merge sort. So, the max memory > usage of any shard could be 40 bytes * 100K * 80 = 320 MB. Why would heap > memory usage shoot up from 8 GB to 17 GB? > > > > From what I understand, Java overhead for a String object is 56 bytes > > above the actual byte size of the string itself. And each character in > > the string will be two bytes -- Java uses UTF-16 for character > > representation internally. If I'm right about these numbers, it means > > that each of those id values will take 120 bytes -- and that doesn't > > include the size the actual response (xml, json, etc). > > > > I don't know what the overhead for a long is, but you can be sure that > > it's going to take more than eight bytes total memory usage for each one. > > > > Then there is overhead for all the Lucene memory structures required to > > execute the query and gather results, plus Solr memory structures to > > keep track of everything. I have absolutely no idea how much memory > > Lucene and Solr use to accomplish a query, but it's not going to be > > small when you have 200 million documents per shard. > > > > Speaking of Solr memory requirements, under normal query circumstances > > the aggregating node is going to receive at least 100K results from > > *every* shard in the collection, which it will condense down to the > > final result with 100K entries. The behavior during a cursor-based > > request may be more memory-efficient than what I have described, but I > > am unsure whether that is the case. > > > > If the cursor behavior is not more efficient, then each entry in those > > results will contain the uniqueKey value and the score. That's going to > > be many megabytes for every shard. If there are 80 shards, it would > > probably be over a gigabyte for one request. > > > > Thanks, > > Shawn > > > --001a11472176f74d8f054d0ff8c7--