Keeping the
Noisy Neighbors Happy
or
Multitenant Software Architecture
1
Eran Stiller
@eranstiller
Cloud Division Leader
Senior Software Architect
erans@codevalue.net
http://stiller.blog
2
The “Old” World
3
Sell a product!
The Cloud World
5
Multitenant Software as a Service (SaaS)
Reality Hits
6
To the Rescue
7
Agenda
8
Definitions Architectural
Issues
DevOps
Issues
What Is the Best Answer a Software Architect Can Give?
9
Disclaimer
This talk will NOT give you the answers
It will give you the questions you should ask
And hopefully answer
10
About Eran Stiller
Cloud Division Leader & Co-Founder at CodeValue
Software architect, consultant and instructor
Microsoft Azure MVP
Many years of hands-on experience
Expert in large-scale, server-side, highly-concurrent
systems
Co-Founder of Azure Israel Meetup
11
13
OzCode – Debug Like a WizardQuit debugging, spend more time writing brilliant software
With our Visual Studio extension for C#, follow the road to a bug-free world
oz-code.com | @oz_code
Magic Glance / Figure out complex expressionsLINQ Debugging / Know the flow of your LINQ queries
Reveal / Focus on data that actually matterSearch/ Find that needle in a haystack of data
What Is Multitenancy?
14
Multitenancy
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants. A tenant is a group of users who share a common access with
specific privileges to the software instance. With a multitenant
architecture, a software application is designed to provide every tenant
a dedicated share of the instance - including its data, configuration,
user management, tenant individual functionality and non-functional
properties. Multitenancy contrasts with multi-instance architectures,
where separate software instances operate on behalf of different
tenants.
Some commentators regard multitenancy as an important feature
of cloud computing.
15
- Wikipedia
Multitenancy
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants. A tenant is a group of users who share a common access with
specific privileges to the software instance. With a multitenant
architecture, a software application is designed to provide every tenant
a dedicated share of the instance - including its data, configuration,
user management, tenant individual functionality and non-functional
properties. Multitenancy contrasts with multi-instance architectures,
where separate software instances operate on behalf of different
tenants.
Some commentators regard multitenancy as an important feature
of cloud computing.
16
- Wikipedia
Multitenancy
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants. A tenant is a group of users who share a common access with
specific privileges to the software instance. With a multitenant
architecture, a software application is designed to provide every tenant
a dedicated share of the instance - including its data, configuration,
user management, tenant individual functionality and non-functional
properties. Multitenancy contrasts with multi-instance architectures,
where separate software instances operate on behalf of different
tenants.
Some commentators regard multitenancy as an important feature
of cloud computing.
17
- Wikipedia
Multitenancy
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants. A tenant is a group of users who share a common access with
specific privileges to the software instance. With a multitenant
architecture, a software application is designed to provide every tenant
a dedicated share of the instance - including its data, configuration,
user management, tenant individual functionality and non-functional
properties. Multitenancy contrasts with multi-instance architectures,
where separate software instances operate on behalf of different
tenants.
Some commentators regard multitenancy as an important feature
of cloud computing.
18
- Wikipedia
Multitenancy
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants. A tenant is a group of users who share a common access with
specific privileges to the software instance. With a multitenant
architecture, a software application is designed to provide every tenant
a dedicated share of the instance - including its data, configuration,
user management, tenant individual functionality and non-functional
properties. Multitenancy contrasts with multi-instance architectures,
where separate software instances operate on behalf of different
tenants.
Some commentators regard multitenancy as an important feature
of cloud computing.
19
- Wikipedia
Who Is the Tenant?
21
Who Is the Tenant?
22
Who Is the Tenant?
23
Who Is the Tenant?
24
Who Does the User Belong To?
25
Architectural Issues
26
Reference Architecture (Monolith)
27
Back-End API
Web SPA Mobile App
Blob
Storage
SQL
Redis
Cache
Reference Architecture (Microservices)
28
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Shared vs. Dedicated Resources
29
Shared Dedicated
Shared vs. Dedicated Resources
3030
Security & PrivacyCost
Why favor each?
Shared vs. Dedicated Resources
3232
Help me decide!
Shared vs. Dedicated Resources
Versioning Strategy
3333
Per Tenant Per Region Global
Shared vs. Dedicated Resources
3434
StatefulStateless
State Management
Shared vs. Dedicated Resources
Database
3535
Shared vs. Dedicated Resources
Cache
3636
Reference Architecture (Monolith)
37
Back-End API
Web SPA Mobile App
Blob
Storage
SQL
Redis
Cache
Per Tenant
Reference Architecture (Monolith)
38
Web SPA Mobile App
Blob
Storage
SQL
Redis Cache
T T
T T
Back-End API
Reference Architecture (Microservices)
39
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Per Tenant
Reference Architecture (Microservices)
40
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Shared vs. Dedicated Resources
Why not both Cost & Security on Azure?
41
Demo
42
Shared vs. Dedicated Resources
43
Shared Dedicated
Let the customer choose – “Premium” tier!
Shared vs. Dedicated Resources
Cross tenant operations / data?
4444
Onboarding & Provisioning
45
We need a way to onboard new customers
Onboarding & Provisioning
var storageManagementClient = new StorageManagementClient(credential)
{ SubscriptionId = subscriptionId };
Console.WriteLine("Creating the storage account...");
return await storageManagementClient.StorageAccounts.CreateAsync(
groupName,
storageName,
new StorageAccountCreateParameters()
{
Sku = new Microsoft.Azure.Management.Storage.Models.Sku()
{ Name = SkuName.StandardLRS},
Kind = Kind.Storage,
Location = location
}
);
46
Onboarding & Provisioning
47
We need a way to charge customers
Per Tenant
Reference Architecture (Monolith)
48
Web SPA Mobile App
Blob
Storage
SQL
Redis Cache
T T
T T
Back-End API
Per Tenant
Reference Architecture (Monolith)
49
Web SPA Mobile App
Blob
Storage
SQL
Redis Cache
T T
T T
Back-End API
Provisioning
Portal
Tenant
Provisioning
Per Tenant
Reference Architecture (Microservices)
50
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Per Tenant
Reference Architecture (Microservices)
51
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Provisioning
Portal
Provisioning
Service
Global Reach
52
Regional Tenants Global Tenants
Where are our tenants located?
Encryption
54
Encryption
private static async Task<TenantInfo> CreateTenantAsync(Guid id)
{
var containerName = $"tenant-{id}";
await CreateBlobContainerAsync(containerName);
var keyName = $"key-{id}";
var keyVaultClient = new KeyVaultClient(GetTokenAsync);
await keyVaultClient.CreateKeyAsync(KeyVaultUrl, keyName,
JsonWebKeyType.Rsa);
return new TenantInfo(id, containerName, keyName);
}
55
Encryption
private static async Task<CloudBlockBlob>
UploadBlobAsync(CloudBlobContainer container, IKey rsa)
{
BlobEncryptionPolicy policy = new BlobEncryptionPolicy(rsa, null);
BlobRequestOptions options = new BlobRequestOptions {
EncryptionPolicy = policy };
CloudBlockBlob blob = container.GetBlockBlobReference("MyFile.txt");
using (var stream = File.OpenRead("Data.txt"))
{
await blob.UploadFromStreamAsync(stream, stream.Length, null,
options, null);
}
return blob;
}
56
Infrastructure
58
Infrastructure
59
Infrastructure
Tenant Management Service
One place to secure
One place to access tenant configuration
60
Per Tenant
Reference Architecture (Monolith)
61
Web SPA Mobile App
Blob
Storage
SQL
Redis Cache
T T
T T
Back-End API
Provisioning
Portal
Tenant
Provisioning
Per Tenant
Reference Architecture (Monolith)
62
Web SPA Mobile App
Blob
Storage
SQL
Redis Cache
Tenant
Data
T T
T T
Provisioning
Portal
Back-End API
Tenant
Management
Per Tenant
Reference Architecture (Microservices)
63
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Provisioning
Portal
Provisioning
Service
Per Tenant
Reference Architecture (Microservices)
64
Reverse
Proxy
Web SPA Mobile App
Blob
Storage
Mongo
Redis
Cache
Message
Service
User Service
Auth Service
Mongo
Redis
Cache
Tenant
Management
Tenant
Data
Provisioning
Portal
DevOps Issues
65
67
Automate!
Monitoring
68
Monitoring
69
Demo
70
Takeaways
71
Carefully define the tenant boundaries
Invest in your architecture
Follow well known architecture patterns – to the extreme
Decide on shared vs. dedicated resources
Don’t forget to handle onboarding, provisioning & billing
Rock solid infrastructure is key
Monitor each and every tenant
Earn a lot of cash!
72
Thank You!
73
Eran Stiller
@eranstiller
Cloud Division Leader
Senior Software Architect
erans@codevalue.net
http://stiller.blog

