<cfhttp> inexplicable slow response time

We are having issues with the response time of <cfhttp> tag on a few Lucee servers that cannot be reproduced on other Lucee servers. Any HTTP request takes at least 2 up to 5 times longer to return a response. Before you dismiss this as a environment/network issue, let me tell you:

Using the Apache HttpClient (via createObject("java", ...)) on the same page as <cfhttp> runs perfectly fine. That’s why I believe there is something odd going on with <cfhttp>.

Snippet
<cfset REMOTE_URL = "https://www.example.org/">

<cfset httpClient   = createObject("java", "org.apache.http.impl.client.HttpClients").createDefault()>
<cfset httpEndpoint = createObject("java", "org.apache.http.client.methods.HttpGet").init(REMOTE_URL)>
<cfset EntityUtils  = createObject("java", "org.apache.http.util.EntityUtils")>

<!---------------------------------------------------------------------------->

<cfset a = getTickCount()>
	<cfset httpResponse = httpClient.execute(httpEndpoint)>
	<cfset httpBody     = EntityUtils.toString( httpResponse.getEntity() )>
<cfset b = getTickCount()>

<cfdump label="Apache: #REMOTE_URL#" var="#[ "#(b - a)# ms", "Status: #httpResponse.getStatusLine()#", "Content-Length: #len(httpBody)#" ]#">

<!---------------------------------------------------------------------------->

<cfset a = getTickCount()>
	<cfhttp method="GET" url="#REMOTE_URL#"></cfhttp>
<cfset b = getTickCount()>

<cfdump label="Lucee: #REMOTE_URL#" var="#[ "#(b - a)# ms", "Status: #CFHTTP.statuscode#", "Content-Length: #len(CFHTTP.filecontent)#" ]#">

Response time on the healthy servers: ~350 ms (Apache/Lucee)
Response time on the bad servers: ~350 ms (Apache), 1400-1700 ms (Lucee)

We tested the following things:

  • http or https does not matter, it’s slow for both protocols
  • address resolution does not matter, it’s slow for a direct IP and for any domain name
  • internal or external network does not matter, it’s slow regardless of the endpoint location
  • response body size does not matter, downloading a large response adds the same amount of time
  • any other HTTP client on the machine is perfectly fine: curl, PowerShell, Chrome

All servers are running the same VM image:

  • Lucee 5.4.3.2
  • jetty/10.0.0
  • AdoptOpenJDK 11.0.10
  • Eclipse OpenJ9 VM openj9-0.24.0
  • Windows Server 2019
  • (no proxy)

We updated Lucee recently, it did happen with 5.3.x before too.

What exactly happens in <cfhttp>? What could possibly delay the response that much? How can I investigate this further? Any help is welcome.

2 Likes