creating data centric microservices

16
Creating data-centric microservices Michael Hackstein @mchacki

Upload: arangodb

Post on 18-Jul-2015

321 views

Category:

Data & Analytics


0 download

TRANSCRIPT

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