350 likes | 544 Views
Realizing a Multi-Tenant SaaS Platform based on Universal Table Schema Layout. Author: Deik Hoong Tan Professor : Chun Feng Liao. Outline. Introduction Related Work System Design System Implementation Experiment Conclusion. Introduction. Cloud computing
E N D
Realizing a Multi-Tenant SaaS Platform based on Universal Table Schema Layout Author: DeikHoong Tan Professor : Chun Feng Liao
Outline • Introduction • Related Work • System Design • System Implementation • Experiment • Conclusion
Introduction • Cloud computing • Enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (NIST) • End users access cloud-based applications through a web browser • Cloud service model • Infrastructure as a Service (IaaS) • Platform as a Service (PaaS) • Software as a Service (SaaS)
Introduction-Software as a Service • Delivers applications/services over the web • No upfront investment in servers or software licensing for users • “pay-as-you-go” model • Software application accessed without additional hardware or software • Examples: • Google Docs • Dropbox • Salesforce.com • Hotmail or Gmail • Microsoft OneDrive, etc
Introduction-Multi-Tenancy • Tenant = A person/organization • Multi-tenancy • Single instance of software serving multiple tenants • Ensures one tenant operates in isolation from all others
Introduction-Multi-Tenancy • Challenges • How to select and realizing appropriate schema layout • Scalability • High performance • Tenant-specific customization • Goal • Todevelop a platform for converting SQL statements to fulfills Universal Table Layout • To customize columns through the platform
Related Work • Multi-Tenant Database Architecture • Separate Database • Share Database, Separate Schema • Share Database, Share Schema
Related Work-Separate Database • Separate Database • Hardware resources share by different tenants • Create specific database to serve each tenant • Pros • Good data isolation • High security • Cons • Maintenance cost expensive • Scalability is very poor
Related Work-Share Database,Separate Schema • Share Database,Separate Schema • Share one database instance • One database instance store all tables from different tenant. • Pros • Reduce maintenance cost compared with separate database • Provides better scalability than separate database • Cons • Performance begins degrade when the number of tables is increase • Scalability still the limitation
Related Work-Share Database,Share Schema • Share Database,Share Schema • Share one database instance and schema • Uses one table manage multi-tenant data • Pros • Low cost compared last solution • Highly scalability • Cons • Difficult design and implement • Performance obviously degraded when database tables become too sparse
Related Work • Schema Mapping Technique (Aulbach et al) • Private Table Layout • Extension Table Layout • Universal Table Layout • Pivot Table Layout • Chunk Table Layout • Chunk Folding Layout • Universal Table is the most flexible schema and if carefully design can achieve reasonable performance (Li et al)
Related Work-Universal Table Layout • Generic structure with VARCHAR value columns • n-th column of a logical table is mapped to ColN in an universal table • Extensibility: # of columns may expand as needed • Disadvantages • Very wide rows Many NULL values • No index support (note column index not very meaningful) logical table (after renaming)
System Design • Considerations • Provide ability of tenant-specific customization • Enhance the ability of software developers to manage the information of tenants.
System Architecture • Components of system architecture • Wrapper • Web Application • SQL Transform Layer • Database
System Flow Tenant10 : Select * from product Product Tenant10 : Select * from data where TenantId=10 and Name=“Product” Data
Multi-Tenant Adapter Design • MySQLiis a relational database driver used in PHP interact with MySQL database • DBI is inherit with MySQL • Construtor • TenantId • Password • Database • SetTenantId • Prepare • Execute • Close
SQL Rewriting Design • Transform various SQL statement to fulfill Universal Table Layout • SQL statement rewrite rules • Select (Liao et al) • Create Table • Alter
Create Table Transformation • Transform CREATE TABLE statement • Parse CREATE TABLE statement • Store the table name of logical table and tenantId to Objects table • Store columns name, number of columns, data type and latest objectIdto Field table
Select Transformation • Transform SELECT statement • Parse SELECT statement • Obtain table name through FROM element and found objectId in the Objects table • Determine SELECT element is "*" or specific columns and search columns names and columns position in Field table • Transform SELECT statement by tenantId, objectId, fieldName, fieldNum
ALTER Transformation (For Tenant) • Types of ALTER statements • Add a column • Delete a column • Rename table name • Modify columns name and data type • Transform ALTER statement • Determine which type ALTER statement is. • According type of ALTER statement to make changes on Object and Fields table.
System Implementation • Scenario • A tenant need to build a e-commerce web site • Require three tables • Product • Order • OrderLineitem
Experiment environment • Client (Laptop) • Apache JMeter • Server (Desktop PC) • Ubuntu 12.04 • MySQL 5.5.34
Experiment Design • Assume three tables Order Product OrderLineitem
Experiment Design • Data quantity of each table • Product Table 10000 rows • Order Table 10000 rows • OrderLineitem 10000 rows • Physical database • M10, M20, M30, M40, M50 total five databases where stored 10 to 50 tenants information
Experiment Design • SQL statement • Select , Project , Join , Index(primary key) • Experiment 1 #(Database)={M10,M20,M30,M40,M50} • Execute each SQL statement at difference tenant database • Experiment 2 #(Thread)={20,40,60,80…200} • Database fixed at M10,M30,M50
Preliminary Experiment 1 Tenant Database
Preliminary Experiment 2 Thread Thread Thread Thread
Conclusion • Design a SaaS platform based on Universal Table Schema Layout • Transform SQL statement to fulfill Universal Table Schema Layout • Design a multi-tenant adapter let tenants more easier use the platform • SQL rewriting of insert, update, delete statements