Skip to main content

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?


Comments

  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

Post a Comment

Popular posts from this blog

Wildcards in a hosts file

I want to setup my local development machine so that any requests for *.local are redirected to localhost . The idea is that as I develop multiple sites, I can just add vhosts to Apache called site1.local , site2.local etc, and have them all resolve to localhost , while Apache serves a different site accordingly.