GitHub user spmallette opened a pull request:
https://github.com/apache/tinkerpop/pull/584
TINKERPOP-1095 Gremlin Server performance improvement with
SimpleScriptContext
https://issues.apache.org/jira/browse/TINKERPOP-1095
The issue is about creating a custom `ScriptContext` for improved
usability purposes but it's since morphed to an important performance
improvement for the `GremlinScriptEngine` and thus also Gremlin Server. The
change uses the custom `ScriptContext`, named `GremlinScriptContext`, to
prevent usage of the `SimpleScriptContext` which creates `ByteBuffer` instances
on every call to `eval()` and those instances were never used making them
immediately available to GC.
For Gremlin Server it seems that it has been cycling GC way more than it
should have been. Here's GC activity before my changes:

and GC activity after my changes:

Obviously the amount of memory allocated was greatly reduced in the
process. The number of `byte[]` instances was allocated held 2.91 GB prior to
the changes:

and for the same workload after the changes just 638 MB:

I can't think of anything wrong with replacing `SimpleScriptContext` and
all the tests seem fine as a result with Docker so - VOTE +1
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1095
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/584.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #584
----
commit 48daf8d25fcf3abb9d2a3c307e65ec6613595959
Author: Stephen Mallette <[email protected]>
Date: 2017-03-24T16:23:46Z
TINKERPOP-1095 Added a custom ScriptContext
Used the custom ScriptContext, GremlinScriptContext, to prevent usage of
the SimpleScriptContext which creates unnecessary ByteBuffer instances on every
call to eval().
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---