Comment 6 for bug 1594924

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks like it is the go DES implementation being slow:

dooferlad@homework2 ~/dev/go/src/github.com/juju/juju $ go tool pprof $(which juju) /tmp/profile179913735/cpu.pprof
Entering interactive mode (type "help" for commands)
(pprof) top10
11.37s of 11.57s total (98.27%)
Dropped 23 nodes (cum <= 0.06s)
Showing top 10 nodes out of 30 (cum >= 11.22s)
      flat flat% sum% cum cum%
     7.86s 67.93% 67.93% 9.95s 86.00% crypto/des.feistel
     2.09s 18.06% 86.00% 2.09s 18.06% crypto/des.expandBlock
     0.71s 6.14% 92.13% 11s 95.07% crypto/des.cryptBlock
     0.21s 1.82% 93.95% 0.21s 1.82% crypto/des.permuteInitialBlock
     0.13s 1.12% 95.07% 0.13s 1.12% crypto/des.permuteFinalBlock
     0.12s 1.04% 96.11% 0.12s 1.04% crypto/sha1.block
     0.07s 0.61% 96.72% 7.47s 64.56% crypto/des.(*desCipher).Encrypt
     0.06s 0.52% 97.23% 11.34s 98.01% crypto/cipher.(*cbcEncrypter).CryptBlocks
     0.06s 0.52% 97.75% 0.06s 0.52% crypto/cipher.fastXORBytes
     0.06s 0.52% 98.27% 11.22s 96.97% crypto/des.(*tripleDESCipher).Encrypt

Having removed DES from the ciphers that Juju will use:

dooferlad@homework2 ~/dev/go/src/github.com/juju/juju $ go tool pprof $(which juju) /tmp/profile383480576/cpu.pprof
Entering interactive mode (type "help" for commands)
(pprof) top10
530ms of 570ms total (92.98%)
Showing top 10 nodes out of 45 (cum >= 60ms)
      flat flat% sum% cum cum%
     190ms 33.33% 33.33% 190ms 33.33% crypto/aes.encryptBlockAsm
     120ms 21.05% 54.39% 120ms 21.05% crypto/sha1.block
     110ms 19.30% 73.68% 110ms 19.30% syscall.Syscall
      30ms 5.26% 78.95% 290ms 50.88% crypto/cipher.(*cbcEncrypter).CryptBlocks
      30ms 5.26% 84.21% 30ms 5.26% crypto/cipher.fastXORBytes
      10ms 1.75% 85.96% 210ms 36.84% crypto/aes.(*aesCipher).Encrypt
      10ms 1.75% 87.72% 10ms 1.75% crypto/aes.(*aesCipherGCM).Encrypt
      10ms 1.75% 89.47% 200ms 35.09% crypto/aes.encryptBlock
      10ms 1.75% 91.23% 40ms 7.02% crypto/cipher.xorBytes
      10ms 1.75% 92.98% 60ms 10.53% io.(*LimitedReader).Read

This gets an 804M file across the wire much more quickly:
dooferlad@homework2 ~/dev/go/src/github.com/juju/juju $ time juju attach hacky name=/home/dooferlad/a-file.bin

real 0m37.085s
user 0m5.807s
sys 0m0.755s

Which is about 170Mbps

But not as fast as scp:
dooferlad@homework2 ~/dev/go/src/github.com/juju/juju $ time juju scp /home/dooferlad/a-file.bin 0:/home/ubuntu

real 0m6.269s
user 0m3.651s
sys 0m1.153s

This is 1GBps