curl-library
Re:RE: slow uploading speed for single task on osx
Date: Thu, 5 Dec 2013 19:12:17 +0800
The core code that I deal with the multi-curl. Hope that it helps.
void CurlMultiRunner::perform()
{
// wait for more events
fd_set read_fdset, write_fdset, exc_fdset;
int max_fd;
FD_ZERO(&read_fdset);
FD_ZERO(&write_fdset);
FD_ZERO(&exc_fdset);
curl_multi_fdset(scopped_curlm_.get(), &read_fdset, &write_fdset, &exc_fdset, &max_fd);
if(max_fd == -1)
{
#ifdef _EMACLE_WIN_
::Sleep(IO_IDLE_WAIT_INTERVAL);
#elif defined(_EMACLE_OSX_)
usleep(IO_IDLE_WAIT_INTERVAL*1000);
#endif
}
else
{
timeval timeout = {0, IO_IDLE_WAIT_INTERVAL * 1000};
select(max_fd, &read_fdset, &write_fdset, &exc_fdset, &timeout);
}
// perform the transfer
int running_handles = 0;
for (CURLMcode cm_code = CURLM_CALL_MULTI_PERFORM;
cm_code == CURLM_CALL_MULTI_PERFORM;)
{
cm_code = curl_multi_perform(scopped_curlm_.get(), &running_handles);
checkPerformingResult(static_cast<size_t>(running_handles));
}
}
------------------ Original ------------------
From: "Yehezkel Horowitz";<horowity_at_checkpoint.com>;
Date: Thu, Dec 5, 2013 06:22 PM
To: "libcurl development"<curl-library_at_cool.haxx.se>;
Subject: RE: slow uploading speed for single task on osx
>> The lib curl version is 7.26. And because the code concerning about
>> lib curl is deeply embedded into the solution, it might be a little
>> bit hard to extract the complete sample code to repeat the problem :(
>The multi interface has nothing in itself that makes it slower than the easy interface (unless you've found a bug). I would say that it is likely something in your use of it that makes it slow.
Maybe when there are more than one transfer, the application call curl_multi_perform or curl_multi_socket_action more frequently.
This is indeed wrong usage, as the calls should be done according to events (socket/timeout).
Please give us more details when you call curl_multi_perform/curl_multi_socket_action from your code (what is the trigger to those calls), and when you call it with CURL_SOCKET_TIMEOUT...
Regards,
Yehezkel Horowitz
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-12-05