Template caching in Lucee

296 views
Skip to first unread message

John Blayter

unread,
Aug 11, 2015, 2:59:18 PM8/11/15
to Lucee
In CF9's template caching and it seems that after a CFM/CFC gets compiled into a class file that it seems to toss that into the PermGen memory in Java. This makes it super hard to push code to a high traffic server without user impact. We've gotten better at it but still throws off some users.

As we dive into Lucee we are wondering how the Lucee saves these java files and loads them into memory for performance caching.
What are the best settings for caching templates on a high traffic server?
When we push out new code how does Lucee recognize that?
What is the best workflow in your opinion of using the PagePoolClear() function? I assume this is the trigger that clears those cached templates

Igal @ Lucee.org

unread,
Aug 11, 2015, 3:10:38 PM8/11/15
to lu...@googlegroups.com
In CF9's template caching and it seems that after a CFM/CFC gets compiled into a class file that it seems to toss that into the PermGen memory in Java. This makes it super hard to push code to a high traffic server without user impact. We've gotten better at it but still throws off some users.
you should configure the Java Agent, which will allow Lucee to re-use the class files rather than toss away the whole class loader tree.  also, consider upgrading to Java 8 which does not have the PermGen model anymore, and therefore works much more efficiently and reliably.


As we dive into Lucee we are wondering how the Lucee saves these java files and loads them into memory for performance caching.
Lucee creates a .class file and saves it to /WEB-INF/lucee/cfclasses/{path-based-on-original-path}


When we push out new code how does Lucee recognize that?
that depends on your settings.  for files that are inspected once or always, the timestamp on the class file is compared with the timestamp of the source file.  for files that are never inspected you have to refresh manually


What is the best workflow in your opinion of using the PagePoolClear() function? I assume this is the trigger that clears those cached templates
PagePoolClear() is a good way to handle it, yes.  another way is via the Admin under Performance/Caching and clicking the button labeled "Clear Page Pool Cache".  you can always add something like this to the beginning of your Application.cfc's onRequestStart():

function onRequestStart() {

  if (CGI.REMOTE_ADDR == "127.0.0.1")    // overly simplified for example purposes
      if (URL.keyExists("refreshCode"))
          PagePoolClear();

  // more code here
}

then call your app with ?refreshCode from an allowed IP

Igal Sapir
Lucee Core Developer
Lucee.org

--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/b833e28f-0283-4016-a08b-cf6709a8a5ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages