Monday, January 16, 2012

PHP-CURL curl_multi_exec is it really multithreaded internally?


My question is very simple as stated in title. However I rephrase it again.



I want to download multiple sites using php-curl. I'll run it from console. I am going to use curl_multi_exec to download all the sites. Now the question, will curl create different threads for each of the request?



I know I can achieve it by forking multiple processes. But thats not threading. I dont want threading. I want to know if its multi-threaded?

1 comment:

  1. The answer is yes. But a common problem is name resolving. By the default the Linux gethostbyname() is a synchronous function and having X threads instead of one won't help, because they are executed in serial, because they are blocking behind resolving DNS. On Windows DNS resolving is asynchrous by default, however.

    ReplyDelete