On Thu, 6 May 2010, Xu, Qiang (FXSGSC) wrote:
By the way, from the comment above defining CURL_MAX_WRITE_SIZE to 16384, it seems you have met some similar problems with Windows SFTP server, esp. when it comes to uploading. Could you tell me the full story behind it? It seems to me that the original buffer size limit is 20KB, and it is changed to 16KB later.
You need to remember that libcurl is multi-protocol. We set the buffer size to 16K *years* before libcurl could even do SFTP.
The reason is simply that back in the days we found out that the Windows TCP stack simply behaved very differently depending on what buffer sizes we used, and for some reason 16K seemed to be a pretty good size to get decent enough throughput at the time we tested it. We got worse performance by increasing the buffer size. We also don't want to have the buffer size too big since each handle will have this buffer size allocated (and at times even two of these buffers).
Tests done in modern times have also verified that 16K is still a pretty decent size for most operating systems.
We've designed the header to easily allow builders to customize the size in the cases you actually find a size that works better for a particular use-case. We have however not found any better size than 16K that works good enough genericly "all over".
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
