From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by dpdk.org (Postfix) with ESMTP id 025EFC35E for ; Mon, 6 Apr 2015 22:43:25 +0200 (CEST) Received: by pacyx8 with SMTP id yx8so54751283pac.1 for ; Mon, 06 Apr 2015 13:43:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=L9uxCwZPfqGoHVEPYmWhE/XCRK/slgXJKYcgCIpoDzM=; b=Ms7/7yTeLpmBdBVRXWSNpPtEeYb9PHrfbo6K+82GkPAEIlG24b6+ZTwTkk+yo24XTU K1SvJTnlgcfGHEadf7+li06Gc/cE420KRx/biBmjQsFFvrjK9YLyGdOzIf5YKqIoXZby elyyBlL9izaRsciGz+35l9U4+qhcDvN9pA75m0853yEF8WUYr1sKCqxbEGjxigJoymkx SO0qMjcmo5FUNc+mou8rrVDHBr0ccVyymZhVTwibeQjuQAdvfcTEgSUuKzq0R01GCCnh csWGDaP2uvZ4ZcKw49l0i5jdwDV3gqPgzZWD4e4yiZbkOhI1/atFpelRTA+MApL2f+AG RV/A== X-Gm-Message-State: ALoCoQkNXyuBP9zaTYySkrkthRTiVt+gUO2LDgENiLmDgoP+XhQcmYAvbgFanvp+T9QWXhoJ+oAS X-Received: by 10.70.32.34 with SMTP id f2mr30005095pdi.142.1428353004327; Mon, 06 Apr 2015 13:43:24 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id nw14sm5707859pab.39.2015.04.06.13.43.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 13:43:24 -0700 (PDT) Date: Mon, 6 Apr 2015 13:43:29 -0700 From: Stephen Hemminger To: Dor Green Message-ID: <20150406134329.1f613e92@urahara> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] rte_ring's dequeue appears to be slow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2015 20:43:25 -0000 On Mon, 6 Apr 2015 15:18:21 +0300 Dor Green wrote: > I have an app which captures packets on a single core and then passes > to multiple workers on different lcores, using the ring queues. > > While I manage to capture packets at 10Gbps, when I send it to the > processing lcores there is substantial packet loss. At first I figured > it's the processing I do on the packets and optimized that, which did > help it a little but did not alleviate the problem. > > I used Intel VTune amplifier to profile the program, and on all > profiling checks that I did there, the majority of the time in the > program is spent in "__rte_ring_sc_do_dequeue" (about 70%). I was > wondering if anyone can tell me how to optimize this, or if I'm using > the queues incorrectly, or maybe even doing the profiling wrong > (because I do find it weird that this dequeuing is so slow). > > My program architecture is as follows (replaced consts with actual values): > > A queue is created for each processing lcore: > rte_ring_create(qname, swsize, NUMA_SOCKET, 1024*1024, > RING_F_SP_ENQ | RING_F_SC_DEQ); > > The processing core enqueues packets one by one, to each of the queues > (the packet burst size is 256): > rte_ring_sp_enqueue(lc[queue_index].queue, (void *const)pkts[i]); > > Which are then dequeued in bulk in the processor lcores: > rte_ring_sc_dequeue_bulk(lc->queue, (void**) &mbufs, 128); > > I'm using 16 1GB hugepages, running the new 2.0 version. If there's > any further info required about the program, let me know. > > Thank you. First off, make sure you are enqueuing and dequeuing in bursts if possible. That saves a lot of the overhead. Also, with polling applications, the dequeue function can be falsely blamed for taking CPU, if most of the time the poll does not succeed in finding any data.