From owner-freebsd-hackers@freebsd.org Wed Apr 17 23:40:08 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53355157CC0F for ; Wed, 17 Apr 2019 23:40:08 +0000 (UTC) (envelope-from jim@netgate.com) Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 461B869DF6 for ; Wed, 17 Apr 2019 23:40:07 +0000 (UTC) (envelope-from jim@netgate.com) Received: by mail-oi1-x242.google.com with SMTP id v7so176087oie.8 for ; Wed, 17 Apr 2019 16:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RNxduuNZELwqIhgwh9acuNfU7pqfVygAKKgLE7cZCUc=; b=EgAMMAg6mt7GmrDhxu8jgBeqNdHW2Fy3MpW66F11LEJXHTOF2noiiFzI1QBRUWgi5M 2tJ8vqqm+gExskAoafwy+T1wIH/LQTafWdm+YXR2jVGwwHvWOolzbAEOXuMLkIvFNJB0 OyZg+pYsMOg1X2R6qqu3deDTedR5+O1bDlWlw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RNxduuNZELwqIhgwh9acuNfU7pqfVygAKKgLE7cZCUc=; b=ZTfwoQTm+lKdSOOp0xEOhIOSxPhgLqo8yURzTmkpc+aOR0bVbdjONpqezKYMtRkt2D Z27XcgnccvJh/Kuo56KMcxfGIwyQPvMaCRkqnj9cSgRpStZrz4J9VuJVwoBavvlW8E0f wAmIHs3pC2PXwn53fCUwqWKhiXdy9ekdZv+GAuFG6i+WWlGGiJKk2qYcTsv7iZReYRnD Ly5QOearwn3/qL4I7/1GugaZfCgMqFoPOMtb6MYU3iBczNUkjbW79HeZWVHYplsbYrGx ZfymRWqho2ItvCg+LPhKOc4vdxAKkCRb26JBYheVd8sGp2X8/pJAUpxqXyzvyjReIcEp tAZw== X-Gm-Message-State: APjAAAUT2XWENb7+yI8ToYOh9n3YOFrWZFHYkSsQ0iTudqLL9V6WskgI jytud3V2Wa6dv4BTeitPIyUmYiB9sKtRqw== X-Google-Smtp-Source: APXvYqzuVfYjiFjxzu9zYvCUgOle9qVsDSujHjDcmx6D8pYYkfLZ9SJ6IgtfavGba9Re0r/zpAuLAg== X-Received: by 2002:aca:bb88:: with SMTP id l130mr100981oif.124.1555544406225; Wed, 17 Apr 2019 16:40:06 -0700 (PDT) Received: from [10.10.10.235] ([66.196.5.190]) by smtp.gmail.com with ESMTPSA id l49sm147278otc.19.2019.04.17.16.40.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 16:40:05 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: openvpn and system overhead From: Jim Thompson In-Reply-To: <0cc6e0ac-a9a6-a462-3a1e-bfccfd41e138@grosbein.net> Date: Wed, 17 Apr 2019 18:40:03 -0500 Cc: Wojciech Puchar , freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <0cc6e0ac-a9a6-a462-3a1e-bfccfd41e138@grosbein.net> To: Eugene Grosbein X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: 461B869DF6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=netgate.com header.s=google header.b=EgAMMAg6; dmarc=pass (policy=none) header.from=netgate.com; spf=pass (mx1.freebsd.org: domain of jim@netgate.com designates 2607:f8b0:4864:20::242 as permitted sender) smtp.mailfrom=jim@netgate.com X-Spamd-Result: default: False [-4.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[netgate.com:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; DKIM_TRACE(0.00)[netgate.com:+]; DMARC_POLICY_ALLOW(-0.50)[netgate.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.58)[ip: (2.44), ipnet: 2607:f8b0::/32(-3.05), asn: 15169(-2.23), country: US(-0.06)]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2019 23:40:08 -0000 > On Apr 17, 2019, at 6:11 PM, Eugene Grosbein = wrote: >=20 > 17.04.2019 22:08, Wojciech Puchar wrote: >=20 >> i'm running openvpn server on Xeon E5 2620 server. >>=20 >> when receiving 100Mbit/s traffic over VPN it uses 20% of single core. >> At least 75% of it is system time. >>=20 >> Seems like 500Mbit/s is a max for a single openvpn process. >>=20 >> can anything be done about that to improve performance? >=20 > Anyone concerning performance should stop using solutions processing = payload traffic > with userland daemon while still using common system network = interfaces > because of unavoidable and big overhead due to constant context = switching > from user land to kernel land and back. Be it openvpn or another = userland daemon. >=20 > You need either some netmap-based solution or kernel-side vpn like = IPsec (maybe with l2tp). > For me, IKE daemon plus net/mpd5 work just fine. mpd5 is userland = daemon too, > but it processes only signalling traffic like session establishment = packets > and then it setups kernel structures (netgraph nodes) so that payload = traffic is processed in-kernel only. Addendum to previous message to freebsd-hackers: We have (also) considered a netmap-enhanced (enabled?) OpenVPN. You = still have the problem that the =E2=80=98stack=E2=80=99 inside OpenVPN = is single-threaded/single packet at a time. Also, you=E2=80=99ll need to multiplex > 1 instance of OpenVPN, maybe = using the programability of VALE (aka =E2=80=98mswitch=E2=80=99). Linaro=E2=80=99s Open Data Plane project did a shim that would talk via = shared memory (ODP queues) between OpenVPN and ODP. ODP queues = aren=E2=80=99t too different from netmap rings,=20 so a PoC based on this code would be straight-forward. "This demo was = not intend to improve performance, it was only for basic functionality." https://github.com/repu1sion/odp_apps/tree/master/openvpn Jim=