neo4j-contrib / gremlin-plugin

A Plugin for the Neo4j server add Tinkerpop-related functionality
Other
55 stars 23 forks source link

Change ScriptCountingEngineReplacementDecision #31

Open jakewins opened 9 years ago

jakewins commented 9 years ago

Moved from main Neo4j issue tracker:

@espeed: 'As per https://groups.google.com/d/msg/neo4j/YeaT5LOMCdk/qnS1yhtKX1gJ ...

There are two versions of the EngineReplacementDecision: https://github.com/neo4j/gremlin-plugin/tree/master/src/main/java/org/neo4j/server/plugin/gremlin

CountingEngineReplacementDecision restarts the engine after every X rquests: https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/CountingEngineReplacementDecision.java

ScriptCountingEngineReplacementDecision restarts when the number of scripts in the cache grows to X: https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/ScriptCountingEngineReplacementDecision.java

The plugin is currently using the CountingEngineReplacementDecision and restarting it after every 500 requests: https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinPlugin.java#L61

It looks like it would be simple to switch to ScriptCounting and so if Heroku users only use a few unique scripts, then it won't restart unless the actual server restarts.

Change to the ScriptCountingEngineReplacementDecision so that it's the default or make it configurable in Heroku.