Creating data-centric microservices Michael Hackstein @mchacki
‣ Monolithic large applications ‣ Run on single server ‣ Loose coupling (object orientation) 2
‣ Few lines of Code ‣ Independently Scalable ‣ Design for failure ‣ Self-handled Persistence ‣ http://martinfowler.com/articles/microservices. html 3
‣ Communication with database ‣ Data-intensive operations ‣ Encapsulate data model 4 μS μS μS
‣ Customize ArangoDB ‣ Abstract from the database ‣ Encapsulate data transformation ‣ Integrate it as a microservice 5 / (~( ) ) /_/ ( _-----_(@ @) ( / /|/--| V " " " "
‣ Medical data ‣ requires attribute level security ‣ Nurse and Doctor both read the patient file ‣ Some information should not be read- / writeable for the nurse ‣ Session Service ‣ Simple logic ‣ High dependency on database ‣ Social Data Sharing ‣ User defines which content is shared ‣ Join access rights with data ‣ Likely to collect insufficient amount of data 6
‣ Direct data access ‣ Control outgoing data ‣ Speed improvements 7
‣ Access patterns are complicated ‣ Easier defined in code ‣ Attribute-Level possible ‣ Pattern described by other data ‣ Use startup options: ‣ -- server.authenticate-system-only true ‣ -- server.disable-authentication false ‣ Database user have full access ‣ Foxx users have restricted access ‣ Foxx users != Database users 8
‣ Cleaner code separation ‣ Do not pollute your application code ‣ Move query strings behind the API ‣ Convert data on the fly ‣ No additional update request 9
10 ArangoDB Foxx
Foxx 11 ArangoDB Manifest Collection Controller
{ "name": "aardvark", "description": "ArangoDB Admin Web Interface", "author": "ArangoDB GmbH", "version": "1.0", "license": "Apache License, Version 2.0“, "controllers": { "/": "controller.js“ } "files": { "/favicon.ico" : "favicon.ico“} } 12
var FoxxController = require("org/arangodb/foxx").Controller, controller = new FoxxController(applicationContext), db = require("internal").db; /** Short description * Long description */ controller.get("byId/:id“, function(req, res) { var id = req.params("id"); var doc = db.myCollection.document(id); res.json(doc); }.errorResponse(ArangoError, 404, "Document not found“) .pathParam("id", type: joi.string().required().description("Doc id“); 13
‣ How to get started? ‣ Generator in Web Interface ‣ ArangoDB store ‣ https://www.arangodb.com/tutorial-foxx/ 14
‣ More features? ‣ Authentication (classic or oauth) ‣ Repository + Models for schema checking ‣ API-Keys 15
‣ Image links ‣ http://static.tvtropes.org/pmwiki/pub/images/ data4_2257.jpg ‣ http://3.bp.blogspot.com/-EVRkrp-kJ4A/T9EDtL5MGKI/ AAAAAAAAGwg/g_Qvvvs6LdM/s400/soc.jpg ‣ http://www.safetysign.com/images/catlog/product/ large/F7877-restricted-area-do-not-enter-sign.png ‣ http://www.photoeverywhere.co.uk/britain/westernisles/ stonecircle_callanish3715.jpg ‣ http://upload.wikimedia.org/wikipedia/commons/d/d5/ UIUC_Arboretum_20070923_img_1946.jpg 16

Creating data centric microservices

  • 1.
  • 2.
    ‣ Monolithic largeapplications ‣ Run on single server ‣ Loose coupling (object orientation) 2
  • 3.
    ‣ Few linesof Code ‣ Independently Scalable ‣ Design for failure ‣ Self-handled Persistence ‣ http://martinfowler.com/articles/microservices. html 3
  • 4.
    ‣ Communication withdatabase ‣ Data-intensive operations ‣ Encapsulate data model 4 μS μS μS
  • 5.
    ‣ Customize ArangoDB ‣Abstract from the database ‣ Encapsulate data transformation ‣ Integrate it as a microservice 5 / (~( ) ) /_/ ( _-----_(@ @) ( / /|/--| V " " " "
  • 6.
    ‣ Medical data ‣requires attribute level security ‣ Nurse and Doctor both read the patient file ‣ Some information should not be read- / writeable for the nurse ‣ Session Service ‣ Simple logic ‣ High dependency on database ‣ Social Data Sharing ‣ User defines which content is shared ‣ Join access rights with data ‣ Likely to collect insufficient amount of data 6
  • 7.
    ‣ Direct dataaccess ‣ Control outgoing data ‣ Speed improvements 7
  • 8.
    ‣ Access patternsare complicated ‣ Easier defined in code ‣ Attribute-Level possible ‣ Pattern described by other data ‣ Use startup options: ‣ -- server.authenticate-system-only true ‣ -- server.disable-authentication false ‣ Database user have full access ‣ Foxx users have restricted access ‣ Foxx users != Database users 8
  • 9.
    ‣ Cleaner codeseparation ‣ Do not pollute your application code ‣ Move query strings behind the API ‣ Convert data on the fly ‣ No additional update request 9
  • 10.
  • 11.
  • 12.
    { "name": "aardvark", "description": "ArangoDBAdmin Web Interface", "author": "ArangoDB GmbH", "version": "1.0", "license": "Apache License, Version 2.0“, "controllers": { "/": "controller.js“ } "files": { "/favicon.ico" : "favicon.ico“} } 12
  • 13.
    var FoxxController =require("org/arangodb/foxx").Controller, controller = new FoxxController(applicationContext), db = require("internal").db; /** Short description * Long description */ controller.get("byId/:id“, function(req, res) { var id = req.params("id"); var doc = db.myCollection.document(id); res.json(doc); }.errorResponse(ArangoError, 404, "Document not found“) .pathParam("id", type: joi.string().required().description("Doc id“); 13
  • 14.
    ‣ How toget started? ‣ Generator in Web Interface ‣ ArangoDB store ‣ https://www.arangodb.com/tutorial-foxx/ 14
  • 15.
    ‣ More features? ‣Authentication (classic or oauth) ‣ Repository + Models for schema checking ‣ API-Keys 15
  • 16.
    ‣ Image links ‣http://static.tvtropes.org/pmwiki/pub/images/ data4_2257.jpg ‣ http://3.bp.blogspot.com/-EVRkrp-kJ4A/T9EDtL5MGKI/ AAAAAAAAGwg/g_Qvvvs6LdM/s400/soc.jpg ‣ http://www.safetysign.com/images/catlog/product/ large/F7877-restricted-area-do-not-enter-sign.png ‣ http://www.photoeverywhere.co.uk/britain/westernisles/ stonecircle_callanish3715.jpg ‣ http://upload.wikimedia.org/wikipedia/commons/d/d5/ UIUC_Arboretum_20070923_img_1946.jpg 16