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

In-memory database

In-memory database

A slide about Aerospike and Apache Ingnite

Dang Chien Nguyen

May 04, 2016
Tweet

Other Decks in Technology

Transcript

  1. Problems - Multiple Redis instances on 1 server - Each

    instance contains some types of data - 200000 users active /s - About 5 milions records in memory - Master-Slave structures * Redis 1 instances → 1 core → Bottleneck read/write * No cluster * Scale out ???
  2. Requirements • Horizontal Scale • Fast read for real time

    access • Use full core of CPU • High availability
  3. Aerospike • Written in C • Opensource • Community Edition

    (free) and Enterprise Edititon • 1177 stars on Github
  4. Aerospike • Sharding supported • ACID (Atomicity, Consistency, Isolation, Durability)

    • Data can be saved to disk or RAM or hybrid storage (indexes in RAM, data in disk) • Self managing • Optimized for SSD • Reduce money (Less server, SSD is more cheaper than RAM) • Proved by AppNexus, Inmobi,...
  5. Aerospike • Multicast • No master/slave node. Each node contains

    some different primary shards and some different replica shards
  6. Namespace – 1 database = many namespaces – How data

    is stored: RAM or DISK – How many replicas – When record expire
  7. Record • Key • Meta-data (generation, time to live) •

    Bins (1 or more bins) → as rows and their value in DBMS
  8. Apache Ignite Many features • Written in java • In-memory

    database • Data grid • Accelator for Hadoop and Spark ….
  9. Indexed SQL Query • SparkSQL does not index RDD •

    IgniteSQL can index its cached data by field or using lucene index for text. Examples: val cacheRdd = igniteContext.fromCache("partitioned") cacheRdd.savePairs(sparkContext.parallelize(1 to 10000, 10).map(i => (i, i))) val cacheRdd = igniteContext.fromCache("partitioned") val result = cacheRdd.sql( "select _val from Integer where val > ? and val < ?",10,100)
  10. public class Person implements Serializable { /** Person ID (indexed).

    */ @QuerySqlField(index = true) private long id; /** First name (not-indexed). */ @QuerySqlField private String name; /** Resume text (create LUCENE-based TEXT index for this field). */ @QueryTextField private String resume; /** Salary (indexed). */ @QuerySqlField(index = true) private double salary; ….. }