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

Databases — the Choice Is Yours

Databases — the Choice Is Yours

In hardly any other area we’ve had as much change and improvement as in the field of databases. Just a few years ago everyone had “their” database that was used for each project. Today you are confronted with a variety of approaches and implementations.

We start off with a brief look at the theoretical background of distributed systems and databases in particular. After that, we discuss possible scenarios as well as the advantages and disadvantages of several databases:

* Why SQL is in fashion (again).
* Why MongoDB’s document structure fits object-oriented programming so well.
* How you can capture visitor hits with Redis efficiently.
* Why Cassandra is so scalable and fail-safe.
* How full-text search works with Elasticsearch.

The right choice of database(s) hasn’t become easier through the wide range of possibilities, but all the more interesting!

Philipp Krenn

May 28, 2017
Tweet

More Decks by Philipp Krenn

Other Decks in Programming

Transcript

  1. Beating the CAP Theorem Checklist Your ( ) tweet (

    ) blog post ( ) marketing material ( ) online comment advocates a way to beat the CAP theorem. Your idea will not work. http://ferd.ca/beating-the-cap-theorem-checklist.html
  2. abstract class Person { protected $name; } class Employee extends

    Person { protected $company; } class Manager extends Employee { protected $approveFunds; } class Worker extends Employee { protected $yearsExperience; }
  3. /** * @MappedSuperclass */ abstract class Person { /** @Id

    */ protected $id; /** @String */ protected $name; }
  4. /** * @Document(collection="person") * @InheritanceType("SINGLE_COLLECTION") * @DiscriminatorField(fieldName="type") * @DiscriminatorMap({ *

    "person"="Person", * "employee"="Employee", * "worker"="Worker" * }) */ class Employee extends Person { /** @String */ protected $company; }
  5. /** @Document */ class Manager extends Employee { /** @Boolean

    */ protected $approveFunds; } /** @Document */ class Worker extends Employee { /** @Integer */ protected $yearsExperience; }
  6. { "_id": ObjectId("5461c8bf9e2acf32ed50c079"), "name": "Peter", "company": "MongoDB", "approveFunds": true, "type":

    "manager" } { "_id": ObjectId("524d9fe7e4b0f8bd3031f84e"), "name": "Philipp", "company": "MongoDB", "yearsExperience": 10, "type": "worker" }
  7. HyperLogLog Unique elements in 12KB regardless of their number Error

    rate ~0,81% http://redis.io/commands/pfcount
  8. Eventually consistent was too hard, so we went with immediately

    inaccurate. — https://twitter.com/mysqlborat/status/621785755107524608
  9. Document Score Term Frequency (TF) / Inverse Document Frequency (IDF)

    Field-length norm https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html
  10. Credits Schnitzel https://flic.kr/p/9m27wm Architecture https://flic.kr/p/6dwCAe Conchita https://flic.kr/p/nBqSHT Consistent hashing https://

    highlyscalable.wordpress.com/2012/09/18/ distributed-algorithms-in-nosql-databases/ No, SQL https://twitter.com/edd/status/ 400190499585544192