Slide 1

Slide 1 text

Multi-Tenant (SaaS) Uygulama Geliştirme Ahmet Pirimoğlu Abis Teknoloji

Slide 2

Slide 2 text

"Bir Yazılımın Anatomisi" Hikayesi

Slide 3

Slide 3 text

Karakterlerimiz Yazılımcı Ahmet

Slide 4

Slide 4 text

Karakterlerimiz Galerici Mesut

Slide 5

Slide 5 text

Bana web sitesi lazım Elimdeki arabaları siteye gireyim Kime satmışım ne zaman satmışım siteye gireyim Borçlarımı alacaklarımı tutayım Girilen arabalar siteye girenlere caf caflı gösterilsin

Slide 6

Slide 6 text

Hallederiz abi (Paradan haber ver) Veritabanı Web Uygulaması galericimesut.com

Slide 7

Slide 7 text

Mesut Abimiz Mutlu

Slide 8

Slide 8 text

Yeni Karakterimiz Galerici Niyazi

Slide 9

Slide 9 text

Hallederiz abi Veritabanı Web Uygulaması galericimesut.com Veritabanı Web Uygulaması galericiniyazi.com

Slide 10

Slide 10 text

Ek İstekler Galerici Mesut Abi Araç sattığım kişilere yeni gelen ilgilenebilecekleri araçları e-posta ve sms atayım Galerici Niyazi Abi Müşterilerimi e- posta ve sms atarak rahatsız etmek istemem Sahibinden.com ile işim olmaz çok komisyon alıyor Sahibinden.com ile entegrasyon kuralım, araçları oraya aktarsın

Slide 11

Slide 11 text

5 sene sonra

Slide 12

Slide 12 text

Yazılımcı Ahmet

Slide 13

Slide 13 text

Çare SaaS

Slide 14

Slide 14 text

Farkları Neler Geleneksel  Müşteriye özel kurulum  Müştenin sağladığı ortamda çalışır, müşteriye özeldir  Kod yönetimi ve kod güncellemek sorundur  Bakım ve donanım maliyetleri Software as a Service (SaaS)  İnternet üzerinden erişilen merkezi uygulamadır  Bir çok müşterinin uygulamaya erişirken tek kod kaynağı üzerinden çalışması sağlanır  Bir müşteri için çözdüğün sorun tüm müşterilerde çözülmüş olur  Cloud hizmetler kullanılarak maliyet kazancı

Slide 15

Slide 15 text

Multi-tenancy nedir? SaaS uygulamalar multi-tenant mimari üzerine kuruludur Örnek: confluence https://www.atlassian.com/softw are/confluence

Slide 16

Slide 16 text

Multi-tenancy nasıl oluşturulur? Uygulama Veritabanı Kod Yönetimi Özelleştirmeler

Slide 17

Slide 17 text

Uygulama Yönetimi

Slide 18

Slide 18 text

Veritabanı Tasarımı  Single Database  Single Database, Multiple Scheme  Single Master DB, Multiple Tenant Database  Multiple Database

Slide 19

Slide 19 text

Veritabanı Tasarımı - Single Database (all tenants in one database)

Slide 20

Slide 20 text

Veritabanı Tasarımı - Single Database (all tenants in one database)

Slide 21

Slide 21 text

Veritabanı Tasarımı - Single Database (all tenants in one database) Faydaları  Ease of implementation  Fast deployment Zararları  Isolation  You have to actively do filtering all the time.  Security  You have to let all tenants access the data, security is in the app logic level.  Customizability – Extensibility  In a shared environment it is hard to do a lot of extensibility in the data, because each client is stepping on each other toes.  Backup / Maintainability  Scalability  Database Pooling  Partitional Table / Seperate Schema  Billing & Costs  Versioning

Slide 22

Slide 22 text

Veritabanı Tasarımı - Isolated Databases (Single Database /Scheme Per Tenant)

Slide 23

Slide 23 text