Keeping the Noisy Neighbors Happy

  • 1.
    Keeping the Noisy NeighborsHappy or Multitenant Software Architecture 1 Eran Stiller @eranstiller Cloud Division Leader Senior Software Architect erans@codevalue.net http://stiller.blog
  • 2.
  • 3.
  • 4.
    The Cloud World 5 MultitenantSoftware as a Service (SaaS)
  • 5.
  • 6.
  • 7.
  • 8.
    What Is theBest Answer a Software Architect Can Give? 9
  • 9.
    Disclaimer This talk willNOT give you the answers It will give you the questions you should ask And hopefully answer 10
  • 10.
    About Eran Stiller CloudDivision Leader & Co-Founder at CodeValue Software architect, consultant and instructor Microsoft Azure MVP Many years of hands-on experience Expert in large-scale, server-side, highly-concurrent systems Co-Founder of Azure Israel Meetup 11
  • 11.
    13 OzCode – DebugLike a WizardQuit debugging, spend more time writing brilliant software With our Visual Studio extension for C#, follow the road to a bug-free world oz-code.com | @oz_code Magic Glance / Figure out complex expressionsLINQ Debugging / Know the flow of your LINQ queries Reveal / Focus on data that actually matterSearch/ Find that needle in a haystack of data
  • 12.
  • 13.
    Multitenancy The term "softwaremultitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant a dedicated share of the instance - including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants. Some commentators regard multitenancy as an important feature of cloud computing. 15 - Wikipedia
  • 14.
    Multitenancy The term "softwaremultitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant a dedicated share of the instance - including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants. Some commentators regard multitenancy as an important feature of cloud computing. 16 - Wikipedia
  • 15.
    Multitenancy The term "softwaremultitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant a dedicated share of the instance - including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants. Some commentators regard multitenancy as an important feature of cloud computing. 17 - Wikipedia
  • 16.
    Multitenancy The term "softwaremultitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant a dedicated share of the instance - including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants. Some commentators regard multitenancy as an important feature of cloud computing. 18 - Wikipedia
  • 17.
    Multitenancy The term "softwaremultitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. A tenant is a group of users who share a common access with specific privileges to the software instance. With a multitenant architecture, a software application is designed to provide every tenant a dedicated share of the instance - including its data, configuration, user management, tenant individual functionality and non-functional properties. Multitenancy contrasts with multi-instance architectures, where separate software instances operate on behalf of different tenants. Some commentators regard multitenancy as an important feature of cloud computing. 19 - Wikipedia
  • 18.
    Who Is theTenant? 21
  • 19.
    Who Is theTenant? 22
  • 20.
    Who Is theTenant? 23
  • 21.
    Who Is theTenant? 24
  • 22.
    Who Does theUser Belong To? 25
  • 23.
  • 24.
    Reference Architecture (Monolith) 27 Back-EndAPI Web SPA Mobile App Blob Storage SQL Redis Cache
  • 25.
    Reference Architecture (Microservices) 28 Reverse Proxy WebSPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache
  • 26.
    Shared vs. DedicatedResources 29 Shared Dedicated
  • 27.
    Shared vs. DedicatedResources 3030 Security & PrivacyCost Why favor each?
  • 28.
    Shared vs. DedicatedResources 3232 Help me decide!
  • 29.
    Shared vs. DedicatedResources Versioning Strategy 3333 Per Tenant Per Region Global
  • 30.
    Shared vs. DedicatedResources 3434 StatefulStateless State Management
  • 31.
    Shared vs. DedicatedResources Database 3535
  • 32.
    Shared vs. DedicatedResources Cache 3636
  • 33.
    Reference Architecture (Monolith) 37 Back-EndAPI Web SPA Mobile App Blob Storage SQL Redis Cache
  • 34.
    Per Tenant Reference Architecture(Monolith) 38 Web SPA Mobile App Blob Storage SQL Redis Cache T T T T Back-End API
  • 35.
    Reference Architecture (Microservices) 39 Reverse Proxy WebSPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache
  • 36.
    Per Tenant Reference Architecture(Microservices) 40 Reverse Proxy Web SPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache
  • 37.
    Shared vs. DedicatedResources Why not both Cost & Security on Azure? 41
  • 38.
  • 39.
    Shared vs. DedicatedResources 43 Shared Dedicated Let the customer choose – “Premium” tier!
  • 40.
    Shared vs. DedicatedResources Cross tenant operations / data? 4444
  • 41.
    Onboarding & Provisioning 45 Weneed a way to onboard new customers
  • 42.
    Onboarding & Provisioning varstorageManagementClient = new StorageManagementClient(credential) { SubscriptionId = subscriptionId }; Console.WriteLine("Creating the storage account..."); return await storageManagementClient.StorageAccounts.CreateAsync( groupName, storageName, new StorageAccountCreateParameters() { Sku = new Microsoft.Azure.Management.Storage.Models.Sku() { Name = SkuName.StandardLRS}, Kind = Kind.Storage, Location = location } ); 46
  • 43.
    Onboarding & Provisioning 47 Weneed a way to charge customers
  • 44.
    Per Tenant Reference Architecture(Monolith) 48 Web SPA Mobile App Blob Storage SQL Redis Cache T T T T Back-End API
  • 45.
    Per Tenant Reference Architecture(Monolith) 49 Web SPA Mobile App Blob Storage SQL Redis Cache T T T T Back-End API Provisioning Portal Tenant Provisioning
  • 46.
    Per Tenant Reference Architecture(Microservices) 50 Reverse Proxy Web SPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache
  • 47.
    Per Tenant Reference Architecture(Microservices) 51 Reverse Proxy Web SPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache Provisioning Portal Provisioning Service
  • 48.
    Global Reach 52 Regional TenantsGlobal Tenants Where are our tenants located?
  • 49.
  • 50.
    Encryption private static asyncTask<TenantInfo> CreateTenantAsync(Guid id) { var containerName = $"tenant-{id}"; await CreateBlobContainerAsync(containerName); var keyName = $"key-{id}"; var keyVaultClient = new KeyVaultClient(GetTokenAsync); await keyVaultClient.CreateKeyAsync(KeyVaultUrl, keyName, JsonWebKeyType.Rsa); return new TenantInfo(id, containerName, keyName); } 55
  • 51.
    Encryption private static asyncTask<CloudBlockBlob> UploadBlobAsync(CloudBlobContainer container, IKey rsa) { BlobEncryptionPolicy policy = new BlobEncryptionPolicy(rsa, null); BlobRequestOptions options = new BlobRequestOptions { EncryptionPolicy = policy }; CloudBlockBlob blob = container.GetBlockBlobReference("MyFile.txt"); using (var stream = File.OpenRead("Data.txt")) { await blob.UploadFromStreamAsync(stream, stream.Length, null, options, null); } return blob; } 56
  • 52.
  • 53.
  • 54.
    Infrastructure Tenant Management Service Oneplace to secure One place to access tenant configuration 60
  • 55.
    Per Tenant Reference Architecture(Monolith) 61 Web SPA Mobile App Blob Storage SQL Redis Cache T T T T Back-End API Provisioning Portal Tenant Provisioning
  • 56.
    Per Tenant Reference Architecture(Monolith) 62 Web SPA Mobile App Blob Storage SQL Redis Cache Tenant Data T T T T Provisioning Portal Back-End API Tenant Management
  • 57.
    Per Tenant Reference Architecture(Microservices) 63 Reverse Proxy Web SPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache Provisioning Portal Provisioning Service
  • 58.
    Per Tenant Reference Architecture(Microservices) 64 Reverse Proxy Web SPA Mobile App Blob Storage Mongo Redis Cache Message Service User Service Auth Service Mongo Redis Cache Tenant Management Tenant Data Provisioning Portal
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
    Takeaways 71 Carefully define thetenant boundaries Invest in your architecture Follow well known architecture patterns – to the extreme Decide on shared vs. dedicated resources Don’t forget to handle onboarding, provisioning & billing Rock solid infrastructure is key Monitor each and every tenant Earn a lot of cash!
  • 65.
  • 66.
    Thank You! 73 Eran Stiller @eranstiller CloudDivision Leader Senior Software Architect erans@codevalue.net http://stiller.blog

