-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs.ftpfs.FTPFS.upload opens new connections #455
Comments
Hmmm, true, I'm actually wondering too. I know it makes sense to open a new connection when opening a new file, to guarantee the file and the @willmcgugan , any opinion? Maybe there was a reason for doing so when you wrote the code that I am unaware of. |
Yeah, FTP offers no way of multiplexing file downloads that I know of, so multiple instances are the only way to achieve that. Re shortcut methods, I guess we could re-use the main connection used for listing directories, but there would still need to be one per thread to make it thread-safe. I wouldn't be surprised if there were wins that could be made for copying files sequentially. Especially for many small files. But in general I would expect downloading in parallel to eclipse those wins... |
Wouldn't locking the |
Sure. That would limit performance though. Do we do that already? I don’t recall. |
In the snippet linked by @atollk the lock is acquired before |
Fine by me! There are probably other places in |
I created the PR. As @althonos said, in I don't see any other places in Regarding In my experience, multiple FTP connections to the same server almost never actually give you anything; you'll just have two connections with half their data rate each. (Although I'll leave that statement up for discussion.) In that case, I feel that As an alternative, maybe some kind of "connection pool" instead of a single ftp connection would be appropriate; so |
Hi,
I'm looking at this function:
pyfilesystem2/fs/ftpfs.py
Line 813 in 64d7a52
_manage_ftp
always opens a new FTP connection, together with user login, "FEAT" command and so on. This is done everytime one wants to copy a file to an FTPFS. Is there a good reason why that code doesn't just useself._ftp
, the connection that should be open for the lifetime of the FTPFS object? Otherwise, I'd like to create a PR to fix that.The text was updated successfully, but these errors were encountered: