Subject: | sslwrite gives very poor performance |
Hi,
I noticed that Net::Async::Webservice::S3 was taking > 5mins to upload a 165MiB file and using 100% cpu, while aws cli took < 20secs and used ~25-30%.
I tracked down the issue to IO::Async::SSL::sslwrite and found that $buf was being unpacked from @_. I can see you were using $_[1] rather than $buf later on anyway, so I guess it wasn't intended :-)
This teeeeeeeny patch brings performace in line with expectations.
Thanks!
I noticed that Net::Async::Webservice::S3 was taking > 5mins to upload a 165MiB file and using 100% cpu, while aws cli took < 20secs and used ~25-30%.
I tracked down the issue to IO::Async::SSL::sslwrite and found that $buf was being unpacked from @_. I can see you were using $_[1] rather than $buf later on anyway, so I guess it wasn't intended :-)
This teeeeeeeny patch brings performace in line with expectations.
Thanks!
Subject: | 0001-Don-t-copy-buffer-from-args-it-s-a-performance-kille.patch |
From ff24d0b26dae0dfa91f9c0a003211fb762572387 Mon Sep 17 00:00:00 2001
From: Ioan Rogers <ioan.rogers@sophos.com>
Date: Thu, 16 Apr 2015 11:58:58 -0700
Subject: [PATCH] Don't copy buffer from args, it's a performance killer
---
lib/IO/Async/SSL.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/IO/Async/SSL.pm b/lib/IO/Async/SSL.pm
index 6602976..a5bfdf2 100644
--- a/lib/IO/Async/SSL.pm
+++ b/lib/IO/Async/SSL.pm
@@ -115,7 +115,7 @@ sub sslread
sub sslwrite
{
my $stream = shift;
- my ( $fh, $buf, $len ) = @_;
+ my ( $fh, undef, $len ) = @_;
my $ret = $stream->_syswrite( $fh, $_[1], $len );
--
2.1.4