Технологии и разработка СУБД
Введение в распределенные системы
Анастасия Лубенникова
Александр Алексеев
В этой лекции
Материала много
Движение NoSQL
Johan Oskarsson, then a developer at Last.fm, reintroduced the term NoSQL in early 2009 when he organized an event to discuss "open source distributed, non relational databases".
В чем идея NoSQL баз данных
PACELC (a.k.a CAP-теорема)
To me, CAP should really be PACELC --- if there is a partition (P) how does the system tradeoff between availability and consistency (A and C); else (E) when the system is running as normal in the absence of partitions, how does the system tradeoff between latency (L) and consistency (C)?
http://dbmsmusings.blogspot.ru/2010/04/problems-with-cap-and-yahoos-little.html
CAP: неправильное объяснение
CRDT & Eventual Consistency
Сonflict-free replicated data type (CRDT) is a data structure which can be replicated across multiple computers in a network, where the replicas can be updated independently and concurrently without coordination between the replicas, and where it is always mathematically possible to resolve inconsistencies which might result.
https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type
Is it better to be alive and wrong or right and dead?
— Jay Kreps, A Few Notes on Kafka and Jepsen (2013)
Векторные часы
Gossip Protocol
Jepsen
Пара слов о современном железе: RAM
[1]: https://aws.amazon.com/ec2/pricing/on-demand/
[2]: https://aws.amazon.com/ec2/instance-types/x1e/
[3]: https://www.theregister.co.uk/2017/05/16/aws_ram_cram/
Пара слов о современном железе: жесткие диски
[1]: Samsung MZ-75E1T0BW, https://market.yandex.ru/product/11929060
Виды NoSQL баз данных
Чуть подробнее: Memcached
Чуть подробнее: Redis
Чуть подробнее: Riak
[1]: http://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf
Protobuf (1 / 2)
message Person {
required string user_name = 1;
optional int64 favorite_number = 2;
repeated string interests = 3;
}
Protobuf (1 / 2)
message Person {
required string user_name = 1;
optional int64 favorite_number = 2;
repeated string interests = 3;
}
Fun fact! В Protobuf 3 все
поля всегда optional.
Protobuf (2 / 2)
Protobuf (2 / 2)
Fun fact! Поле можно сделать�repeated, не сломав обратную�совместимость
See Also
Riak: ring & vnodes
Riak: Merkle Tree (a.k.a. Hash Tree)
Чуть подробнее: MongoDB
MongoDB: примеры запросов
> db.urls.insert({ code: 123, url: "https://google.com/" });
> db.urls.find();
> db.urls.ensureIndex({ code: 1 }, { unique: true });
> db.urls.getIndexes();
> db.urls.dropIndex({ code: 1 });
> db.urls.update({ code: 123 }, { url: "http://example.ru/" });
> db.urls.remove({ code: 123 });
Чуть подробнее: Couchbase
Чуть подробнее: ClickHouse
Чуть подробнее: Cassandra
Seastar (1 / 2)
Seastar (2 / 2)
Пока что не занесли нормальной поддержки CMake :(
Чуть подробнее: ElasticSearch
Kibana
Чуть подробнее: RabbitMQ
RabbitMQ: иллюстрация
Транзакции в мире NoSQL
Можно сделать разными способами.
Чем плох 2PC?
NewSQL базы данных
Как традиционные РСУБД, только распределенные и шардированные.
Примеры NewSQL баз данных
Чуть подробнее: CochroachDB
Чуть подробнее: Amazon Aurora
[1]: с ноября 2016 https://news.ycombinator.com/item?id=13072861
[2]: http://www.allthingsdistributed.com/files/p1041-verbitski.pdf
Дополнительные материалы
Рекомендуемые книги
Рекомендуемые блоги
Вопросы и ответы.