RAINER STROPEK | SOFTWARE ARCHITECTS GMBHSource: http://www.flickr.com/photos/fatboyke/2617432325/Catching The Long Tail W...
INTRODUCTIONAbstract“Software as a Service” (SaaS) is a software distribution model that usesthe Internet to deploy, maint...
INTRODUCTIONIntroduction• software architects gmbh• Rainer Stropek    – Developer, Speaker, Trainer    – MVP for Windows A...
INTRODUCTIONGoals• Why should I care?• What does multi-tenancy + SaaS mean?• How can the problems be solved?• This is an a...
Why should I care?
WHY SHOULD I CARE?Source: http://www.flickr.com/photos/spursfan_ace/2328879637/             Rules Are Changing            ...
WHY SHOULD I CARE?Where We Come From                    Customer        Dev Team        Close     Relationship            ...
WHY SHOULD I CARE?Where Many Of Us Are Today                    External/New                     Customers   Kunde   Kunde...
WHY SHOULD I CARE?Where We Want To Be   Off-The-Shelf     Product                   Customer                              ...
WHY SHOULD I CARE?Catching The Long Tail The Long Tail http://www.wired.com/wired/archive/12.10/tail.html, Amazon Free: Th...
WHY SHOULD I CARE?Source: http://www.flickr.com/photos/mava/2445734571/                                                   ...
WHY SHOULD I CARE?Extensibility and Customizing  SaaS Configuration Competency Model  Wei Sun, Xin Zhang, Chang Jie Guo, P...
What doesmulti-tenancy + SaaS       mean?
CHALLENGESMulti-Tenancy                               Multi-Instance                                   (ASP)              ...
CHALLENGES                                            This is not the multi-Cloud ≠ Multi Tenancy                      ten...
CHALLENGESElastic multi tenancy             Cloud                           16
How much does it cost to run your system if  nobody is currently       using it?
Optimization is sexy again!
CHALLENGES                                Simple                                Implementation                            ...
Design to Cost
Tenant Separation
Tenant Separation
Elastic Infrastructure,      Scalability
CHALLENGES                                                       Drives Costs (SW+HW)                                     ...
SCALINGDeployment With PowerShellcls$hostedServiceName =teched2012paas$slot="Production"$rolename="WebUI"$rolecount=(     ...
SCALINGDeployment With PowerShellcls$subscriptionId = e84ee480-8cd4-4fa7-81b9-…$Certificate = Get-Item cert:CurrentUserMyF...
SCALINGMonitoring – How to Do Auto-Scaling?• Relatively easy to monitor overall  load/health of compute servers  – Azure D...
CHALLENGESMonitoring                28
CHALLENGESMonitoring                29
CHALLENGES
CHALLENGES
CHALLENGESMonitoring     If you want to know more join our upcoming webinar.                                              ...
Resources• Microsoft Patterns & Practices  The Autoscaling Application Block• Windows Azure PowerShell Cmdlets (Version pr...
Under Creative Commons LicenseSource: http://www.flickr.com/photos/massenpunkt/47436435/Automation is King
Extensibility
APPROACHModel-Driven Architecture                 Meta-           Base           Customer-                 Model          ...
Make the API anintegral part of your product!
Become A Software Factory Project A                            Project B             Custom Code                          ...
Become A Software Factory Project A                                                     Project B       Model, Extensions,...
Excursus:Scenario Driven    Design
APPROACH                            Early Prototype                            (Functional)              UI SketchesProgra...
APPROACHMake API integral  part of your   solution
APPROACHMetadata Rulez!             Configuration Instead               Of Programming                                    ...
APPROACHMetadata Rulez!               Mapping                               DataDatabase                            Struct...
DATA MODELData Model                    Mapping      Data         Database                              Structures        ...
DATA MODELMetadata Management                                 Domain-specific                               Structure and ...
WALKTHROUGHtime cockpit‘s Domain-specific Data Model                                                47
WALKTHROUGH time cockpit‘s Domain-specific Data ModelXAML Metadata Model (simplified)<Model […]>   <Model.Entities>       ...
TIPS & TRICKSMetadata Management (1/2)• Use metadata infrastructure of underlying systems   – E.g. create DB tables instea...
WALKTHROUGH Combining Strong Type Checking And ExtensibilityC# Code (Common Logic)[ModelEntityInterface]public interface I...
TIPS & TRICKSMetadata Management (2/2)• From model to SQL using a template engine   – We use StringTemplate from ANTLR and...
DATA MODELDesigning The Tenants’ Databases• Structurally identical DB for all tenants   – Key/value pair storage          ...
WALKTHROUGH One DB Per Tenant – SQL GenerationGenerate SQL Using Template Engine (Simplified)group DataModelTemplates;    ...
WALKTHROUGH Data MaintenanceGenerate SQL Using Template Engine (Simplified)group DataTemplates;SaveObject(context, object)...
DATA MODELYet Another ORM? No!• Not object oriented• Very domain-specific  – Convention vs. versatile• No code generation ...
BUSINESS LOGICBusiness Processes and Logic                                      Business Processes and Logic   User Inter...
BUSINESS LOGICProgramming Model(Internal And Public API)• Let people access DB directly   – SQL is already dynamic   – Pos...
BUSINESS LOGIC  time cockpit‘s Customization Architecture                                    Dynamic Objects (DLR)        ...
BUSINESS LOGIC „Floating“ Business Logic                             Expression                             Trees         ...
WALKTHROUGH Script-based Model and Data MaintenanceIronPythonmodel = Context.GetWritableModel()flatDim = ModelEntity()flat...
BUSINESS LOGICWhere We Use WhatCLR Languages and Scripting            Declarative• Offer vertical business              • ...
WALKTHROUGH DSL For Form DefinitionDeclaration of UI using XAML-based DSL<Form ModelEntityName="APP_Timesheet" […]>  <Tab ...
WALKTHROUGH DSL For List DefinitionDeclaration of UI using XAML-based DSL<List […] EditFormName="APP_TimesheetForm"  Query...
TIPS & TRICKSCustomization• DLR is a great platform to build on    – Also possible if you still use C# 3    – Data binding...
Securely separate    Tenants!
DATA MODELTenant Data Separation (SQL)       • Virtual or physical server per tenant          – Multi instance instead of ...
Decisions You Have to Make…… decide about the right level of sharing  Influences security  Influences systems management  ...
Decisions You Have to Make…… separate data stores of tenants appropriately   – Do not rely just on application-level secur...
Deployment of SQL Azure Server$subscriptionId = e84ee480-8cd4-4fa7-81b9-…$Certificate = Get-Item cert:CurrentUserMyF2242…$...
Deployment of SQL Azure Server                                                   Create 3-node cluster$cmdLineQuery = "CRE...
Tenant Isolation
Tenant Isolation
Resources•   Windows Azure PowerShell Cmdlets (Version prio June 2012)•   Getting Started with Windows Azure PowerShell (J...
Operational issues
CHALLENGESClient-Server Model     Program     Version Clients                                 Database             Offline...
CHALLENGESThree-Tier Modell    Program                           Program    Version                           Version Clie...
CHALLENGESMulti-Tenancy, Cloud                                    Program                                                 ...
CHALLENGESMulti-Tenancy, Cloud                                       Program                                              ...
VERSIONSMANAGEMENTAutomated Build                                                       Build Assemblies    C# Source   Sc...
VERSIONMANAGEMENTData, Service, and Program Version                                                                       ...
Microsoft‘s SLAs  No Silver BulletYou get credits, not compensation for damageBackup still important!
Backup and Recovery – SQL AzureAzure Protects Us Of…                 We Have to Care For…… loss of a single replica as eve...
Backup and Recovery – Azure StorageAzure (Can) Protect Us Of…             We Have to Care For…… server failures (storage c...
Submit DAC Export RequestREM Backup entire database                -X -Server qgmc….database.windows.net -Database MyDatab...
Submit DAC Export Request<?xml version="1.0" encoding="utf-8" ?><TableNames>   <TableName>      <SchemaName>tenant1</Schem...
Resources• MSDN: How to: Back Up Your Databases (SQL Azure)• Azure Blog: Geo-replication for Windows Azure Storage• SQL DA...
Failover Data Centers                        • Deploy to multiple                          locations                      ...
Create Traffic Manager Policy With PowerShellcls$subscriptionId = e84ee480-8cd4-4fa7-81b9-1379fdcf78a6$Certificate = Get-I...
Create Traffic Manager Policy With PowerShell$createdDefinition =                              `    -ProfileName $TMProfil...
Resources• Windows Azure PowerShell Cmdlets (Version prio June 2012)• Getting Started with Windows Azure PowerShell (June ...
CHALLENGES                        Low                  implementation                       effortComplex pricing   model
CHALLENGESRating/Billing/Payment                                                                      –    Account/balance...
As an IT Pro You Might Have to…           … gather the base data to enable usage-             based billing           … en...
Usage AnalyticsCompute Resources             Storage• Parse IIS logs              • SQL Azure                             ...
Conclusion• Cloud computing enables  people   – There will be more     competition• It‘s not easy   – Complexity comes fro...
Saves the day.Thank you!Questions? You want more?rainer@software-architects.at
Upcoming SlideShare
Loading in …5
×

Catching The Long Tail With SaaS + Windows Azure

1,006 views

Published on

I assembled this slide deck for a session for the Azure User Group in Brussels in Oct. 2012.

“Software as a Service” (SaaS) is a software distribution model that uses the Internet to deploy, maintain and run software solutions. Applications that are built to be used by thousands of customers have the need to be configurable and customizable to a high degree. This has a strong impact on the applications’ architectures. A single code base and a limited number of deployed instances have to serve a large number of customers (=tenants) although the users’ view on the system may be very different. In this session Rainer Stropek presents challenges that software architects are typically faced with when building such configurable multi-tenancy solutions. Based on this discussion Rainer will point out important consequences of multi-tenancy on operational costs and pricing models in SaaS solutions.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,006
On SlideShare
0
From Embeds
0
Number of Embeds
167
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • This side has intentionally been hidden. Just for attendees who want to know more after the conference.
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • Examples for Sandboxing:.NET Sandbox (see link on Resources slide)IIS Application Pools (see link on Resources slide)
  • This side has intentionally been hidden. Just for attendees who want to know more after the conference.
  • This side has intentionally been hidden. Just for attendees who want to know more after the conference.
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • This side has intentionally been hidden. Just for attendees who want to work through the demo after the conference or for people how could not attend the session in person.
  • This side has intentionally been hidden. Just for attendees who want to know more after the conference.
  • Catching The Long Tail With SaaS + Windows Azure

    1. 1. RAINER STROPEK | SOFTWARE ARCHITECTS GMBHSource: http://www.flickr.com/photos/fatboyke/2617432325/Catching The Long Tail WithSaaS + Windows Azure
    2. 2. INTRODUCTIONAbstract“Software as a Service” (SaaS) is a software distribution model that usesthe Internet to deploy, maintain and run software solutions. Applicationsthat are built to be used by thousands of customers have the need to beconfigurable and customizable to a high degree. This has a strong impacton the applications’ architectures. A single code base and a limitednumber of deployed instances have to serve a large number of customers(=tenants) although the users’ view on the system may be very different.In this session Rainer Stropek presents challenges that software architectsare typically faced with when building such configurable multi-tenancysolutions. Based on this discussion Rainer will point out importantconsequences of multi-tenancy on operational costs and pricing models inSaaS solutions. 2
    3. 3. INTRODUCTIONIntroduction• software architects gmbh• Rainer Stropek – Developer, Speaker, Trainer – MVP for Windows Azure since 2010 – rainer@timecockpit.com – @rstropek http://www.timecockpit.com http://www.timecockpit.com/devblog
    4. 4. INTRODUCTIONGoals• Why should I care?• What does multi-tenancy + SaaS mean?• How can the problems be solved?• This is an architectural session – BUT from the bottom of my heart I am a developer – No live coding  but a little bit of code walkthrough • This is an interactive session
    5. 5. Why should I care?
    6. 6. WHY SHOULD I CARE?Source: http://www.flickr.com/photos/spursfan_ace/2328879637/ Rules Are Changing 6
    7. 7. WHY SHOULD I CARE?Where We Come From Customer Dev Team Close Relationship 7
    8. 8. WHY SHOULD I CARE?Where Many Of Us Are Today External/New Customers Kunde Kunde Customer Kunde Dev Team Kunde Customer From Cost Center to Shared Service Center or even Profit Center! 8
    9. 9. WHY SHOULD I CARE?Where We Want To Be Off-The-Shelf Product Customer Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde KundeDev Team Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde Kunde CustomKunde Kunde Kunde Kunde Kunde Customer Custom Kunde Kunde CustomKunde Kunde Kunde Custom CustomKunde Customer 9
    10. 10. WHY SHOULD I CARE?Catching The Long Tail The Long Tail http://www.wired.com/wired/archive/12.10/tail.html, Amazon Free: The Future of a Radical Price (Amazon) 10
    11. 11. WHY SHOULD I CARE?Source: http://www.flickr.com/photos/mava/2445734571/ One Size Does Not Fit All 11
    12. 12. WHY SHOULD I CARE?Extensibility and Customizing SaaS Configuration Competency Model Wei Sun, Xin Zhang, Chang Jie Guo, Pei Sun, Hui Su: Software as a Service: Configuration and Customization Perspectives, in Proceedings of IEEE Congress on Services Part II, 2008 12
    13. 13. What doesmulti-tenancy + SaaS mean?
    14. 14. CHALLENGESMulti-Tenancy Multi-Instance (ASP) SaaS Maturity Levels Kwok, Nguyen, Lam: A Software as a Service with Multi-tenancy Support for an Electronic Contract Management Application, IEEE International Conference on e-Business Engineering, pp. 179-186, 2008 This is where Multi-Tenancy Windows Azure shines 14
    15. 15. CHALLENGES This is not the multi-Cloud ≠ Multi Tenancy tenancy we are talking about! Subscription owned by ISV Cloud Tenant 1 ... Tenant n Tenant m Subscription owned by customer 15
    16. 16. CHALLENGESElastic multi tenancy Cloud 16
    17. 17. How much does it cost to run your system if nobody is currently using it?
    18. 18. Optimization is sexy again!
    19. 19. CHALLENGES Simple Implementation Design to Cost Strategic decision, not a technical decisionOperational Costs/RGU [€] Highly optimized solution Few large customers Many small customers Development Costs [€] 19
    20. 20. Design to Cost
    21. 21. Tenant Separation
    22. 22. Tenant Separation
    23. 23. Elastic Infrastructure, Scalability
    24. 24. CHALLENGES Drives Costs (SW+HW) Expected Load ResourcesIT CAPACITY Drives Initial Investments Real Load Drives Revenue TIME
    25. 25. SCALINGDeployment With PowerShellcls$hostedServiceName =teched2012paas$slot="Production"$rolename="WebUI"$rolecount=( ` -ServiceName $hostedServiceName ` -Slot $slot ` -RoleName $rolename).InstanceCount$rolecount=$rolecount + 1 ` -ServiceName $hostedServiceName ` -Slot $slot ` -RoleName $rolename ` -Count $rolecount Note: This script applies to the June 2012 version of Azure PowerShell Cmdlets
    26. 26. SCALINGDeployment With PowerShellcls$subscriptionId = e84ee480-8cd4-4fa7-81b9-…$Certificate = Get-Item cert:CurrentUserMyF2242…$hostedServiceName =teched2012paas$slot="Production"$rolename="WebUI"$rolecount=( ` -SubscriptionId $subscriptionId ` -Certificate $Certificate ` -DeploymentSlot $slot ` -RoleName $rolename ` -ServiceName $hostedServiceName).instancecount$rolecount=$rolecount - 1 ` -SubscriptionId $subscriptionId ` -Certificate $Certificate ` -DeploymentSlot $slot ` -RoleName $rolename ` -ServiceName $hostedServiceName ` -Count $rolecount | Get-OperationStatus -WaitToComplete Note: This script applies to older Azure PowerShell Cmdlets (prior June 2012)
    27. 27. SCALINGMonitoring – How to Do Auto-Scaling?• Relatively easy to monitor overall load/health of compute servers – Azure Diagnostics gathers data – System Center Operation Manager or 3rd party tools for monitoring• Harder to monitor end-to-end performance for a certain user/tenant – Application-level logging – 3rd party APM tools like DynaTrace
    28. 28. CHALLENGESMonitoring 28
    29. 29. CHALLENGESMonitoring 29
    30. 30. CHALLENGES
    31. 31. CHALLENGES
    32. 32. CHALLENGESMonitoring If you want to know more join our upcoming webinar. 32
    33. 33. Resources• Microsoft Patterns & Practices The Autoscaling Application Block• Windows Azure PowerShell Cmdlets (Version prio June 2012)• Getting Started with Windows Azure PowerShell (June 2012 Version)• System Center Monitoring Pack for Windows Azure Applications• MSDN: Collecting Logging Data by Using Windows Azure Diagnostics• MS TechNet: How to Shard with SQL Azure• 3rd party tools – AzureWatch – opstera – Compuware DynaTrace – redgate Cloud Services – Cerebrata Diagnostics Manager
    34. 34. Under Creative Commons LicenseSource: http://www.flickr.com/photos/massenpunkt/47436435/Automation is King
    35. 35. Extensibility
    36. 36. APPROACHModel-Driven Architecture Meta- Base Customer- Model Model specific Model Respon- ISV ISV Partner Partners Customer sibility• Different levels of users – Deverlopers (ISV) – Consultants (ISV) and partners (External) – Power users (customer) – End users (customer) 36
    37. 37. Make the API anintegral part of your product!
    38. 38. Become A Software Factory Project A Project B Custom Code Custom Code Base Class Library
    39. 39. Become A Software Factory Project A Project B Model, Extensions, Configuration, Scripts Model, Extensions, Configuration, Scripts Patterns, Practices, Guidelines Custom Custom Custom Custom Component Component Common Components Component Component Base Class Library
    40. 40. Excursus:Scenario Driven Design
    41. 41. APPROACH Early Prototype (Functional) UI SketchesProgrammed Prototypes UI Sketches
    42. 42. APPROACHMake API integral part of your solution
    43. 43. APPROACHMetadata Rulez! Configuration Instead Of Programming 43
    44. 44. APPROACHMetadata Rulez! Mapping DataDatabase Structures Data Model Business Processes and Logic   User Interface Authentication and Authorization 44
    45. 45. DATA MODELData Model Mapping Data Database Structures 45
    46. 46. DATA MODELMetadata Management Domain-specific Structure and Logic Domain specific Model Controls Domain specific Data Access and Query Layer Generate Application Serialize Metadata SQL, ODATA, etc. Tenant specific Database Security: Prevent cross- tenant data access 46
    47. 47. WALKTHROUGHtime cockpit‘s Domain-specific Data Model 47
    48. 48. WALKTHROUGH time cockpit‘s Domain-specific Data ModelXAML Metadata Model (simplified)<Model […]> <Model.Entities> <ModelEntity Name="Project" SyncBehavior="ModelAndData"> <ModelEntity.Properties> <TextProperty Name="ProjectName" IsDefaultDisplayProperty="True"/> […] </ModelEntity.Properties> <ModelEntity.Relations> <Relation Name="CustomerRelation" Target="{ModelRelation Customer}" BackReferenceName="Projects" /> […] </ModelEntity.Relations> <ModelEntity.ValidationRules> <ValidationRule Name="SomeName" Condition=":Iif(Current.ProjectName=Test, True, False)" Message="Invalid Projectname"/> </ModelEntity.ValidationRules> </ModelEntity> </Model.Entities></Model> 48
    49. 49. TIPS & TRICKSMetadata Management (1/2)• Use metadata infrastructure of underlying systems – E.g. create DB tables instead of name/value pair storage• Dynamic instead of OO – DLR can build the bridge from OO to dynamic• Use strong type checking wherever possible – We use interfaces for that – Semantic validation of model to reduce # of runtime errors• DSLs – XAML • Better than pure XML: No additional schema • Better than code: Clear separation between model and logic – TCQL • time cockpit Query Language 49
    50. 50. WALKTHROUGH Combining Strong Type Checking And ExtensibilityC# Code (Common Logic)[ModelEntityInterface]public interface IDuration{ DateTime BeginTime { get; set; } DateTime EndTime { get; set; } decimal DurationInHours { get; }}[…]IDuration timesheet = context.Timesheet.CreateEntity<IDuration>();timesheet.BeginTime = DateTime.Now;[…] Strong type checkingC# Code (Customization)dynamic timesheet = context.Timesheet.CreateEntity<EntityObject>();timesheet.Description = "This is a new timesheet!";[…] Dynamic extension 50
    51. 51. TIPS & TRICKSMetadata Management (2/2)• From model to SQL using a template engine – We use StringTemplate from ANTLR and T4 from Microsoft – Support for multiple storage engines easy to implement – Automate DB design conventions• Make model simple by offering domain specific extensions – E.g. data types, functions, multi language support, etc.• Security layer for multi tenancy 51
    52. 52. DATA MODELDesigning The Tenants’ Databases• Structurally identical DB for all tenants – Key/value pair storage This is what we use • Implements a database inside a database to simplify metadata – Use XML/BLOBS for customizations repository structure • Hard to maintain and query – Reserved fields • Limited customization possibilities This is what we do • Inefficient (with regards to storage) at time cockpit• Change DB structure on the fly – Uses capabilities of the underlying storage – Open for the use of e.g. standard query tools – Self-describing • Parts of the model are inside the storage engine 52
    53. 53. WALKTHROUGH One DB Per Tenant – SQL GenerationGenerate SQL Using Template Engine (Simplified)group DataModelTemplates; Tenant separationCreateTable(context, entity) ::=<<CREATE TABLE [<context.Tenant>].[<entity.Name>] DB design( convention <entity.Name>Uuid uniqueidentifier NOT NULL, <entity.Properties:{ p | <p:(p.Type.Name)()>}; separator=",n">)ALTER TABLE [<context.Tenant>].[<entity.Name>] ADD CONSTRAINT DF_<entity.Name>_<entity.Name>Uuid DEFAULT newid() FOR<entity.Name>UuidALTER TABLE [<context.Tenant>].[<entity.Name>] ADD CONSTRAINTPK_<entity.Name> PRIMARY KEY CLUSTERED ( <entity.Name>Uuid )>>TextProperty(property) ::= "<property.Name> varchar(50) NULL„NumericProperty(property) ::= "<property.Name> numeric(18,4) NULL" 53
    54. 54. WALKTHROUGH Data MaintenanceGenerate SQL Using Template Engine (Simplified)group DataTemplates;SaveObject(context, object) ::= Tenant separation<<<if(object.IsNewEntityObject)> insert into [<context.Tenant>].[<object.Entity.Name>] ( <object.Entity.Name>Uuid, <object.Entity.Properties:{ p | <p.Name>}; separator=", "> ) values ( @Uuid, <object.Entity.Properties:{ p | @<p.Name>}; separator=", "> )<else> update [<context.Tenant>].[<object.Entity.Name>] set <object.Entity.Properties:{ p|<p.Name>=@<p.Name>}; separator=", "> where <object.Entity.Name>Uuid = @Uuid<endif>>> 54
    55. 55. DATA MODELYet Another ORM? No!• Not object oriented• Very domain-specific – Convention vs. versatile• No code generation – Duck typing instead of strong type checking at compile time (see also next chapter)• If you do not need a customized data model don‘t do it! 55
    56. 56. BUSINESS LOGICBusiness Processes and Logic  Business Processes and Logic User Interface 56
    57. 57. BUSINESS LOGICProgramming Model(Internal And Public API)• Let people access DB directly – SQL is already dynamic – Possible for reading, no-no for writing (sync!)• Generate code – Good for multi instance, bad for multi tenant This is what we do at time cockpit• Declarative – Graphical (e.g. WF) and textual (e.g. DSLs, X(A)ML) are possible – Great for common scenarios, doesn‘t work for everything• Key/value pair model – Similar to DataTable, DataReader, etc. – Hard to write, hard to read• Dynamic languages This is what we do – DLR is a great platform for that at time cockpit 57
    58. 58. BUSINESS LOGIC time cockpit‘s Customization Architecture Dynamic Objects (DLR) Basis for dynamicDeclarative UI language support engine Query Results Model (XAML and DLR enabled) Persist TC Expression Language TCQL (time cockpit Query Language) “Floating” VB LINQ business logic Compile Compile Expression SQL, REST, ODATA Trees Data Store 58
    59. 59. BUSINESS LOGIC „Floating“ Business Logic Expression Trees Custom logic executed in UI layer (data binding) Model: Calculated Property DurationInHours= Current.EndDate – Current.StartDate TCQL: Customized logic (functional From T In Timesheet Select T expression language) Where T.DurationInHours > 4 Tenant filter injection SQL: select […] from <Tenant>.Timesheet where datediff(…) > 4 Custom logic executed in DB layer 59
    60. 60. WALKTHROUGH Script-based Model and Data MaintenanceIronPythonmodel = Context.GetWritableModel()flatDim = ModelEntity()flatDim.Name = "Customer" Modelmodel.Entities.Add(flatDim)model.Customer.Properties.Add( TextProperty({ "Name": "CustomerName", "MaxStorageSize": 50 }))[…]Context.SaveModel(model)[…] Datacustomer = Context.CreateCustomer()customer.CustomerName = "C01"Context.SaveObject(customer) In C# 4 we can use dynamic keyword 60
    61. 61. BUSINESS LOGICWhere We Use WhatCLR Languages and Scripting Declarative• Offer vertical business • UI definition templates for time tracking – Forms and lists (incl. queries)• Interface development – Color schemas• Actions – time cockpit is more or less a – Predefined and customized runtime environment for our model – Flexible binding mechanisms to support CLR- and WF-based • Calculated properties actions (bridge to declarative • Validation rules world) • Default values • Exports for reporting 61
    62. 62. WALKTHROUGH DSL For Form DefinitionDeclaration of UI using XAML-based DSL<Form ModelEntityName="APP_Timesheet" […]> <Tab Header="Zeitbuchung"> <Section Header="Allgemein"> <DurationCell BeginTime="=Current.APP_BeginTime" EndTime="=Current.APP_EndTime" Header="Zeitraum" /> <BoundCell Content="=Current.APP_Description" /> </Section> <Section Header="Projekt"> <RelationCell Content="=Current.APP_Project" List="APP_DefaultProjectList" SortDirection="Descending" /> </Section> <Section Header="Verrechnung"> <NumericCell Content="=Current.APP_HourlyRateProjectOrTask" NumberFormatPattern="#,##0.00" /> <BoundCell Content="=Current.APP_NoBilling" /> </Section> </Tab> […]</Form> 62
    63. 63. WALKTHROUGH DSL For List DefinitionDeclaration of UI using XAML-based DSL<List […] EditFormName="APP_TimesheetForm" Query=" From Current In APP_Timesheet.Include(APP_UserDetail)[…] Order By Current.APP_BeginTime Select Current"> <BoundCell Content="=Current.APP_UserDetail" /> <NumericCell Content="=Current.APP_HourlyRateActual" NumberFormatPattern="#,##0.00" /> […]</List> 63
    64. 64. TIPS & TRICKSCustomization• DLR is a great platform to build on – Also possible if you still use C# 3 – Data binding customization is necessary (big problem in Silverlight 3)• Mix of predefined and customized data model – We use interfaces for that  strong type checking where possible – Don’t forget to have a defined way for updating your model!• Make common domain-specific scenarios as simple as possible – Declarative instead of scripts – Query and expression language go hand in hand• Use tools for implementing domain specific languages – Graphical or textual – X(A)ML is the easy way  time cockpit’s UI 64
    65. 65. Securely separate Tenants!
    66. 66. DATA MODELTenant Data Separation (SQL) • Virtual or physical server per tenant – Multi instance instead of multi tenant • One DB per tenant • Separation using schemas • Shared tables 66
    67. 67. Decisions You Have to Make…… decide about the right level of sharing Influences security Influences systems management Influences operational costsExample SQL Azure: Shared Tables (+Views) Separate tenants using schemas Separate tenants using databases Combination of these solutionsTip: Consider using SQL Azure Federations for tenantseparation
    68. 68. Decisions You Have to Make…… separate data stores of tenants appropriately – Do not rely just on application-level security – Influences tenant-specific backup/restore… protect user/tenant assignments… protect your connection strings – e.g. using encryption – Use ACS/Service Bus integration to protect service bus namespaces
    69. 69. Deployment of SQL Azure Server$subscriptionId = e84ee480-8cd4-4fa7-81b9-…$Certificate = Get-Item cert:CurrentUserMyF2242…$sqlAdminLogin = "TechEdSqlAdmin"$sqlAdminPassword = "TechEdSq1@dm1n"$location = "North Europe"$server = ( ` -AdministratorLogin $sqlAdminLogin ` -AdministratorLoginPassword $sqlAdminPassword ` -Location $location ` -SubscriptionId $subscriptionId ` -Certificate $Certificate).ServerName$fullServer = $server + ".database.windows.net"$ruleName = "Everyone" ` -Server $server ` -RuleName $ruleName ` -StartIpAddress "0.0.0.0" ` -EndIpAddress "255.255.255.255" ` -SubscriptionId $subscriptionId ` -Certificate $Certificate Note: The June 2012 version of Azure PowerShell Cmdlets does not contain commands to manage SQL Azure
    70. 70. Deployment of SQL Azure Server Create 3-node cluster$cmdLineQuery = "CREATE DATABASE TechEd2012 in AzureGOCREATE LOGIN TechEd2012Admin WITH PASSWORD = TechEd2012@dm!n" -S $fullServer -d -U $sqlAdminLogin -P $sqlAdminPassword -Q "$cmdLineQuery"$cmdLineQuery = "CREATE USER TechEd2012Admin FOR LOGIN TechEd2012Admin WITH DEFAULT_SCHEMA = dboGOEXEC sp_addrolemember Ndb_owner, NTechEd2012Admin" -S $fullServer -d -U $sqlAdminLogin -P $sqlAdminPassword -Q "$cmdLineQuery" Create user in SQL Azure
    71. 71. Tenant Isolation
    72. 72. Tenant Isolation
    73. 73. Resources• Windows Azure PowerShell Cmdlets (Version prio June 2012)• Getting Started with Windows Azure PowerShell (June 2012 Version)• MSDN: How to: Run Partially Trusted Code in a Sandbox• MSDN: Managing Application Pools in IIS 7• Federations in SQL Azure• 3rd party tools – Cerebrata Cloud Storage Studio
    74. 74. Operational issues
    75. 75. CHALLENGESClient-Server Model Program Version Clients Database Offline Capabilities Data Version
    76. 76. CHALLENGESThree-Tier Modell Program Program Version Version Clients Web Server Database Offline Service Capabilities Version Data Version
    77. 77. CHALLENGESMulti-Tenancy, Cloud Program Versions Data Versions Offline Routing- Capabilities service Tenant 1 Tenant 2 Clients Tenant n Web Server Database Service Versions Program Versions Multi-TenantMultiple Tenants Load Balancer App-Server Farm Cluster
    78. 78. CHALLENGESMulti-Tenancy, Cloud Program Versions Data Versions Offline Routing- Capabilities service Tenant 1 Tenant 2 Clients Web Server Tenant n Database Service Manual release Versions management is Program impossible! Versions Multi-TenantMultiple Tenants Load Balancer App-Server Farm Cluster
    79. 79. VERSIONSMANAGEMENTAutomated Build Build Assemblies C# Source Schema Definition (XAML) Cloud Which versions are compatible with tenant DB? Tenant Tenant Dir./ Database Mgmt. DB
    80. 80. VERSIONMANAGEMENTData, Service, and Program Version Data version of tenant Program version Data version of offline store Tenant Client Database Single Tenant CMS Cross-version Tenant Dir./ compatibility Mgmt. DB Web Service Cloud
    81. 81. Microsoft‘s SLAs  No Silver BulletYou get credits, not compensation for damageBackup still important!
    82. 82. Backup and Recovery – SQL AzureAzure Protects Us Of… We Have to Care For…… loss of a single replica as every … Protection from unwanted database is a three-node failover deletions/modifications (until cluster point-in-time restore feature becomes available)… simultaneous or catastrophic • Copy database hardware and system failures (MS- • 3rd party tools internal backups only) … long-term archive (longer than… Unwanted deletions/modifications upcoming point-in-time restore with upcoming point-in-time feature supports) restore feature • Import/export BACPACs • BCP … per tenant backup/restore
    83. 83. Backup and Recovery – Azure StorageAzure (Can) Protect Us Of… We Have to Care For…… server failures (storage cluster) … protection from unwanted deletions/modifications… data center outages (geo- • If you do not create blob replication) snapshots on application-level… unwanted deletions/modifications in Blob Storage Note: 3rd party tools/samples for Azure • If you use snapshot-feature on Storage backup/sync are available application-level
    84. 84. Submit DAC Export RequestREM Backup entire database -X -Server qgmc….database.windows.net -Database MyDatabase -ACCESSKEYTYPEshared -BLOBURL "http://rstropekteched.blob.core.windows.net/tenant1/Tenant1Backup.bacpac" -BLOBACCESSKEY "?sr=b&si=Backup&sig=mBJfu8SODQYC5Ns…" -User … -Password … Tip: Use Shared Access SignaturesREM Selective backupDacIESvcCli.exe -SX -Server qgmc….database.windows.net -Database MyDatabase -ACCESSKEYTYPEshared -BLOBURL "http://rstropekteched.blob.core.windows.net/tenant1/Tenant1Backup.bacpac" -BLOBACCESSKEY "?sr=b&si=Backup&sig=mBJfu8SODQYC5Ns…" -User … -Password … -SXF c:backupselection.xml
    85. 85. Submit DAC Export Request<?xml version="1.0" encoding="utf-8" ?><TableNames> <TableName> <SchemaName>tenant1</SchemaName> Specify schema/table <Name>Table1</Name> filter here </TableName> <TableName> <SchemaName>tenant1</SchemaName> <Name>Table2</Name> </TableName> …</TableNames>
    86. 86. Resources• MSDN: How to: Back Up Your Databases (SQL Azure)• Azure Blog: Geo-replication for Windows Azure Storage• SQL DAC Examples on CodePlex• 3rd party tools – redgate Cloud Services – bluesyntax SQL Azure Backup – CloudBerry Explorer for Azure Blob Storage
    87. 87. Failover Data Centers • Deploy to multiple locations • Azure Traffic Manager – Failover – Performance (routed to nearest location) – Round Robin • SQL Data – Data Sync – Backup/restore (e.g. BACPAC) • Blobs/Tables – Auto geo-replication
    88. 88. Create Traffic Manager Policy With PowerShellcls$subscriptionId = e84ee480-8cd4-4fa7-81b9-1379fdcf78a6$Certificate = Get-Itemcert:CurrentUserMyF2242BC0925A2F5B01B2F57B572E6439B721AD4D$TMProfileName = TechEd2012TrafficMgr$profile = ` -ProfileName $TMProfileName ` Cross data center -DomainName teched2012trafficmgr.trafficmanager.net ` failover cluster -SubscriptionId $subscriptionId ` -Certificate $Certificate$endpoints = @()$endpoints += -DomainName europenorth.cloudapp.net$endpoints += New-TrafficManagerEndpoint -DomainName northcentralus.cloudapp.net$monitors = @()$monitors += –Port 80 –Protocol HTTP –RelativePath / Note: The June 2012 version of Azure PowerShell Cmdlets does not contain commands to manage SQL Azure
    89. 89. Create Traffic Manager Policy With PowerShell$createdDefinition = ` -ProfileName $TMProfileName ` -TimeToLiveInSeconds 30 ` -LoadBalancingMethod Failover ` -Monitors $monitors ` -Endpoints $endpoints ` -Status Enabled ` -SubscriptionId $subscriptionId ` -Certificate $Certificate ` -ProfileName $TMProfileName ` -Enable ` -DefinitionVersion $createdDefinition.Version ` -SubscriptionId $subscriptionId ` -Certificate $Certificate
    90. 90. Resources• Windows Azure PowerShell Cmdlets (Version prio June 2012)• Getting Started with Windows Azure PowerShell (June 2012 Version)
    91. 91. CHALLENGES Low implementation effortComplex pricing model
    92. 92. CHALLENGESRating/Billing/Payment – Account/balance infrastructure (debit system• Web portal for… instead of credit system; example: Skype) – …registration of new users (has to handle very • E.g. what to do with remaining balance if user cancels sensitive credit card data  has to be stored safely his account? and securely, too!) • Fraud detection – …maintaining customer billing data (e.g. customer changes address or credit card provider) – Infrastructure for credit checking and fraud – …cancelling accounts or users detection; examples are… •• Infrastructure for rating …credit card checking • …check of credit ranking for users – Measure usage – Rage usage with rates/unit • Support infrastructure for rating/billing/payment – Additional rating logic will be necessary; examples: issues • Mechanisms for sales discounts (e.g. • Alternatives introductory offer)• Infrastructure for billing • Alternatives for building such a system from scratch – Creation of invoices (in total for accounting and could be: itemized bills for checking the correctness) – Buying an existing billing system (expensive; does – Sending out invoices (electronically with/without only make sense if customer needs such a system in signature, printed) other areas, too) – Storing invoices internally. – Handle payments with payment partners (e.g.• Infrastructure for payment; options could be: payment via phone invoice  difficult because such – Credit card payments including mechanisms for handling payment cancellations, invalid credit contracts have to be maintained country by country) cards (e.g. expired cards), etc. – Use existing SaaS payment solutions (e.g. PayPal; – Payments via online payment solution like PayPal difficult with pay-per-use) – Payment with vouchers (e.g. voucher that an end user received with hardware)
    93. 93. As an IT Pro You Might Have to… … gather the base data to enable usage- based billing … enforce usage limits … monitor fair use policies … etc.
    94. 94. Usage AnalyticsCompute Resources Storage• Parse IIS logs • SQL Azure – Dynamic Management Views• Application-level logging • Windows Azure Storage• 3rd party APM tools – Azure Storage Analytics
    95. 95. Conclusion• Cloud computing enables people – There will be more competition• It‘s not easy – Complexity comes from multi- tenancy + customization• Have your business plan ready when moving to a world of SaaS – Technology will follow Source: http://www.flickr.com/photos/laurie_pink/2599768757/ 95
    96. 96. Saves the day.Thank you!Questions? You want more?rainer@software-architects.at

    ×