I maintain a well-trafficked site on CF9 that has occasional memory problems
that ultimately requires restarts. I am fairly certain the cause of my
problems is related to "bot" hits and the server's memory they take up. I am
attempting to set low sessionTimeouts to all bots to remedy this situation.
I've listed a few code samples below I found while researching a solution.
Is there a "best practice" as to handle this? Any additional code samples
would be welcome.
Thanks, Che
Method #1
<cfif structKeyExists(cookie, "CFID")>
<cfset this.sessionTimeout = createTimeSpan(0,0,10,0)>
<cfelse>
<cfset this.sessionTimeout = createTimeSpan(0,0,0,2)>
</cfif>
Method #3
<cfif isBoolean(URLSessionFormat("true"))>
<cfset this.sessionTimeout = createTimeSpan(0,0,10,0)>
<cfelse>
<cfset this.sessionTimeout = createTimeSpan(0,0,0,2)>
</cfif>
Method #3
<cfset this.sessionTimeout = createTimeSpan(0,0,10,0)>
<cfif len(cgi.http_user_agent) gt 0>
<cfloop
list="bot\b,crawl\b,crawler\b,spider\b,\brss,addthis,alexa,bender,custo,doco
mo,esobisubscriber,ezooms,funwebproducts,giganot,google web
preview,heritrix,ia
archiver,ichiro,jeeves,mail.ru,netseer,nutch,powermarks,simple server
monitor,slurp,sogou,twiceler,vse,vortex,websurfer,yahoocachesystem"
index="i" delimiters=",">
<cfif reFind(i, lcase(cgi.http_user_agent))>
<cfset this.sessionTimeout =
createTimeSpan(0,0,0,2)>
<cfbreak>
</cfif>
</cfloop>
<cfelse>
<cfset this.sessionTimeout = createTimeSpan(0,0,0,2)>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351209
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm