[Gremlin] A Fast Implementation of JSR223

124 views
Skip to first unread message

Marko Rodriguez

unread,
Nov 4, 2012, 5:14:19 PM11/4/12
to gremli...@googlegroups.com
Hello,

For the last 11 months, this ticket has existed:


Groovy has GroovyScriptEngine (non JSR223 compliant) and GroovyScriptEngineImpl (JSR223 compliant). While you may think they are similar, they are widely different. I took the easy route with Gremlin and simply extended GroovyScriptEngineImpl to "Gremlin-ify" the Groovy engine and allow applications from other JVM languages to easily talk to Gremlin.


This easy route lead to a very inefficient JSR223 implementation that required reloading of imports on every eval() call. Horribly inefficient -- ~100+ms wasted on loading the imports for each call. For some work we are doing with Rexster (massive concurrency + binary protocol), we needed to make eval() fast. I was lucky enough to find a mapping between GroovyScriptEngine and GroovyScriptEngineImpl developed by some Google engineers. 


I greatly adopted this code and we now have a wicked fast JSR223 implementation.


We are now looking at eval() load times of less than 1 ms. (from ~100 ms).

Thanks James and i000 for spurning the issue,
Marko.

James Thornton

unread,
Nov 5, 2012, 12:58:25 PM11/5/12
to gremli...@googlegroups.com


On Sunday, November 4, 2012 4:14:28 PM UTC-6, Marko A. Rodriguez wrote:

For the last 11 months, this ticket has existed:

 
I greatly adopted this code and we now have a wicked fast JSR223 implementation.


Sweet, thanks Marko!

What Groovy version is Gremlin using? -- the PermGen fix is in versions 1.8.9 and 2.0.4.


- James

Stephen Mallette

unread,
Nov 5, 2012, 1:05:44 PM11/5/12
to gremli...@googlegroups.com
we are still officially on 1.8.8, but are experimenting heavily with
1.8.9 right now. there's groovy189 branches of gremlin and rexster
that depend on the 1.8.9.
> --
>
>

Marko Rodriguez

unread,
Nov 5, 2012, 1:06:44 PM11/5/12
to gremli...@googlegroups.com
Hi,

What Groovy version is Gremlin using? -- the PermGen fix is in versions 1.8.9 and 2.0.4.

Gremlin currently uses Groovy 1.8.8. We have a branch with 1.8.9-SNAPSHOT and are waiting for them to release it. At which point, we will move forward with a new TinkerPop release before months end.

Thanks again James for the nice ticket (with i000) that allowed me to figure out how to proceed easily,
Marko.
--
 
 

Peter Neubauer

unread,
Nov 5, 2012, 3:19:39 PM11/5/12
to gremlin-users
Love it.


Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


--
 
 

rAndomPi

unread,
Jan 10, 2013, 7:19:31 PM1/10/13
to gremli...@googlegroups.com
Is this included in the current release of 2.2.0?

We are currently using 2.0.0 and use the following snippet to execute our gremlin queries through:

        ScriptEngineManager manager = new ScriptEngineManager();

        ScriptEngine engine = manager.getEngineByName("gremlin-groovy");

        engine.getBindings(ScriptContext.ENGINE_SCOPE).put("graph", graph);

We are seeing some slow query times, and I was hoping this new faster JSR implementation would help us?

-Randall

Marko A. Rodriguez

unread,
Jan 10, 2013, 7:28:41 PM1/10/13
to gremli...@googlegroups.com
Hi,

Yes, this is in 2.2.0.

Try this:

engine = new GremlinGroovyScriptEngine();

…and see if there is a difference. Perhaps you have the Services provider in the class path messed up looking at an older version of Gremlin ??..

Marko.
--
 
 

Reply all
Reply to author
Forward
0 new messages