Giter Site home page Giter Site logo

objectundefined / cypher_remoting_experiments Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jexp/cypher_remoting_experiments

0.0 3.0 0.0 236 KB

zeromq msgpack client-server remoting protocol for cypher only

Ruby 5.97% Shell 1.33% Java 92.70%

cypher_remoting_experiments's Introduction

Remoting Experiments for Neo4j's Cypher

Usage

  • right now queries are hard coded in clients
    ./server.sh [db-dir]
    ./client.sh
    ruby client.rb

Sample Session

    Request
    {"query","start n=({ids}) return n", "params": {"ids" : [1,2]},"stats": true,"result":true}

    Response:
    [n]
    [{"id":1,"data":{"name":"foo"}}]
    [{"id":2,"data":{"name":"bar"}}]
    {"time": 0, "rows": 2, "bytes": 100}

Ideas:

Write a Cypher only endpoint for Neo4j that uses a fast transport and serialization across multiple client languages. Cypher Results are streamed from the server. Transaction support. Multithreaded clients and servers Client examples in ruby, python, php, c#, c, javascript, java, scala, clojure, erlang Public installation on Heroku for testing

Serialization

Nodes, Relationships and Paths are converted into maps and lists for serialization recursively

Node : { id : id, [data : {foo:bar}]}
Relationship : { id : id, start: id, end: id, type : "FOO",  [data : {foo:bar}]}
Path {start: node, nodes: [nodes], relationships [relationships], end: node, lenght: 1}

Header with Columns, optional Footer with time, bytes, tx-id, error, exception, rows, update-counts for nodes, relationships, properties.

Compactness

  • leave off footer, enable when needed
  • ignore results (fire & forget)

Transactions

  • provide a "tx" parameter with begin, commit,rollback
  • tx-id will be reported in footer
  • provie a tx-id parameter with the transaction id
  • transaction will be suspended, resumed per request (if a tx-id is provided) and finished and removed at rollback/commit

Serialization

  • fast, lightweight, portable

MessagePack

  • messagepack-lite (source, build, install in repo)
    hg clone https://bitbucket.org/sirbrialliance/msgpack-java-lite
    cd msgpack-java-lite
    ant
    mvn install:install-file -DgroupId=net.asdfa -DartifactId=msgpack -Dversion=0.0.1 -Dfile=dist/msgpack-java-lite.jar  -Dpackaging=jar -DgeneratePom=true

Transport

  • fast, lightweight, portable

ZeroMQ

brew install zeromq

Running as Neo4j Kernel Extension

The cypher server is now packaged as a Neo4j Kernel Extension. So if you build the jar with mvn package and drop the jar in your neo4j environment either in /server/plugins or your classpath/build repository for embedded development, the extension will be started and listen on port 5555 by default.

The server starts by default with 1 Thread, the multiple threads don't work yet with transactions (wrong transactions resumed in the wrong thread) but for non-transactional access the single server works fine. Threads and port can be configured in neo4j.properties or in the config-map passed to the database.

   cypher_remoting_address=:5555 # a hostname and port 
   cypher_remoting_threads=1 # number of threads 1 to 10

Ruby

# didn't work: 
sudo gem install zmq -- --with-zmq-dir=/usr/local/ --with-zmq-lib=/usr/local/lib/

# did work https://github.com/chuckremes/ffi-rzmq
sudo gem install ffi ffi-rzmq zmqmachine

Websockets

Alternatives, Resources

MessagePack

ZeroMQ

Alternatives:

cypher_remoting_experiments's People

Contributors

jexp avatar objectundefined avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.