Copy link to clipboard
Copied
Recently I use cfthread writing a multithread samples. Each thread ask a http request.When I run this cfc file with coldfusion9 on windows, it runs well. Then I run the same cfc file on coldfusion9 on linux(RedHat and centOS), unfortunately, it seems do not work, I found the multi thread do not run parallely, they run one by one. The both coldfusion configuration files are same, and the web server use the built-in one of coldfusion. Is there anyone meet the same probelm? And is there something wrong with cfthread to run on linux? Really need your help. Many thanks!
Copy link to clipboard
Copied
Could we see the code? Then it would be easier to debug it.
Copy link to clipboard
Copied
<cfloop index="pageIndex" from="1" to="#num#" step="1">
<cfthread name="thr#pageIndex#" threadIndex="#pageIndex#" action="run">
<cftry>
<cfhttp url="#watson_url#" method="post" charset="utf-8" timeout="26000000" useragent="#CGI.http_user_agent#" result="THREAD.GETTREAD">
<cfhttpparam type="formfield" name="appGUID" value="#guid#">
<cfhttpparam type="formfield" name="userId" value="#user_id#">
<cfhttpparam type="formfield" name="password" value="#user_pass#">
<cfhttpparam type="formfield" name="sql" value="#TempArr[threadIndex]#">
</cfhttp>
<cfset result_Arr = #DeserializeJSON(THREAD.GETTREAD.Filecontent)#>
<cfset resultArr[threadIndex]=result_Arr >
<cfcatch type="any">
</cfcatch>
</cftry>
</cfthread>
</cfloop>
TempArr is an array for sql,each thread run a sql and get result from http request.