Optimizing CFHTTP calls on Linux systems
While making a cfhttp call to a coldfusion server the apache httpclient library tries to generate a secure random number. It is an operation which depends on the "entropy" of the system.
In case of linux systems (mainly the ones which are freshly installed) it is observed that this operation can be quite time consuming because the system "entropy" is apparently quite low. Hence, as a consequence cfhttp calls will be slow.
Fortunately for people who deploy Coldfusion-10 on linux machines this is not a reason to worry. Just do one of the following:
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”
or
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 post by Shilpi, from the ColdFusion team which talks about this issue
10 comments so far ↓
Regards >>
Gaurav Garg Linux
Even with those options set.
4 seconds for a simple cfhttp on google.com.
I don't understand.
I know ColdFusion doesn't support CentOS, but any plans of providing support for CentOS when ColdFusion 11 ships?
@Damien, SecureRandom is actually used to generate cryptographically secure random numbers. I know that the Apache HttpClient library that we use internally or cfhttp makes use of SecureRandom but I am not sure why. I will need to check the HttpClient source for it. But anyways that is not important.
The important thing is - if you are seeing your CFHTTP to be very slow and you are on a linux box, make sure to specify these settings to the JVM.
Leave a Comment