Skip navigation
shudini1
Currently Being Moderated

throttled CFHTTP

Sep 10, 2012 2:18 PM

Tags: #cfhttp #cf10

i recently upgraded from cf9 to cf10. running single instance on a brand new ubuntu server 12.04 with Apache. same settings as my other ubuntu servers as far as i can tell. Suddenly, all my cfhttp tags are being throttled with about 5 second breaks being pushed into each one. Each additional request made pushes the time taken up 5 seconds. i've compared every setting i could think of to the cf9 servers but nothing worked.

 

Here's from the http.log:

HTTP request completed {Status Code=200 ,Time taken=28525 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-18 
HTTP request completed {Status Code=200 ,Time taken=22752 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-23 
HTTP request completed {Status Code=200 ,Time taken=17549 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-17 
HTTP request completed {Status Code=200 ,Time taken=12320 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-22 
HTTP request completed {Status Code=200 ,Time taken=7137 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-25 
HTTP request completed {Status Code=200 ,Time taken=4302 ms}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-23 
Starting HTTP request {URL='http://www.google.com', method='GET'}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-17 
Starting HTTP request {URL='http://www.google.com', method='GET'}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-22 
Starting HTTP request {URL='http://www.google.com', method='GET'}
Sep 10, 2012  5:13 PM  Information  ajp-bio-8012-exec-19 
Starting HTTP request {URL='http://www.google.com', method='GET'}

Any help would be greatly appreciated.

 

Thanks!

 
Replies
  • Currently Being Moderated
    Nov 8, 2012 11:01 AM   in reply to shudini1

    I am also seeing this. Tcpdump shows that it isn't the web server slowing things down. It does appear to be in the cfhttp tag. Did you find an answer to this?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 8, 2012 11:52 AM   in reply to shudini1

    Maybe?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 9:34 AM   in reply to psu_josh

    Were you able to resolve this?

     

    It's definitely a bug as far as we can tell.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 11:05 AM   in reply to shudini1

    Voted, and added a brief note on my OS being RHEL

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 5:24 AM   in reply to shudini1

    I have added the following note to the bug report. This may sound crazy, but I've seen weirder things in ColdFusion. It just might be that what you observe is expected behaviour, assuming single-threaded processing.

     

    Say, you have 10 cfhttp tags in a loop. When the loop starts, ColdFusion first processes a number of cfhttp start-tags, perhaps up to all 10 of them, possibly without strictly respecting order. Since the processing is single-threaded, ColdFusion executes the tag bodies in series, one after the other. This would explain why the successive execution times are cumulative.

     

    See Ben Nadel's blog on using cfthread with cfhttp. There he solves the problem by using multiple, asynchronous threads, like this:

     

    <cfloop index="intGet" from="1" to="10">

    <!--- Start a new thread for this CFHttp call. --->

    <cfthread action="run" name="objGet#intGet#">

    <cfhttp method="GET" url="some_url" result="THREAD.Get#intGet#" />

    </cfthread>

    </cfloop>

     

    <!---

    Now, we have to wait for all of concurrent threads to be joined before we can use the CFHttp results.

    --->

    <cfloop index="intGet" from="1" to="10">

    <cfthread action="join" name="objGet#intGet#" />

    </cfloop>

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 5:55 AM   in reply to shudini1

    45 to 0.7 is indeed a big ratio. That does not necessarily rule out the effect of single versus parallel threads. My guess is that some other factor in CF 10 is forcing single-threading.

     

    To start with, perhaps these settings in the Administrator:

     

    "Maximum number of simultaneous Template requests

    The number of CFML page requests that can be processed concurrently. Use this setting to increase overall system performance for heavy load applications. Requests beyond the specified limit are queued.

     

    Maximum number of threads available for CFTHREAD

    The maximum number of threads created by CFTHREAD that will be run concurrently. Threads created by CFTHREAD in excess of this are queued."

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 10:16 AM   in reply to shudini1

    shudini1 wrote:

     

    However, just so no one can accuse me of not willing to try to find a workaround, I took Ben's code from this page: http://www.bennadel.com/blog/749-Learning-ColdFusion-8-CFThread-Part-I I-Parallel-Threads.htm and tested on a CF9 and CF10 configuration.

    .

    Here are the results from the servers:

     

    CF9: We Got 1000 Results in 0.72 seconds using CFHttp and CFThread

    CF10: We Got 1000 Results in 45.02 seconds using CFHttp and CFThread

     

    So it doesn't really seem like parallel threads would help out here.

    Something is definitely wrong. My results are:

     

    We Got 1000 Results in 4.95 seconds using standard CFHttp

    We Got 1000 Results in 0.89 seconds using CFHttp and CFThread

     

    They look like the kind of results one would expect. I am on CF 10.0.4.283281 (Update 4 of CF 10). Would the updates have patched something?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2012 8:23 AM   in reply to shudini1

    It's not much help, but I ran a few tests and I don't see what you're seeing on my CF10 install: all CFHTTP requests are being fired immediately, and the length of time they take to complete is roughly the same per request. IE: I'm not seeing anything I would not expect to see if the thing was working properly.

     

    My CF10 install is a bog-standard one, patched to 10.0.4.  CF10 Developer, running on Windows 7 Home 64-bit.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2012 9:53 AM   in reply to Adam Cameron.

    So this to me helps narrow down the problem. You are saying it runs fine for you on windows. So far the only people who have reported issues are on Linux.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2012 10:39 AM   in reply to psu_josh

    I can also report that 10,0,5,283319 doesn't solve this issue for me.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 12:23 AM   in reply to psu_josh

    psu_josh wrote:

     

    I can also report that 10,0,5,283319 doesn't solve this issue for me.

    Not that this would matter. 10.0.5 is a Windows security update. As you say, the bottle-neck is likely a Linux issue. So what is it on Linux systems that is queueing up the threads?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 10:01 PM   in reply to BKBK

    We investigated this and found out that this does happen on some Linux machines but not all. The reason it happens is because Apache HttpClient library creates a SecureRandom number for every http call which can be slow on new Unix boxes as there are not enough entropy generated on those machines.

     

    There are few possible ways to solve this and I would recommend either of these two.

    1. 1. Set this system property to your JVM – if you are using standalone CF installation, you would set it in jvm.config.

    “-Djava.security.egd=file:/dev/./urandom”

    1. 2. In $JAVA_HOME/jre/lib/security/java.security file, change the value of securerandom.source to file:/dev/./urandom

     

    You can also refer to this excellent post by Shilpi from the ColdFusion team which talks about this issue

    http://www.shilpikhariwal.com/2012/04/random-number-generation-in-unix .html

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points