Performance issues are one of the biggest challenges to expect when designing and implementing web applications. Performance problems can disrupt your business, which can result in short and long term loss of revenue.
The ColdFusion support team at Adobe, has dealt with several performance related issues with ColdFusion and a couple of them, around JDK 1.8 as well.
Based on our experience with customers, the major performance issues could be categorized as – CPU hikes, Website crashes, Processing of slow requests, Memory (for example, OutOFMemory, Memory leaks) issues, Error 503/Service unavailable error, Slow performance while running database queries, SecureRandom seed generation on some linux servers, Network latency and likewise.
ColdFusion is a Java-based application server. Any Java-related change directly impacts ColdFusion. With introduction of Java 1.8, ColdFusion had to be optimized for Java 1.8. Even after the optimization, there could be few parameters, that might cause the performance hit on the ColdFusion server.
Let’s discuss about these performance issues, method to trace them, and their possible resolutions, in a bit more detail.
CPU Hike: Hikes in CPU usage are the most common performance issue, which we experienced. Usually, the absence of load and performance testing fails to predict the impact on existing CPU utilization. CPU hike can occur due to various reasons, such as: –
● Out of memory issues
● OutOfMemoryError: Heap – Generally OutOfMemory:Heap would not only happen because application usage is higher than the upper limit provided. But, it can also happen, because a lower value of heap, than actual usage could slow down the jvm. OutOfMemory could be because GC is not able to claim memory. This could happen because of strong references to stale objects or aggressive load so that before GC cleans up OOM is thrown. The default value for Maximum JVM Heap Size is 1GB in ColdFusion (2016 release). Based on your application’s memory usage, we can update the maximum heap value.You can change the value in ColdFusion Administrator or in jvm.config (ColdFusionXXXX/instance_name/bin).
● OutOfMemoryError: Metaspace: A new flag is available in Java 1.8 (MaxMetaspaceSize), allowing you to limit the amount of native memory used for class metadata.
Excessive Garbage collection:
For more information on Garbage collections please refer to below documentation:
By default, ColdFusion uses parallel GC. You can change the values in jvm.config (ColdFusionXXXX/instance_name/bin):
For detailed investigation of memory leaks or out of memory errors, a heap dump analysis can be very useful. Add the following jvm arguments in jvm.config(ColdFusionXXXX/instance_name/bin) to obtain heap dump:
If you have JDK installed, run the following command from jdkbin directory:
Slow Database query processing:
CF does closes the connections after the timeout. CF reuses the idle/unclosed connections. When required unless the connection is still busy executing some query. If the query execution is taking too long, it has to be a problem with either the application or the database. The idle connections are being re-used, as and when required.
Technical details about the timeout:
So to close all the connections (as per above calculation), CF will take at least 25 mins to close, all open connections. The maximum limit of closing 5 timeout connections is not configurable and is by design.
The optimized value for timeout can be set 5 and interval to 1. You can configure them further, as per your application requirement. You can change the database timeout value in CF administrator in Advanced settings of Data & Services > Datasources to optimize idle/unclosed connections.
You may try below :
Note that 30 sec is default timeout.
This enables canonical cache that caches the canonical path of a file. This helps, when there are a lot of threads waiting to get path from WinNTFileSystem. While accessing files from a network drive, each “getCanonicalPath” would end up going to network and would become quite expensive task. Enabling this cache means that for same file, JVM would never go back to disk (till the time it is in cache) to find its path.
Linux random number generation:
To fix this issue, we need to modify the jetty.xml at ColdFusionXXXXcfusionlib. Change the Server monitoring IP address from 0.0.0.0 to 127.0.0.1 and restart ColdFusion.
Service unavailable error:
We have also seen some issues because of bugs in few specific update level of java. The best practice would be to keep your ColdFusion Java updated to latest version. Use the below blog to keep your java up to date.
ColdFusion thread dumps:
Another issue we have seen in one or two cases, If the performance is impacted by XML parsing, the jvm argument below can fix it:
The other causes of performance issue include:
In case the above steps does not resolve the issue, please feel free to contact Adobe support (https://helpx.adobe.com/support/coldfusion.html) for analysis of the issue.
Some key points to remember:-
*Please note that, any changes made to jvm.config, would require a ColdFusion service restart.
Regarding the discussion of metaspace, I will share that if someone hits an “outofmemoryerror: metaspace”, the best solution may well be simply to remove the maxmetaspacesize argument, as I discuss here:
You must be logged in to post a comment.