Indiana Jones and the Server of Doom
CFObjective 09
CFObjective 09
Mike Brunt â CFWhisperer
no notes exist for this slide
Server of Doom
Who am I, what am I and why am I here?
Who am I, what am I and why am I here?
I have been using CF since 1996, version 1.54 (dbml) and am still actively developing in CF.
I worked for Allaire-Macromedia as a ColdFusion-Spectra consultant.
Co-founded Webapper (SeeFusion crowd) carried on the Allaire-Macromedia consulting work.
Here to show ColdFusion performance improvement techniques and optimal database environment planning.
no notes exist for this slide
Slide 3
no text exists for this slide
no notes exist for this slide
Slide 4
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
1/ Analyze Current Production Logs (no more than 7 days old)
2/ Enable Metrics Logging
3/ Enable Verbose Garbage Collection Logging
4/ Analyze Results and Change Arguments â JVM (this is iterative)
5/ Optimal Database Configuration Planning
no notes exist for this slide
Slide 5
no text exists for this slide
no notes exist for this slide
Slide 6
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
1/ Analyze Current Production Logs (no more than 7 days old)
05/12 09:09:50 Error [jrpp-2112] - TYPE: java.lang.OutOfMemoryError EXCEPTION: null null <br>The error occurred on line -1. PAGE: /internal/slowpage.cfm?printPage=report_internal&requesttimeout=999999 REFERRER: http://acmecorp/internal/slowpage.cfm?PrintPage=report_internal
no notes exist for this slide
Slide 7
Ten Steps To A Stable and Performant Web Application
Ten Steps To A Stable and Performant Web Application
2/ Enable Metrics Logging
Irrespective of whether we have or use ColdFusion Server Monitor, SeeFusion or Fusion Reactor; we always recommend the turning on of Metrics Logging and leaving it on in production. The overhead is insignificant and the help we can get at times of server stress is priceless in some cases. Edit the jrun.xml fileâ¦
On a Standard install - {drive}Coldfusion8\runtime\servers\coldfusion\SERVER-INF
On an Enterprise Multiple Instance install - {drive}\JRun4\servers\coldfusion\SERVER-INF
no notes exist for this slide
Slide 8
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
2/ Enable Metrics Logging (changes made in yellow)
<!-- -->
<service class="jrunx.metrics.MetricsService" name="MetricsService">
<attribute name="bindToJNDI">true</attribute>
</service>
<!-- ================================================================== -->
<!-- This Service creates the runnable scheduler -->
<!-- ================================================================== -->
<service class="jrunx.scheduler.SchedulerService" name="SchedulerService">
<attribute name="bindToJNDI">true</attribute>
<attribute name="activeHandlerThreads">25</attribute>
<attribute name="maxHandlerThreads">1000</attribute>
<attribute name="minHandlerThreads">20</attribute>
<attribute name="threadWaitTimeout">180</attribute>
<attribute name="timeout">600</attribute>
</service>
<!-- ================================================================== -->
<!-- This Service represents JRun's logging facility -->
<!-- ================================================================== -->
<service class="jrunx.logger.LoggerService" name="LoggerService">
<attribute name="format">{server.date} {log.level} {log.message}{log.exception}</attribute>
<!-- You can modify format to suit your need. -->
<!-- EXAMPLE: <attribute name="format">{date MM/dd HH:mm:ss} {log.message}{log.exception}</attribute> -->
<attribute name="errorEnabled">true</attribute>
<attribute name="warningEnabled">true</attribute>
<attribute name="infoEnabled">true</attribute>
<attribute name="debugEnabled">false</attribute>
<!-- You may also need to uncomment MetricsService if you want metrics enabled -->
<attribute name="metricsEnabled">true</attribute>
<attribute name="metricsLogFrequency">60</attribute>
<attribute name="metricsFormat">Web threads (busy/total): {jrpp.busyTh}/{jrpp.totalTh} Sessions: {sessions} Total Memory={totalMemory} Free={freeMemory}</attribute>
<service class="jrunx.logger.ThreadedLogEventHandler" name="ThreadedLogEventHandler">
<service class="jrunx.logger.ConsoleLogEventHandler" name=":service=ConsoleLogEventHandler" />
<service class="jrunx.logger.FileLogEventHandler" name="FileLogEventHandler">
<attribute name="filename">{jrun.rootdir}/logs/{jrun.server.name}-{log.level}-event.log</attribute>
no notes exist for this slide
Slide 9
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
2/ Enable Metrics Logging example output goes into the âout.log and also into a dedicated metrics log which is created as a result of the previous changes in the jrun.xml from use of the {log.level} modifier.
01/05 12:17:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520048 Free=158060
01/05 12:18:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520432 Free=215408
01/05 12:19:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520984 Free=164688
01/05 12:20:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520000 Free=93655
01/05 12:21:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520832 Free=58571
01/05 12:22:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520792 Free=83309
01/05 12:23:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520496 Free=105955
no notes exist for this slide
Slide 10
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
3/ Enable Verbose Garbage Collection Logging
In step 3 we will enable verbose garbage collection logging, these details apply to the Sun Java Virtual Machine (JVM). We will already have some indication of how the total and free memory is behaving from the data produced by the metrics logging we enabled in step 2.
01/05 12:17:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520048 Free=158060
01/05 12:18:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520432 Free=215408
01/05 12:19:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520984 Free=164688
01/05 12:20:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520000 Free=93655
01/05 12:21:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520832 Free=58571
01/05 12:22:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520792 Free=83309
01/05 12:23:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520496 Free=105955
The Memory= metric shows the total memory available to the Java Virtual Machine (JVM) heap and the Free= metric shows how much memory is still available to the heap, unused. In this case, we can already see that free memory gets very low from time to time, what we want to look at next, is the detail of what the generations of memory in the JVM heap are doing.
no notes exist for this slide
Slide 11
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
3/ Enable Verbose Garbage Collection Logging (The Three Main Generations)
The New or Young Generation - This is where all objects created in an application first go, to be very basic when someone clicks on something an object is created in memory and goes into the New-Young generation. At this point there will be "references" to that object from the application and ongoing garbage collections check all objects for references. After around 40 to 45 attempts to collect an object, in the New-Young generation it is moved to the next generation, if it cannot be collected, that generation is called the Old or Tenured generation.. One point about the New-Young generation is that in almost every case we observe this generation at 100% in ColdFusion applications. In many of those cases we cannot set that generation high enough to avoid 100% usage, this comment applies to 32-bit installs.
The Old or Tenured Generation - As mentioned in the section above, objects that are not collected whilst in the New-Young generation, after 40-45 attempts, are moved into the Old-Tenured generation. This generation is effectively only collected when there is a Full Garbage Collection (Full GC). Full GC's, in the current family of Sun JVM's are "stop-the-world" events in the sense that for the duration of the Full GC the JVM stops doing all else. Therefore, too many Full GC's of too long a duration will impact performance, negatively and that is one of the things we always look for.
The Permanent Generation/PermGen - This is where the classes required by JRun-ColdFusion are stored along with some of the cached objects in the ColdFusion application layer. The thing that we want to avoid here is this generation permanently sitting at 100% with no room to grow. In a lot of cases, we have seen out of memory errors caused by the permanent generation running at 100%.
no notes exist for this slide
Slide 12
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
3/ Enable Verbose Garbage Collection Logging
The way that we enable verbose garbage collection, is by passing 4 arguments to the JVM via the jvm.config file. This is an example of those arguments...
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -verbose:gc -Xloggc:cfwhispererGC.log
This set of arguments will produce logging output which will go into a file called "cfwhispererGC.log" in the {drive}\JRun4\bin directory on an Enterprise multiple instance install and into the {drive}\ColdFusion8\runtime\bin directory on a standard install of ColdFusion. The next slide has sample outputâ¦
no notes exist for this slide
Slide 13
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
3/ Enable Verbose Garbage Collection Logging â here is actual sample output.
{Heap before GC invocations=1281 (full 2):
PSYoungGen total 55360K, used 55360K [0x2bef0000, 0x2f7d0000, 0x2f7d0000)
eden space 52608K, 100% used [0x2bef0000,0x2bef0000,0x2f250000)
from space 2752K, 67% used [0x2f250000,0x2f422630,0x2f500000)
to space 2816K, 0% used [0x2f510000,0x2f510000,0x2f7d0000)
PSOldGen total 466048K, used 464447K [0x0f7d0000, 0x2bef0000, 0x2bef0000)
object space 466048K, 99% used [0x0f7d0000,0x2bd5fde8,0x2bef0000)
PSPermGen total 46848K, used 46842K [0x037d0000, 0x06590000, 0x0f7d0000)
object space 46848K, 99% used [0x037d0000,0x0658e878,0x06590000)
This tells us that there have been a total of 1281 garbage collections of which 2 were Full GC's.{Heap before GC invocations=1281 (full 2):
It also shows us that the New-Young generation is at 100% used - PSYoungGen total 55360K, used 55360K [0x2bef0000, 0x2f7d0000, 0x2f7d0000)
In addition, that the Permanent generation is at 99% used - PSPermGen total 46848K, used 46842K [0x037d0000, 0x06590000, 0x0f7d0000) object space 46848K, 99% used [0x037d0000,0x0658e878,0x06590000)
no notes exist for this slide
Slide 14
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
3/ Enable Verbose Garbage Collection Logging
The arguments we need to pass to tune the JVM memory behavior will be added to the jvm.config file which resides hereâ¦
On a Standard install - {drive}Coldfusion8\runtime\bin\
On an Enterprise Multiple Instance install - {drive}\JRun4\bin\
In a default install of ColdFusion the initial memory settings are theseâ¦
java.args=-server -Xmx512m XX:MaxPermSize=192m
These are inadequate in almost every case all we have here are upper limits on the total and permanent generation. Letâs revisit the metrics logging outputâ¦
no notes exist for this slide
Slide 15
Steps To A Stable and Efficient ColdFusion Application
Steps To A Stable and Efficient ColdFusion Application
4/ Analyze Results and Change Arguments â JVM (this is iterative)
Metrics Logging Output:
01/05 12:17:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520048 Free=158060
01/05 12:18:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520432 Free=215408
01/05 12:19:09 metrics Web threads (busy/total/wait): 1/28/0 Sessions: 1 Total Memory=520984 Free=164688
01/05 12:20:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520000 Free=93655
01/05 12:21:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520832 Free=58571
01/05 12:22:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520792 Free=83309
01/05 12:23:09 metrics Web threads (busy/total/wait): 1/27/0 Sessions: 1 Total Memory=520496 Free=105955
Verbose GC Output:
PSYoungGen total 55360K, used 55360K [0x2bef0000, 0x2f7d0000, 0x2f7d0000)
eden space 52608K, 100% used [0x2bef0000,0x2bef0000,0x2f250000)
from space 2752K, 67% used [0x2f250000,0x2f422630,0x2f500000)
to space 2816K, 0% used [0x2f510000,0x2f510000,0x2f7d0000
We will use this output to add/modify the arguments to the JVM via the jvm.config fileâ¦
Defaults at CF install - java.args=-server -Xmx512m XX:MaxPermSize=192m
Modified - java.args=-server Xms1024m âXmx1024m -XX:PermSize=96m -XX:MaxPermSize=192m -XX:NewRatio=3
This will start the heap with 1GB of space with the same max ceiling value, give the Permanent Generation a start size of 96MB and allocate one quarter of the total heap size (256MB) to the New/Young Generation.
no notes exist for this slide
Slide 16
no text exists for this slide
no notes exist for this slide
Slide 17
no text exists for this slide
no notes exist for this slide
Slide 18
no text exists for this slide
no notes exist for this slide
Slide 19
no text exists for this slide
no notes exist for this slide
Slide 20
no text exists for this slide
no notes exist for this slide
As UGG boots sale is becoming more and more popular in the world, many people are eager to possess one pair. The different styles of coast dresses well satisfy different tastes of people and each style is going well with the coast dress you wear. Many UGG boots are long ones which are under your knees, but there are still many special designs for Winter boots. Sometimes, if you want to show your beautiful, evening dress must be your best choice. When you match it with Womens Ugg Boots, it will make you look thin and tall. On the other hand, if you wear a long women dresses , if will not make your legs look too short. http://www.ugg-bootssales.net/
Posted By: bridal dresses On: 09/23/11 2:47 AM