Hi, do have a small poc sample to create a tunnel like socat ?
I would like to bench with iperf. I have some benchmark, on recent server with 3ghz cpu: nbd migration direct : 3,5gbit/s iperf through socat tunnel : 3,5gbit/s (1core 100%) iperf through websocat plaintext (a rust implementation with websocket) https://github.com/vi/websocat : 3 gbit/s (1core 100%) Could be great to reach 3gbits with perl implementation too :) (don't known with encryption, but with aes in cpu hardware, maybe the overhead is not so big) ----- Mail original ----- De: "Thomas Lamprecht" <t.lampre...@proxmox.com> À: "pve-devel" <pve-devel@pve.proxmox.com>, "Fabian Grünbichler" <f.gruenbich...@proxmox.com> Envoyé: Samedi 7 Mars 2020 20:26:46 Objet: [pve-devel] applied: [PATCH http-server 1/4] websocket: improve masking performance On 3/6/20 11:20 AM, Fabian Grünbichler wrote: > in order to make websocket proxying feasible as general tunnel, we need > to be able to transfer more than a few MB/s > > Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> > --- > PVE/APIServer/AnyEvent.pm | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm > index 3ce948f..9f432e1 100644 > --- a/PVE/APIServer/AnyEvent.pm > +++ b/PVE/APIServer/AnyEvent.pm > @@ -479,19 +479,19 @@ sub websocket_proxy { > > my $data = substr($hdl->{rbuf}, 0, $offset + 4 + $payload_len, ''); # now > consume data > > - my @mask = (unpack('C', substr($data, $offset+0, 1)), > - unpack('C', substr($data, $offset+1, 1)), > - unpack('C', substr($data, $offset+2, 1)), > - unpack('C', substr($data, $offset+3, 1))); > - > + my $mask = substr($data, $offset, 4); > $offset += 4; > > my $payload = substr($data, $offset, $payload_len); > > - for (my $i = 0; $i < $payload_len; $i++) { > - my $d = unpack('C', substr($payload, $i, 1)); > - my $n = $d ^ $mask[$i % 4]; > - substr($payload, $i, 1, pack('C', $n)); > + # NULL-mask might be used over TLS, skip to increase performance > + if ($mask ne pack('N', 0)) { > + # repeat 4 byte mask to payload length + up to 4 byte > + $mask = $mask x (int($payload_len / 4) + 1); > + # truncate mask to payload length > + substr($mask, $payload_len) = ""; > + # (un-)apply mask > + $payload ^= $mask; > } > > $payload = decode_base64($payload) if !$binary; > applied, thanks! _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel