Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ArangoDB & Rug-B

ArangoDB & Rug-B

Here are my slides from my talk at the Berlin Ruby Usergroup Rug-B.

Lucas Dohmen

December 05, 2013

More Decks by Lucas Dohmen

Other Decks in Programming


  1. Lucas Dohmen ‣ ArangoDB Core Team ‣ ArangoDB Foxx &

    Ruby Adapter ‣ Student on the master branch ‣ hacken.in & nerdkun.de ‣ Guest on Ruby Rogues \o/ 2 /\ (~( ) ) /\_/\ ( _-----_(@ @) ( \ / /|/--\|\ V " " " "
  2. Main Features 3 ‣ Open source and free ‣ Multi

    model database ‣ Convenient querying ‣ Extendable through JS ‣ High performance & space efficiency ‣ Easy to use ‣ Started in Sep 2011 ‣ Current Version: 1.4
  3. Why did we start ArangoDB? ‣ Experienced team building NoSQL

    DBs for more than 15 years ‣ Second Generation NoSQL DB ‣ Unique feature set ‣ Solves some problems of other NoSQL DBs 4
  4. Free and Open Source ‣ Apache 2 License ‣ On

    Github ‣ Do what you want with it ‣ ... and don‘t pay a dime!
  5. Key-Value Store ‣ Map value data to unique string keys

    (identifiers) ‣ Treat data as opaque (data has no structure) ‣ Can implement scaling and partitioning easily due to simplistic data model ‣ Key-value can be seen as a special case of documents. For many applications this is sufficient, but not for all cases.
  6. Document Store ‣ Normally based on key-value stores (each document

    still has a unique key) ‣ Allow to save documents with logical similarity in „collections“ ‣ Treat data records as attribute-structured documents (data is no longer opaque) ‣ Often allows querying and indexing document attributes
  7. ‣ Custom traversals and built-in graph algorithms ‣ Mostly Property

    Graphs ‣ Example: Computer Science Bibliography Graph Store
  8. *) Source: Martin Fowler, http://martinfowler.com/articles/nosql-intro.pdf Reporting RDBMS User activity log

    Cassandra Product Catalog MongoDB Analytics Cassandra Shopping Cart Riak Recommendations Neo4J Financial Data RDBMS User Sessions Redis Polyglot Persistence Example*
 Polyglot Persistence with ArangoDB Reporting RDBMS User activity log Cassandra Product Catalog ArangoDB Analytics Cassandra Shopping Cart ArangoDB Recommendations ArangoDB Financial Data ArangoDB User Sessions ArangoDB
  9. Convenient querying Different scenarios require different access methods: ‣ Query

    a document by its unique id / key: GET /_api/document/users/12345 ‣ Query by providing an example document: PUT /_api/simple/by-example { "name": "Jan", "age": 38 } ‣ Query via AQL: FOR user IN users FILTER user.active == true RETURN { name: user.name } ‣ Graph Traversals und JS for your own traversals ‣ JS Actions for “intelligent” DB request
  10. Other Document Stores ‣ MongoDB uses JSON/BSON ‣ Limited ‣

    Hard to read & write for more complex queries ‣ Complex queries, joins and transactions not possible ‣ CouchDB uses Map/Reduces ‣ It‘s not a relational algebra, and therefore hard to generate ‣ Not easy to learn (depending on where you’re coming from) ‣ Complex queries, cross collection joins and transactions not possible
  11. Example for Aggregation ‣ Retrieve cities with the number of

    users: FOR u IN users COLLECT city = u.city INTO g RETURN { "city" : city, "numUsersInCity": LENGTH(g) }
  12. Example for Graph Query ‣ Paths: FOR u IN users

    LET userRelations = ( FOR p IN PATHS( users, relations, "OUTBOUND" ) FILTER p._from == u._id RETURN p ) RETURN { "user" : u, "relations" : userRelations }
  13. Extendable through JavaScript ‣ Integrated JavaScript via Google’s V8 ‣

    Multi Collection Transactions ‣ Building small and efficient Apps - Foxx App Framework ‣ Individually Graph Traversals ‣ Cascading deletes/updates ‣ Assign permissions to actions ‣ Aggregate data from multiple queries into a single response ‣ Carry out data-intensive operations
  14. Action Server Some kind of Application Server ‣ Extend the

    HTTP based API of ArangoDB ‣ In ArangoDB you can extend the API of the database ‣ Write your own JavaScript functions (“actions”) that will be executed server-side ‣ Includes a permission system ‣ A framework called Foxx makes this simple ‣ You can even deactivate the normal API and talk to the database directly from the client
  15. High performance & space efficiency ‣ Automatic schema recognition ‣

    Performance oriented architecture with a C database core, a C++ communication layer, JS and C++ for additional functionality ‣ Performance critical points can be transformed to C oder C++ ‣ Let’s look at some stats
  16. Space Efficiency ‣ Measure the space on disk of different

    data sets ‣ First in the standard config, then with some optimisation ‣ We measured a bunch of different tasks
  17. Performance: Disclaimer ‣ Always take performance tests with a grain

    of salt ‣ Performance is very dependent on a lot of factors including the specific task at hand ‣ This is just to give you a glimpse at the performance ‣ Always do your own performance tests (and if you do, report back to us :) ) ‣ But now: Let‘s see some numbers
  18. Conclusion from Tests ‣ ArangoDB is really space efficient ‣

    ArangoDB is “fast enough” ‣ Please test it for your own use case
  19. ArangoDB & Ruby ‣ Ashikawa::Core is the low level driver

    for ArangoDB ‣ https://github.com/triagens/ashikawa-core ‣ Guacamole will be the ODM for Rails ‣ https://github.com/triagens/guacamole ‣ In an early stage
  20. ArangoDB.explain() { "type": "2nd generation NoSQL database", "model": [ "document",

    "graph", "key-value" ], "openSource": true, "license“: "apache 2", "version": [ "1.3 stable", "1.4 alpha" ], "builtWith": [ "C", "C++", "JS" ], "uses": [ "Google V8" ], "mainFeatures": [ "Multi-Collection-Transaction", "Foxx API Framework", "ArangoDB Query Language", "Various Indexes", "API Server", "Automatic Schema Recognition" ] }