Database Reference
In-Depth Information
Table 10.6. Performance metrics log after scenario 2, Cypher call
Curl client
Java REST binding
Number of
server calls
made
Scenario
Description
Cold
Warm
Cold
Warm
1
Raw REST API 602
5726 ms
5303 ms
1066 ms
917 ms
2
Cypher call
1
740 ms
45 ms
104 ms
32 ms
3
Server plugin
Unmanaged ex-
tension
4
This approach has provided a dramatic improvement to the performance for the query.
10.5.3. Server plugins
Server plugins provide a mechanism for offloading some of the processing-intensive logic
totheserverratherthanhavingtoperformitallontheclient,withmultiplerequestshaving
to flow backward and forward to accomplish the same thing. Server plugins are sometimes
compared to stored procedures in the relational database world.
Server plugins have specifically been designed to extend the existing REST API options
returned for a node, relationship, or the global graph database. Recall that when you make
a request for the detail of a particular node, you get a lot of options back, including an ex-
tensions key. See the following snippet for a recap:
{ ...
"extensions" : { . . .},
"property" : "http://localhost:7474/db/data/node/0/properties/{key}",
"self" : "http://localhost:7474/db/data/node/0",
"data" : { "name" : "Adam" }
... }
This represents the list of extension points (server plugins available) for the node. Similar
extension points will be available for relationships and the graph as a whole.
To write a server plugin, you need to first decide what it is you want to target or ex-
tend—the node, relationship, or graph database options—and then follow these steps:
 
 
Search WWH ::




Custom Search