Monday, January 31, 2011

jQuery 1.5 released

jQuery 1.5 released today .  Read it here.

Interesting stat they published on this release note, how much faster jQuery is on Chrome (and sometimes on Safari), than on any other browser.

Sunday, January 30, 2011

OperatingSystemMXBean: how to know when your ColdFusion server is using much memory, and how to fix it.

This is an excellent post found on http://www.coldfusionjedi.com about how to access the memory consumption on your ColdFusion server.  Read it here.
Basically, there’s this Java Interface, OperatingSystemMXBean, that will tell you the server’s Total Physical Memory, and the server’s Free Physical Memory.
It goes like this:
<cfset mf = createObject("java", "java.lang.management.ManagementFactory")>
<cfset osbean = mf.getOperatingSystemMXBean()>
<cfoutput>
free physical mem = #osbean.getFreePhysicalMemorySize()#<br/>
total physical mem = #osbean.getTotalPhysicalMemorySize()#<br/>
</cfoutput>

I find this interesting because my production server is recently starting to act up… every once in a while is reporting memory full on the JVM.  While I figure out the reasons, I need to perform a garbage collection every now and then.  Using this little script, I can create a Scheduled Task that periodically checks on the memory consumption, and whenever it reaches some limit, I want it to trigger the G.C.

About the G.C., here it is:


<cfset obj = createObject("java","java.lang.System")/>
<cfset obj.gc()/>
<cfset obj.runFinalization()/>

It does work to keep the server running, but I still need to find that memory leak.