尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Мікросервіси і
розподілені бази
як обслуговувати тисячі баз і
не зійти з розуму
Kyrylo Melnychuk
CTO @
Про мене
Кирило Мельничук, CTO
Собаковод
20 років в IT
20 відтінків волосся
Люблю вигадувати
роботу
Про що це все?
Як ми проєктували
наш сервіс
Чому ми вирішили
розділяти бази даних?
Що вийшло
І що ж там далі?
Дещиця
попереднього досвіду
Трошки про нас
Український стартап, нам 1 рік
5000 клієнтів, 1500 активних
Startup of the Year 2023
62 мікросервіса
10 мікросервісів з БД
PHP/Golang/Typescript
3 EKS кластера
Вимоги до
масштабованості
• 1 млн+ просторів
• 50 користувачів на простір
• Десятки тисяч записів в БД просторів
• Можливості кастомних полів у кожного простору
• Можливість географічного розділення
• Нові сервіси постійно додаються
• Існуючі сервіси постійно розвиваються
• Бекапи мінімум 1 раз на день
• Можливість швидко відновити БД простору
• Можливість швидкого переносу між регіонами
Managed, AWS Aurora,
Multi-AZ
MySQL чи PostgreSQL?
Проєктуємо БД
Монобаза
Шарди
NewSQL
Multitenancy
Монобаза
Дуже швидко і звично розробникам
Найпростіший сетап і підтримка
Складна логіка кастомних полів
Лежить база –> лежать всі
Негнучкий скейл, бекапи, переноси…
Як адмініструвати
MySQL-моноліт в
100Тб+?
*ніяк
Шарди
Швидко і звично розробникам
Складний сетап, підтримка – пекло
Така ж складна логіка кастомних полів
Лежить база –> лежать (частково)всі
+- ок скейл, бекапи, переноси
NewSQL (Vitess)
NewSQL
Швидко і звично розробникам
Складний сетап, суцільні підводні камені
Проста логіка кастомних полів
Лежить 1 база –> лежить 1 простір
Простий скейл, бекапи, переноси
Multitenancy
Складніше і незвичніше розробникам
Легкий сетап, зрозуміла підтримка
Дуже просто з кастомними полями (і не тільки)
Лежить база –> лежить 1 простір (або сервіс)
Зрозумілий скейл, бекапи, переноси
(але оверхед на конектах)
Деталі
реалізації
Варіанти
Моноліт + монобази під кожен простір
MSA + монобази
Мікросервіси + монобази
Мікросервіси + окремі бази
А не дорого?
Загальна архітектура
Як розподіляються бази
Скільки баз на сервері?
Створення нового
простору
Роутинг запиту
Міграції, сідери
artisan-команда з контекстом
python-скрипт, послідовно перебирає бази
міграції вбудовані в github actions
Балансування
Моніторимо навантаження на сервери
Аномальні переносимо
Колись автоматизуємо J
Приємності
Дані клієнтів фізично відокремлені
Прості бекапи і відновлення
Просте балансування навантаження
Простий інструментарій
Легкі часткові зміни, blue-green на рівні баз
Дуже гнучкий тюнинг
Проблеми і складності
Постійний контроль цілісності
Складність міграцій та сідингу
Складніша розробка і дебаг
Буде цікавий досвід скейлу =)
Що далі?
Автоматичне балансування з переїздом баз
Автоматичне розгортання нових
Сідинг в github actions
Підтримка NoSQL
І ще щось, про що ми поки не в курсі)
Дякую! Питання?
uspacy.com

More Related Content

Similar to "Microservices and multitenancy - how to serve thousands of databases in one microservice without going crazy?", Kyrylo Melnychuk

Version control
Version controlVersion control
Version control
eleksdev
 
Html5 - ready yet?(ukr)
Html5 - ready yet?(ukr)Html5 - ready yet?(ukr)
Html5 - ready yet?(ukr)
Markiyan Matsekh
 
Aws - Marfej
Aws - MarfejAws - Marfej
Aws - Marfej
Igor Bronovskyy
 
"Rethinking Continuous Delivery", Andrii Nasinnyk
"Rethinking Continuous Delivery",  Andrii Nasinnyk"Rethinking Continuous Delivery",  Andrii Nasinnyk
"Rethinking Continuous Delivery", Andrii Nasinnyk
Fwdays
 
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk "Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
Fwdays
 
Vue.js
Vue.jsVue.js
Lec15 архiтектура та проектування компонентних систем
Lec15 архiтектура та проектування компонентних системLec15 архiтектура та проектування компонентних систем
Lec15 архiтектура та проектування компонентних систем
cit-cit
 
Rpc
RpcRpc
"Instant loading: Improving your website speed", Yozhef Hisem
"Instant loading: Improving your website speed",  Yozhef Hisem"Instant loading: Improving your website speed",  Yozhef Hisem
"Instant loading: Improving your website speed", Yozhef Hisem
Fwdays
 
[Knowledge Sharing] - Microservices Intro + Communication Patterns
[Knowledge Sharing] - Microservices Intro + Communication Patterns[Knowledge Sharing] - Microservices Intro + Communication Patterns
[Knowledge Sharing] - Microservices Intro + Communication Patterns
Exoft LLC
 
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ..."Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
Fwdays
 
