在Linux系统下,开了200个线程分别curl同一个网站,结果程序爆错了,一堆。
出错信息:Couldn't connect to server
打开curl选项调试:
curl_easy_setopt(m_pCurl, CURLOPT_VERBOSE, 1);
也定位不了错误,后来发现200个线程,每次都有264个任务可以正常处理,而且程序的线程池会自动调度,空闲线程处理新任务,所以才会有264这个数字。
我访问的网站是在Windows创建的一个网站后台,经过询问,得知Windows的web服务器使用的是apache。
此时错误问题可以初步诊断为:apache的最大连接数导致的问题。
于是经过一番修改(修改方法还是国外的,google伟大):
原文:
It seems that the httpd-mpm.conf file holds the answer. But I'm not sure what settings should be changed or even what module apache is running as.
出错信息:Couldn't connect to server
打开curl选项调试:
curl_easy_setopt(m_pCurl, CURLOPT_VERBOSE, 1);
也定位不了错误,后来发现200个线程,每次都有264个任务可以正常处理,而且程序的线程池会自动调度,空闲线程处理新任务,所以才会有264这个数字。
我访问的网站是在Windows创建的一个网站后台,经过询问,得知Windows的web服务器使用的是apache。
此时错误问题可以初步诊断为:apache的最大连接数导致的问题。
于是经过一番修改(修改方法还是国外的,google伟大):
原文:
It seems that the httpd-mpm.conf file holds the answer. But I'm not sure what settings should be changed or even what module apache is running as.
httpd-mpm.conf:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes wh