On Aug 15, 2009, at 2:24 AM, Niels Mayer wrote:
[snip]
I notice a huge amount of "loading"
happening regarding jPython!! --
this seems excessive to have Xwiki "out of box" loading up jPython
when Groovy and Velocity are "built in."
And it appears all this loading is for the "{{code}}" macro. Seems
like it would be lighter-weight (esp for high-volume situations) to
use Javascript in the browser for highlighting code (Bespin?)
instead of on the server requiring a whole extra scripting language.
3 things:
1) We did it on the server voluntarily. We want the result to be
available for all renderers + it'll work for browsers without
javascript enabled.
2) The Jython interpreter should only be initialized once. When this
happens it takes a very long time (on the order of 1-2 seconds) but
once it's done it should be much faster
3) Ideally we would have used a java framework except we didn't find
any good one.
Alternately, is there a way of having jython only
load when the
{{code}} macro is used in a document, and then, only when
language=java, html, or xml but not language=none?? Seems like that
would be a big performance win right there.
Yes re language = none it's probably a good idea.
For the conditional loading, we need to check but I thought this is
what it was doing. Also as I said above it's only loaded once so you
just need to call a page when you start your server and thereafter all
queries should run just fine without calling the jython interpreter at
all.
I'll let Thomas provide more info since he's the one who wrote this.
Thanks
-Vincent
[Loaded org.xwiki.rendering.parser.HighlightParser from file:/usr/
java/xe-20m2/WEB-INF/lib/xwiki-core-rendering-macro-code-2.0-
milestone-2.jar]
[Loaded org.xwiki.rendering.parser.AbstractHighlightParser from
file:/usr/java/xe-20m2/WEB-INF/lib/xwiki-core-rendering-macro-
code-2.0-milestone-2.jar]
[Loaded org.xwiki.rendering.internal.parser.pygments.PygmentsParser
from file:/usr/java/xe-20m2/WEB-INF/lib/xwiki-core-rendering-macro-
code-2.0-milestone-2.jar]
[Loaded org.python.core.PyObject from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PySequence from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyBaseString from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyString from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyUnicode from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.xwiki.rendering.parser.Syntax from file:/usr/java/
xe-20m2/WEB-INF/lib/xwiki-core-rendering-api-2.0-milestone-2.jar]
[Loaded org.python.util.PythonInterpreter from file:/usr/java/
xe-20m2/WEB-INF/lib/jython-standalone-2.5.0-xwiki.jar]
...
[Loaded org.xwiki.rendering.macro.box.BoxMacroParameters from file:/
usr/java/xe-20m2/WEB-INF/lib/xwiki-core-rendering-macro-box-2.0-
milestone-2.jar]
[Loaded org.xwiki.rendering.macro.code.CodeMacroParameters from
file:/usr/java/xe-20m2/WEB-INF/lib/xwiki-core-rendering-macro-
code-2.0-milestone-2.jar]
[Loaded $Proxy28 from org.apache.catalina.loader.WebappClassLoader]
[Loaded org.python.core.PyException from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyCode from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyFile from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyFileWriter from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyStringMap from file:/usr/java/xe-20m2/WEB-
INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.PyModule from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.CompilerFlags from file:/usr/java/xe-20m2/
WEB-INF/lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.core.CodeFlag from file:/usr/java/xe-20m2/WEB-INF/
lib/jython-standalone-2.5.0-xwiki.jar]
[Loaded org.python.Version from file:/usr/java/xe-20m2/WEB-INF/lib/
jython-standalone-2.5.0-xwiki.jar]
...
This is with the following flags:
tomcat 24048 4.2 28.7 1784472 554800 ? Sl 16:29 1:46 /
usr/java/default/bin/java -server -Xms160m -Xmx1024m -
XX:PermSize=160m -XX:MaxPermSize=320m -XX:+DoEscapeAnalysis -XX:
+UseBiasedLocking -XX:+AggressiveOpts -XX:
+HeapDumpOnOutOfMemoryError -XX:+PrintCompilation -XX:
+PrintGCDetails -XX:+TraceClassLoading -XX:+TraceClassUnloading -
Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8 -
DjavaEncoding=UTF-8 -Djava.awt.headless=true -Djava.library.path=/
usr/lib64 -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/
share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
-Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/
tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/
temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/
logging.properties -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
org.apache.catalina.startup.Bootstrap start
Niels
http://nielsmayer.com
PS: I also tried out the promising-sounding "-XX:
+UnlockExperimentalVMOptions -XX:+UseG1GC". It still segfaults.
Hopefully, they'll get it right in JDK 7:
# A fatal error has been detected by the Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x00007f15ca60653a, pid=23777,
tid=139729915439440
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0-b16 mixed mode
linux-amd64 )
# Problematic frame:
# V [libjvm.so+0x19c53a]