Ouch :)

The gremlin plugin (as does the cypher plugin) take an map (a json map) as 
"params", each of which which you then can refer to everywhere in the gremlin 
script (key == variable name, value == value).

So no need for JSONSlurper.

The real problem here lies in the fact that each of your statements (with 
different parameters) will cause the groovy-scripting engine to generate a new 
groovy class, which will in turn
* cause PermGen OutOfMemory errors as those can't be garbage collected as long 
as the script engine is around
* will take about factor 100-1000 longer to execute (parsing, class generation, 
loading and such).

For the first issue we have a work-around in the plugin which recreates the 
script-engine every 500 requests (should probably be configurable) but this is 
less than optimal.

The second problem will hit you all the time.

Michael

See: 
http://docs.neo4j.org/chunked/milestone/gremlin-plugin.html#rest-api-send-a-gremlin-script-with-variables-in-a-json-map

Am 09.12.2011 um 20:35 schrieb espeed:

> 
> Michael Hunger wrote
>> 
>> I understood you were just templating the params in there (string
>> replacement) which would result in different groovy strings for every set
>> of different parameters. Is this correct?
>> 
> 
> The string replacement is done on the client side. When the script is
> presented to the extension, it looks like a normal Gremlin script.
> 
> For example, the update_indexed_vertex YAML script has three params: nodeId,
> properties, indexName. But all the string replacement is done by the client.
> 
> By the time the Gremlin extension gets it, the nodeId is an integer, which
> is used to look up the node object:
> 
> node = g.getRawGraph().getNodeById(5)
> 
> The properties are a JSON string, which are immediately converted to a
> Groovy map so they can be iterated upon:
> 
> Map<String, Object> properties = slurper.parseText('{"age":35,"name":"James
> Thornton"}')
> 
> The indexName is a string, which is used to look up the actual index:
> 
> index = manager.forNodes('people')
> 
> Here is what the Gremlin extension actually sees:
> https://gist.github.com/1452942
> 
> Do see an issue with that?
> 
> - James
> 
> 
> 
> --
> View this message in context: 
> http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Feedback-after-evaluation-tp3569774p3573842.html
> Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
> _______________________________________________
> NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
> and consider posting at https://groups.google.com/forum/#!forum/neo4j
> 
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to