Veritabanı Tasarımı - Isolated Databases (Single Database /Scheme Per Tenant) Faydaları  Scalability  Security  Custom schema for tenant  Ease of migration old applications to multitenant approach Zararları  Uneven distribution of data  Reporting  Increased required resources  Maintenance  Difficult deployment and maintenance  Database Migrations

Slide 24

Slide 24 text

Veritabanı Tasarımı - Single Master DB, Multiple Tenant Database Host Database Tenants Users Subscriptions Tenant Database Products ProductCategories Separate Host and Tenant Application

Slide 25

Slide 25 text

EF Sample - Separate Databases

Slide 26

Slide 26 text

EF Sample - Shared Database Separate Schemas

Slide 27

Slide 27 text

EF Sample - Shared Database, Shared Schema

Slide 28

Slide 28 text

EF Sample - Shared Database, Shared Schema  EF Core – Query Filter  Entity Framework Plus  https://entityframework-plus.net/query-filter

Slide 29

Slide 29 text

EF Sample - Shared Database, Shared Schema  AspNetBoilerplate – Multi Tenancy  Automatic Data Filtering  https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy

Slide 30

Slide 30 text

SaaSKit  SaasKit is a .NET toolkit for building SaaS (Software As A Service) applications.  https://github.com/saaskit/saaskit/wiki/SaasKit-Multitenancy

Slide 31

Slide 31 text

Cache  Tek uygulama varsa cache tekil olacak  Tüm tenant lar için ortak cache olacak  Çözüm olarak cache key ine tenantId yi de vermek gerekiyor  Key: "Products.134"  Values: ....

Slide 32

Slide 32 text

İdeal Mimari Hangisi?

Slide 33

Slide 33 text

Geliştirme Ortamı - Tenant Based Branch

Slide 34

Slide 34 text

Geliştirme Ortamı - Tenant Based Branch Faydaları  Dedicated changes for tenants  Handling common changes  Code security Zararları  Deployment process  Maintenance  Changes management

Slide 35

Slide 35 text

Geliştirme Ortamı - Single Codebase

Slide 36

Slide 36 text

Geliştirme Ortamı - Single Codebase Faydaları  Easier deployment  Possibility of custom changes Zararları  All of the code in single repository  Difficult to implement custom feature

Slide 37

Slide 37 text

Özelleştirme İhtiyacı Configuration Values  Şirket logosu  Özelleştirilmiş yazılar  Özelliklerin açıp kapatılması  Feature Flags Customize Business Process  Plug-in architecture (Dependency Injection)  Versioning  Single instance -> Container  Rules Engine

Slide 38

Slide 38 text

Feature Flags  https://aspnetboilerplate.com/Pages/Documents/Feature-Management

Slide 39

Slide 39 text

Rule Engines

Slide 40

Slide 40 text

Customize Themes  Müşteriye özel arayüz

Slide 41

Slide 41 text

Teşekkürler  Multi-Tenant Data Architecture http://msdn.microsoft.com/en- us/library/aa479086.aspx  Developing Multi-tenant Applications for the Cloud, 3rd Edition http://msdn.microsoft.com/en-us/library/ff966499.aspx  Berkeley University SaaS presentation http://bit.ly/1qlSQ56  Database design in SaaS platform http://labs.octivi.com/database-design-in- saas-platforms/  Multi Tenancy -The Physical Data Model http://ayende.com/blog/3497/multi- tenancy-the-physical-data-model  Development strategies for multitenant platforms http://labs.octivi.com/development-strategies-for-multitenant-platforms/  Multi Tenancy - Approaches and Applicability http://ayende.com/blog/3530/multi-tenancy-approaches-and-applicability  Devnot TV - Multi-tenant (SaaS) Uygulama Geliştirme https://www.youtube.com/watch?v=i4EsP1cN64g  Multi-tenancy - single database vs multiple database https://softwareengineering.stackexchange.com/questions/141261/multi- tenancy-single-database-vs-multiple-database  Entity Framework Multitenancy https://weblogs.asp.net/ricardoperes/entity- framework-multitenancy