Sql db
Sql dbSql db
Db design (ukr)
Db design (ukr)Db design (ukr)
Db design (ukr)
Anatoliy Okhotnikov
 
HTML5 SVG Graphics @ Javascript Directions
HTML5 SVG Graphics @ Javascript DirectionsHTML5 SVG Graphics @ Javascript Directions
HTML5 SVG Graphics @ Javascript DirectionsTiang Cheng
 
Тема 6. Системи зберігання даних. Віртуалізація сховища даних
Тема 6. Системи  зберігання  даних.  Віртуалізація  сховища  данихТема 6. Системи  зберігання  даних.  Віртуалізація  сховища  даних
Тема 6. Системи зберігання даних. Віртуалізація сховища даних
Oleg Nazarevych
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
Pavel Bashmakov
 
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
Fwdays
 
Microsoft Azure для розробників та стартапів
Microsoft Azure для розробників та стартапівMicrosoft Azure для розробників та стартапів
Microsoft Azure для розробників та стартапів
Kyrylo Bezpalyi
 

Similar to "Microservices and multitenancy - how to serve thousands of databases in one microservice without going crazy?", Kyrylo Melnychuk (19)

Version control
Version controlVersion control
Version control
 
Html5 - ready yet?(ukr)
Html5 - ready yet?(ukr)Html5 - ready yet?(ukr)
Html5 - ready yet?(ukr)
 
Aws - Marfej
Aws - MarfejAws - Marfej
Aws - Marfej
 
"Rethinking Continuous Delivery", Andrii Nasinnyk
"Rethinking Continuous Delivery",  Andrii Nasinnyk"Rethinking Continuous Delivery",  Andrii Nasinnyk
"Rethinking Continuous Delivery", Andrii Nasinnyk
 
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk "Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
"Vulnerabilities Analysis: Corporate DevSec Practices", Sergii Kulyk
 
Vue.js
Vue.jsVue.js
Vue.js
 
Lec15 архiтектура та проектування компонентних систем
Lec15 архiтектура та проектування компонентних системLec15 архiтектура та проектування компонентних систем
Lec15 архiтектура та проектування компонентних систем
 
Rpc
RpcRpc
Rpc
 
"Instant loading: Improving your website speed", Yozhef Hisem
"Instant loading: Improving your website speed",  Yozhef Hisem"Instant loading: Improving your website speed",  Yozhef Hisem
"Instant loading: Improving your website speed", Yozhef Hisem
 
[Knowledge Sharing] - Microservices Intro + Communication Patterns
[Knowledge Sharing] - Microservices Intro + Communication Patterns[Knowledge Sharing] - Microservices Intro + Communication Patterns
[Knowledge Sharing] - Microservices Intro + Communication Patterns
 
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ..."Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
"Simplifying the Complex: Effective Management of Large-Scale PHP Projects", ...
 
Sql db
Sql dbSql db
Sql db
 
MOM
MOMMOM
MOM
 
Db design (ukr)
Db design (ukr)Db design (ukr)
Db design (ukr)
 
HTML5 SVG Graphics @ Javascript Directions
HTML5 SVG Graphics @ Javascript DirectionsHTML5 SVG Graphics @ Javascript Directions
HTML5 SVG Graphics @ Javascript Directions
 
Тема 6. Системи зберігання даних. Віртуалізація сховища даних
Тема 6. Системи  зберігання  даних.  Віртуалізація  сховища  данихТема 6. Системи  зберігання  даних.  Віртуалізація  сховища  даних
Тема 6. Системи зберігання даних. Віртуалізація сховища даних
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
"Drizzle: What Is It All About?", Alex Blokh, Dan Kochetov
 
Microsoft Azure для розробників та стартапів
Microsoft Azure для розробників та стартапівMicrosoft Azure для розробників та стартапів
Microsoft Azure для розробників та стартапів
 

More from Fwdays

"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
Fwdays
 
"Reaching 3_000_000 HTTP requests per second — conclusions from participation...
"Reaching 3_000_000 HTTP requests per second — conclusions from participation..."Reaching 3_000_000 HTTP requests per second — conclusions from participation...
"Reaching 3_000_000 HTTP requests per second — conclusions from participation...
Fwdays
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh
Fwdays
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
Fwdays
 
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
Fwdays
 
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
Fwdays
 
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
Fwdays
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
Fwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Fwdays
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
 

More from Fwdays (20)

"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
"Black Monday: The Story of 5.5 Hours of Downtime", Dmytro Dziubenko
 
"Reaching 3_000_000 HTTP requests per second — conclusions from participation...
"Reaching 3_000_000 HTTP requests per second — conclusions from participation..."Reaching 3_000_000 HTTP requests per second — conclusions from participation...
"Reaching 3_000_000 HTTP requests per second — conclusions from participation...
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
 
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
 
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
 
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

"Microservices and multitenancy - how to serve thousands of databases in one microservice without going crazy?", Kyrylo Melnychuk

  翻译: