GithubHelp home page GithubHelp logo

batchwriterservice's Introduction

Batch Writer Service

A POC Batch Writer Service for scaling Neo4j Writes

  1. Build it:

     mvn clean package
    
  2. Copy target/BatchWriterService-1.0-SNAPSHOT.jar to the plugins/ directory of your Neo4j server.

  3. Download and copy additional jars to the plugins/ directory of your Neo4j server.

     wget http://repo1.maven.org/maven2/joda-time/joda-time/2.3/joda-time-2.3.jar
     wget http://repo1.maven.org/maven2/com/google/guava/guava/17.0/guava-17.0.jar
    
  4. Configure Neo4j by adding a line to conf/neo4j-server.properties:

     org.neo4j.server.thirdparty_jaxrs_classes=com.neo4j.example.bws=/v1
    
  5. Start Neo4j server.

  6. Check that it is installed correctly over HTTP:

     :GET /v1/service/helloworld
    
  7. Warm up the database (optional, but recommended after a restart): This call will warm up the Neo4j Object Cache as well as warm up the content and user caches (see Step 9).

     :GET /v1/service/warmup
    
  8. Initialize the Database (Database migration): This call will create two unique index contraints, one on userId of User and one on url of Site.

     :GET /v1/service/initialize
    
  9. Create a View :POST /v1/service/{userId}/visited

     {"url" : "http://www.neo4j.com"}
    
  10. Get user Views :GET /v1/service/{userId}/visited

      ["http://www.neo4j.com"]
    
  11. Performance Testing:

To measure the requests per seconds by sending 20k post requests using 4 threads with keep-alive on to the same user/content pair:

     ab -k -n 20000 -c 4 -p params.json -T 'application/json' http://127.0.0.1:7474/v1/service/user123/visited

After a few runs, you should see something like:

     Requests per second:    5378.89 [#/sec] (mean)

To measure the requests per seconds by sending 20k get requests using 4 threads with keep-alive on to the same user/content pair:

    ab -k -n 20000 -c 4 http://127.0.0.1:7474/v1/service/user123/visited

After a few runs, you should see something like:

    Requests per second:    25037.21 [#/sec] (mean)

We are currently Caching userId to User Node and url to Site Node lookups.
The performance should reach these levels in a production deployment only after the initial period of loading.

  1. Asyncronous Batched Writes:

Working POC, will need to compare against single requests with load testing tool.

     :POST /v1/service/async/{userId}/visited {"url" : "http://www.neo4j.org"}

batchwriterservice's People

Contributors

maxdemarzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

atris

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.