1

My application pulls lots of data from different applications according to the selected scopes. For e.g. Org level and SubOrg level scopes, this can cause to bring server down and everyday causes server crashing and timeouts. So I wanted to know whether wrapping cfthread around my cfhttp will solve my timeout problem?

<cfinclude template="fundedScopes.cfm">

<!--- Call the funded scopes --->
<cfset dynVarName = "funded" & bizforShort>
<cfif structKeyExists(variables,dynVarName)>
    <cfset howManyCustomScopes = listLen(structkeylist(variables[dynVarName],"|" ),"|" )>
    <cfmodule template="#Request.Library.CustomTags.VirtualPath#Scheduler_LogDetail.cfm"
                  Step="Funded Level Cache" Detail="Custom Scopes to be cached: #howManyCustomScopes#"
                  LogData=""></cfmodule>
    <cfloop collection="#variables[dynVarName]#" item="t">
        <cfset tempurl = variables[dynVarName][t]["url"]>
        <cfset tempurl = tempurl & "&retainCache=1">
        <cfoutput>
            <cfhttp url="#tempurl#" method="GET" resolveurl="false" timeout="3000">
            #tempurl#<br>
            <cfset scopesCachedCounter = scopesCachedCounter + 1>
            <cfmodule template="#Request.Library.CustomTags.VirtualPath#Scheduler_LogDetail.cfm" Step="Funded Scopes Cache" Detail="#scopesCachedCounter#.- #t#" LogData="#tempurl#"></cfmodule>
        </cfoutput>
    </cfloop>
</cfif>
Vasu
  • 319
  • 5
  • 19
  • 1
    We can't tell you. Have you tried it? – Jarede Mar 21 '14 at 10:18
  • Jarede - i was just doing the same in my local by simply calling a cfhttp using cfthread. It shows a good response, as when i run a traditional cfhttp it took 15 seconds and when i use cfhttp wrapping around cfthread it took 3.12 seconds. (got this code from someone's blog) – Vasu Mar 21 '14 at 10:39
  • If your server is crashing, it might be a case of attempting too much work. Re-arranging the work with cfthread will not reduce the amount of work being done. – Dan Bracuk Mar 21 '14 at 12:15
  • You are correct Dan. My page is pulling extensive data. I was just wondering what solution should i implement to get rid of this timeout errors. I tried cftry/catch also..but this seems no luck. You guys have any idea what could be the possible ways? – Vasu Mar 21 '14 at 13:47
  • I use cfthread on cfbloggers to do my http calls in the background. It isn't reducing the amount of work, but the main request can end a lot quicker that way obviously. You may also want to look into doing conditional HTTP gets. – Raymond Camden Mar 21 '14 at 15:55
  • Thanks Raymond. I will try doing that. – Vasu Mar 23 '14 at 15:18

0 Answers0