Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2019 18:45:43 +0200 (CEST)
From:      Wojciech Puchar <wojtek@puchar.net>
To:        Jim Thompson <jim@netgate.com>
Cc:        Eugene Grosbein <eugen@grosbein.net>, Wojciech Puchar <wojtek@puchar.net>,  freebsd-hackers@freebsd.org
Subject:   Re: openvpn and system overhead
Message-ID:  <alpine.BSF.2.20.1904191842140.44949@puchar.net>
In-Reply-To: <ACE6415A-549E-4349-BB70-E4C1ECA08BCB@netgate.com>
References:  <alpine.BSF.2.20.1904171707030.87502@puchar.net> <0cc6e0ac-a9a6-a462-3a1e-bfccfd41e138@grosbein.net> <ACE6415A-549E-4349-BB70-E4C1ECA08BCB@netgate.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>>
>> 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 ‘stack’ inside OpenVPN is single-threaded/single packet at a time.
>
> Also, you’ll need to multiplex > 1 instance of OpenVPN, maybe using the programability of VALE (aka ‘mswitch’).
>
there is no problem that openvpn is single threaded. i can easily divide 
things over multiple openvpn processes.

The problem is CPU load it produces. It will not be smart to use up whole 
8 core machine just to provide 3-4Gbps of VPN traffic with no spare power 
to do actual work.

i found that most of time openvpn executes system call, encryption takes 
little time.

if FreeBSD would be able to provide multiple packets per read/write call 
from/to tun device, as well as send/recv would have multipacket version - 
it would mean speeding it up at least 4 times.
From owner-freebsd-hackers@freebsd.org  Fri Apr 19 17:01:14 2019
Return-Path: <owner-freebsd-hackers@freebsd.org>
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 393EC1572552
 for <freebsd-hackers@mailman.ysv.freebsd.org>;
 Fri, 19 Apr 2019 17:01:14 +0000 (UTC)
 (envelope-from lidl@FreeBSD.org)
Received: from hydra.pix.net (hydra.pix.net [IPv6:2001:470:e254:10::4])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mail.pix.net", Issuer "Pix.Com Technologies LLC CA" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id E544087988
 for <freebsd-hackers@freebsd.org>; Fri, 19 Apr 2019 17:01:13 +0000 (UTC)
 (envelope-from lidl@FreeBSD.org)
Received: from torb.pix.net ([IPv6:2001:470:e254:10:fc26:6da6:2a7d:3ae5])
 (authenticated bits=0)
 by hydra.pix.net (8.15.2/8.15.2) with ESMTPA id x3JH16iS002659;
 Fri, 19 Apr 2019 13:01:13 -0400 (EDT)
 (envelope-from lidl@FreeBSD.org)
X-Authentication-Warning: hydra.pix.net: Host
 [IPv6:2001:470:e254:10:fc26:6da6:2a7d:3ae5] claimed to be torb.pix.net
Subject: Re: openvpn and system overhead
To: freebsd-hackers@freebsd.org
References: <alpine.BSF.2.20.1904171707030.87502@puchar.net>
 <0cc6e0ac-a9a6-a462-3a1e-bfccfd41e138@grosbein.net>
 <ACE6415A-549E-4349-BB70-E4C1ECA08BCB@netgate.com>
 <alpine.BSF.2.20.1904191842140.44949@puchar.net>
Reply-To: lidl@FreeBSD.org
From: Kurt Lidl <lidl@FreeBSD.org>
Message-ID: <8e238882-1779-41ed-92fd-33abf2667d18@FreeBSD.org>
Date: Fri, 19 Apr 2019 13:01:06 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0)
 Gecko/20100101 Thunderbird/60.6.1
MIME-Version: 1.0
In-Reply-To: <alpine.BSF.2.20.1904191842140.44949@puchar.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-BeenThere: freebsd-hackers@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Technical Discussions relating to FreeBSD
 <freebsd-hackers.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-hackers>, 
 <mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers/>;
List-Post: <mailto:freebsd-hackers@freebsd.org>
List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, 
 <mailto:freebsd-hackers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Apr 2019 17:01:14 -0000

On 4/19/19 12:45 PM, Wojciech Puchar wrote:
>>>
>>> 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 ‘stack’ inside OpenVPN is 
>> single-threaded/single packet at a time.
>>
>> Also, you’ll need to multiplex > 1 instance of OpenVPN, maybe using 
>> the programability of VALE (aka ‘mswitch’).
>>
> there is no problem that openvpn is single threaded. i can easily divide 
> things over multiple openvpn processes.
> 
> The problem is CPU load it produces. It will not be smart to use up 
> whole 8 core machine just to provide 3-4Gbps of VPN traffic with no 
> spare power to do actual work.
> 
> i found that most of time openvpn executes system call, encryption takes 
> little time.
> 
> if FreeBSD would be able to provide multiple packets per read/write call 
> from/to tun device, as well as send/recv would have multipacket version 
> - it would mean speeding it up at least 4 times.

Well, FreeBSD does have sendmmsg()/recvmmsg(), which allows for
sending/receiving multiple packets per system call.  I do not know if
the "tun" device allows for send/recv type processing, or just
read/write.

Don't get me wrong -- having in-kernel processing, like ipsec does, is 
far superior to doing it as a userland daemon, IMHO. Just pointing out
that there is a multi-packet system call that could be used, possibly,
to make the userland solution less horrible.

-Kurt




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1904191842140.44949>