From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 6 23:00:16 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41B5B309 for ; Fri, 6 Jun 2014 23:00:16 +0000 (UTC) Received: from mail-qa0-x22e.google.com (mail-qa0-x22e.google.com [IPv6:2607:f8b0:400d:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05B1129A2 for ; Fri, 6 Jun 2014 23:00:15 +0000 (UTC) Received: by mail-qa0-f46.google.com with SMTP id w8so4938812qac.33 for ; Fri, 06 Jun 2014 16:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2AewTrMxR4Cy6qPmxEaxPWvw2A/Jp773VGhLd3QMVu4=; b=k5zjOKhCQYGPu1hLr14FhOZTSJD6b6gEWojyWDwOVwTvVfkJu8VNIT7LkBZIzo22kO R+UrzP2IXoG0+WqmXraXjaac9nOZxNSMN5pRSyp+g5/dGYzszlgFBZlBs2kuA/x6RFkS 5/xYDv/TZSMqrwSpZzWMspobteHyOorCKMyYaWrqmuqRzj8B5gZ9JBiI6crch1OfN2PA ZSy3Er+bP8pvT8IoLJENLPTJn1KQQGRc0u1iQAwZhQ3QOazkWglOTFA4ImUXx94I2KVz PNPhM6tkd8MSELlnj5zwUKpozEk+6Plpa34cPSEQw6ncVAsmVTrwHyeyBRkpuJD4rQ/Y EFKQ== MIME-Version: 1.0 X-Received: by 10.224.47.148 with SMTP id n20mr13573415qaf.90.1402095614399; Fri, 06 Jun 2014 16:00:14 -0700 (PDT) Received: by 10.170.115.66 with HTTP; Fri, 6 Jun 2014 16:00:14 -0700 (PDT) Date: Sat, 7 Jun 2014 01:00:14 +0200 Message-ID: Subject: Best practice for accepting TCP connections on multicore? From: Daniel Janzon To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 23:00:16 -0000 Hi, What is the best practice (performance-wise) for dispatching new TCP connections to different threads in order to make use of multiple cores? Is there any better way than doing the accept() call in one thread and then dispatch it to a thread on another core with any user space method? Conceivably one should be able to perform the accept() call from several threads but using the same socket and let the kernel distribute the incoming connections using some kind of hash or round robin. Regards, Daniel