Editor's Notes

  • #3 Why are you all here? Image: https://pixabay.com/en/why-question-marks-unknown-ask-2028047/
  • #4 Images: https://pixabay.com/en/cabin-stone-cabin-nature-1257994/ https://pixabay.com/en/rock-island-illinois-house-home-123406/ https://pixabay.com/en/abandonded-interior-hdr-building-1017454/
  • #5 Images: https://pixabay.com/en/cabin-stone-cabin-nature-1257994/ https://pixabay.com/en/rock-island-illinois-house-home-123406/ https://pixabay.com/en/abandonded-interior-hdr-building-1017454/
  • #6 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #7 Image: https://pixabay.com/en/despair-alone-being-alone-archetype-513529/
  • #9 Image: https://pixabay.com/en/question-questions-the-question-mark-1969018/
  • #11 Free image: https://pixabay.com/en/question-mark-important-sign-1872634/
  • #22 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #23 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #24 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #25 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #26 Image: https://pixabay.com/en/buildings-town-cityscape-1245842/
  • #30 Free images: https://pixabay.com/en/master-bedroom-residence-home-house-2014865/ https://pixabay.com/en/mattress-camp-mountain-hut-436263/
  • #31 Free images: https://pixabay.com/en/application-money-1756279/ https://pixabay.com/en/padlocks-locks-for-bags-597815/
  • #32 https://pixabay.com/en/sign-sorry-character-figure-1719892/
  • #34 Free images: https://pixabay.com/en/facade-window-home-building-117288/ https://pixabay.com/en/globe-world-earth-planet-1290377/
  • #44 Free images: https://pixabay.com/en/master-bedroom-residence-home-house-2014865/ https://pixabay.com/en/mattress-camp-mountain-hut-436263/
  • #45 Free images: https://pixabay.com/en/pedestrian-crossing-traffic-sign-160672/
  • #54 How do you update a system running 24/7/365? How do you keep the application servers responsive? How do you keep all application servers synced? How do you update the data/schema? How do you update all your clients’ software? Web, Mobile, Desktop… How do you rollback on error? How do you rollback data? How do you know there is an error?
  • #55 Free image: https://pixabay.com/en/key-colorful-matching-number-74534/
  • #59 https://pixabay.com/en/programming-computer-environment-1857236/ https://pixabay.com/en/sign-sorry-character-figure-1719892/
  • #60 https://pixabay.com/en/programming-computer-environment-1857236/ https://pixabay.com/en/sign-sorry-character-figure-1719892/
  • #61 https://pixabay.com/en/programming-computer-environment-1857236/ https://pixabay.com/en/sign-sorry-character-figure-1719892/
  • #67 Free images: https://pixabay.com/en/facade-window-home-building-117288/ https://pixabay.com/en/globe-world-earth-planet-1290377/
  • #68 Free image: https://pixabay.com/en/iron-man-superhero-hero-toy-704046/
  • #69 Free image: https://pixabay.com/en/heartbeat-pulse-healthcare-medicine-163709/
  • #70 Fee image: https://pixabay.com/en/pinches-pins-useful-bed-bugs-656719/