-1

SFTP upload is slow, I tested it in a client and with phpseclib and the client was much faster while phpseclib was much slower. Is this normal behavior? What could cause this?

I trimmed down what we were exporting and used tar w/ gzip to archive the files so it's a single compressed upload. The archive was about 16MB and I'm not sure what could throttle the upload if it isn't the library itself, in which case it would be a coding issue instead of a upload issue right?

Any help would be appreciated.

fr332lanc3
  • 151
  • 1
  • 11

1 Answers1

-1

This question is arguably a duplicate of Transfering file for download through SFTP with PHP very slow .

In any event, if you do phpinfo() do you see mcrypt installed? phpseclib uses mcrypt if it's available and it's own pure PHP implementation otherwise.

Also, SSH2 supports a multitude of encryption algorithms and some are faster than others. It could be that the client you're comparing phpseclib against is simply using a faster algorithm than phpseclib has implemented.

Finally, what version of phpseclib are you using? The latest is 0.3.7.

Community
  • 1
  • 1
neubert
  • 15,947
  • 24
  • 120
  • 212
  • Downloaded 0.3.7, yes mcrypt is installed. That's why I was curious as to why it was so slow. – fr332lanc3 Jul 17 '14 at 21:35
  • Do `define('NET_SSH2_LOGGING', 1);` and then `$ssh->getLog()` after the upload function has been completed. Then copy / paste the output into pastebin.com or whatever and post the link. That should show where the slowdown is occurring. – neubert Jul 17 '14 at 22:28
  • It's too big, over 500kb which is the max for guests on the service you mentioned. I can send it to you over email, it's a lot of information but not very useful. It was an array and had tons of items and each time it showed small but I guess adding them up all together makes a larger amount of time. It doesn't really explain anything to me though, are there any sleeps in the code or how can I tell if it's using mcrypt or not? – fr332lanc3 Jul 25 '14 at 13:47
  • The author is pretty responsive at analyzing them - you can email him at terrafrost@php.net and include it as an attachment. Alternatively, maybe you could host a zip of it somewhere. `define('NET_SSH2_LOGGING', 1);` won't tell you if it's using mcrypt is installed but `getServerIdentification()` will. I can tell you whether or not it does based on the return value of that if you post it. As for what I'd be looking for in the logs myself.. mainly just for packets that took a long time. How big is the log file? – neubert Jul 25 '14 at 14:01