Understanding Multitenancy and the Architecture of the Salesforce Platform

47
Salesforce.com’s Multi-tenant Architecture How we do the magic we do…

description

Join us as we take a deep dive into the architecture of the Salesforce platform, explain how multitenancy actually works, and how it affects you as a developer. Showing the technology we use and the design principles we adhere to, you'll see how our platform teams manage three major upgrades a year without causing any issues to existing development. We'll cover the performance and security implications around the platform to give you an understanding of how limits have evolved. By the end of the session you'll have a better grasp of the architecture underpinning Force.com and understand how to get the most out of it.

Transcript of Understanding Multitenancy and the Architecture of the Salesforce Platform

Page 1: Understanding Multitenancy and the Architecture of the Salesforce Platform

Salesforce.com’s Multi-tenant ArchitectureHow we do the magic we do…

Page 2: Understanding Multitenancy and the Architecture of the Salesforce Platform

Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Page 3: Understanding Multitenancy and the Architecture of the Salesforce Platform

Doug MerrettDoug Merrett

Principal Architect – Northern EuropePrincipal Architect – Northern Europe

Page 4: Understanding Multitenancy and the Architecture of the Salesforce Platform

Powering the Customer Company

ConnectedCustomers

ConnectedProducts

ConnectedEmployees

ConnectedPartners

Page 5: Understanding Multitenancy and the Architecture of the Salesforce Platform

salesforce.com: Customer Company Architecture

Sa

lesf

orc

e Id

entit

y

Chatter

Data.com

Trusted, Scalable Multi-Tenant Infrastructure

Sales Service Marketing AppExchange

Data Model

Sal

esfo

rce

Pla

tform

Ap

plic

atio

ns

Force.com Heroku Fuel

Work.com

Any SocialNetwork

Any Device

Back EndSystems

Any App

AppExchange Apps

ERP

Finance

Public or Private Apps

Communities

ConnectedProducts

ConnectedPartners

ConnectedEmployees

ConnectedCustomers

Page 6: Understanding Multitenancy and the Architecture of the Salesforce Platform

salesforce.com: Customer Company Architecture

Sa

lesf

orc

e Id

entit

y

Chatter

Data.com

Trusted, Scalable Multi-Tenant Infrastructure

Sales Service Marketing AppExchange

Data Model

Sal

esfo

rce

Pla

tform

Ap

plic

atio

ns

Force.com

Work.com

Any SocialNetwork

Any Device

Back EndSystems

Any App

AppExchange Apps

ERP

Finance

Public or Private Apps

Communities

ConnectedProducts

ConnectedPartners

ConnectedEmployees

ConnectedCustomers

Page 7: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Core of the Customer Company: Multi-tenant Cloud Computing

Fast Easy Open Flexible Trusted

No Hardware

No Software

Automatic Upgrades

Scalable

Any Device

Data Portability

Transparency

Real-time Status

App Marketplace

Extensible

Enterprise

Cloud Computing

Page 8: Understanding Multitenancy and the Architecture of the Salesforce Platform

What salesforce.com does for youYOU

get to focus on innovationWe do

InfrastructureServices

We doApplication

Services

We doOperations

Services

Customize your CRM

Build your data model

Build your business logic

Build your user interface

Network

Storage

Operating System

Database

App Server

Web Server

Data Center

Security

Sharing

Integration

Customization

Web Services

API

Multi-Language

Authentication

Availability

Monitoring

Patch Mgmt

Upgrades

Backup

NOC

Page 9: Understanding Multitenancy and the Architecture of the Salesforce Platform

Multi-tenancy

Page 10: Understanding Multitenancy and the Architecture of the Salesforce Platform

One Cloud with Many Customers

Shared Elastic ServicesOne Data Store per Point of Deployment (Pod)10K+ Customers per Pod50+ Pods

All data segregated by customerAll operations include tenant IDDisaster RecoveryPer tenant encryption keys

Page 11: Understanding Multitenancy and the Architecture of the Salesforce Platform

What is in a Pod

Page 12: Understanding Multitenancy and the Architecture of the Salesforce Platform

What Multi-tenancy means for salesforce.com R&D

No Legacy TeamsBugs fixed for everyone

One Version

Page 13: Understanding Multitenancy and the Architecture of the Salesforce Platform

What Multi-tenancy means for salesforce.com R&D

No Legacy TeamsBugs fixed for everyone

One Version260K+ of our TestsRun your tests as well

Automation

Page 14: Understanding Multitenancy and the Architecture of the Salesforce Platform

What Multi-tenancy means for salesforce.com R&D

No Legacy TeamsBugs fixed for everyone

One Version

Pod Architecture

260K+ of our TestsRun your tests as well

Automation

Staggered ReleasesScalability across all sizes

Page 15: Understanding Multitenancy and the Architecture of the Salesforce Platform

What Multi-tenancy means for salesforce.com R&D

Three major releases per yearBug fixes every week

Predictability

No Legacy TeamsBugs fixed for everyone

One Version

Pod Architecture

260K+ of our TestsRun your tests as well

Automation

Staggered ReleasesScalability across all sizes

Page 16: Understanding Multitenancy and the Architecture of the Salesforce Platform

What Multi-tenancy means for salesforce.com R&D

Three major releases per yearBug fixes every week

Predictability

No Legacy TeamsBugs fixed for everyone

One Version

Pod Architecture

260K+ of our TestsRun your tests as well

Automation

Staggered ReleasesScalability across all sizes

Page 17: Understanding Multitenancy and the Architecture of the Salesforce Platform

Key Architectural Principles

Stateless Appservers

Database system of record

No Database Definition Language (DDL) at Runtime

All tables partitioned by OrgId

Smart Primary Keys, Polymorphic Foreign Keys

Creative de-normalization and pivoting

Use every RDBMS feature & trick

Page 18: Understanding Multitenancy and the Architecture of the Salesforce Platform

Metadata, data, and pivot table structures store data corresponding to virtual data structures

Page 19: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Objects table stores metadata about custom objects (tables)

Page 20: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Fields table stores metadata about custom fields (columns)

Page 21: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Data heap table stores all structured data corresponding to custom objects

Page 22: Understanding Multitenancy and the Architecture of the Salesforce Platform

A single slot can store various types of data that originate from different objects

Page 23: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Indexes pivot table manages tenant-specific selective indexes

Page 24: Understanding Multitenancy and the Architecture of the Salesforce Platform

The UniqueFields pivot table facilitates uniqueness for custom fields

Page 25: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Relationships pivot table facilitates referential integrity and optimizes joins

Page 26: Understanding Multitenancy and the Architecture of the Salesforce Platform

All data & metadata structures are partitioned to improve performance and manageability

Tables hash partitioned by OrgId

Separate connection pools point to physical hosts

App tier is also dynamically partitioned by OrgId

Distributed metadata cache with transactional invalidation

Page 27: Understanding Multitenancy and the Architecture of the Salesforce Platform

Application Framework: a whole lot for free

Native Declarative features

Bulk Processing

The Recycle Bin

Full Text Search

Smart Bulk Data Manipulation Language (DML)

Web Services APIs

Page 28: Understanding Multitenancy and the Architecture of the Salesforce Platform

Force.com’s native Application Framework provides declarative development, no coding

Page 29: Understanding Multitenancy and the Architecture of the Salesforce Platform

Validation rules and simple formulas:Business analysts can “code” these

Page 30: Understanding Multitenancy and the Architecture of the Salesforce Platform

Not so simple: Rollup-summary fields provide for easy cross-object summaries

Page 31: Understanding Multitenancy and the Architecture of the Salesforce Platform

Force.com’s bulk processing optimizations reduce overhead for data loads

Page 32: Understanding Multitenancy and the Architecture of the Salesforce Platform

Data definition processing is optimized to avoid performance hits or concurrency limits

Examples:

Sort all records by primary key before attempting DML

Operate on tables in deterministic order

Slot reallocation for field datatype change

Deferred calculation for new rollup-summary field

Background processing of mass changes

Page 33: Understanding Multitenancy and the Architecture of the Salesforce Platform

The Recycle Bin: Smart Undeletes

Restore

Individual object instances (records)

Related object instances (parent/child records)

Entire fields and objects(dropped columns and tables)

Page 34: Understanding Multitenancy and the Architecture of the Salesforce Platform

Search Servers

Query Hosts

Query Hosts

DB

Java Application

Servers

Java Application

Servers

Java Application

Servers

Java Application

Servers

Java Application

Servers

Java Application

Servers

Java Application

Servers

Java Application

Servers

Query Hosts

Search Hosts

FFX

Search Servers

Query Hosts

Query Hosts

Query Hosts

Search Hosts

Production DR

BackupBackup

Rep

licat

ion

Rep

licat

ion

Multi-tenant search

Page 35: Understanding Multitenancy and the Architecture of the Salesforce Platform

Multi-tenancy delivers Blazing Performance

Massive Data Growth Excellent PerformanceMassive Usage Growth

Target 300ms

transactions per quarter

86Billion

In 2009 we had 13B transactions per quarter.Now we do that every 2 weeks.

transactions per quarter

13Billion

records65 Billion

records6 Billion custom

object records

40 Billion

Page 36: Understanding Multitenancy and the Architecture of the Salesforce Platform

Multi-tenant file storage

File ServerFile Server

File ServerFile Server

File ServerFile Server

File ServerFile Server

File ServerFile Server

File ServerFile Server

File Catalog File Catalog

AppserverAppserver

Appserver

Primary Disaster Recovery

Every file stored with:• 8 online copies• 2 tape copies

Tape Backup Tape Backup

Disk Backup

Disk Backup

Page 37: Understanding Multitenancy and the Architecture of the Salesforce Platform

Multi-tenant Query Optimization Principles

Consistent SQL generation across the application

Deep awareness of pivot table structure Flex schema does impose a cost

Tenant, user, object, fields statistics are crucial

No runaway queries allowed

Deep integration with the sharing model

Page 38: Understanding Multitenancy and the Architecture of the Salesforce Platform

Force.com’s query optimizer writes optimal queries for internal data access operations

Multi-tenant optimizer statistics

Page 39: Understanding Multitenancy and the Architecture of the Salesforce Platform

The optimizer considers pre-query selectivity measurements when writing a query

Pre-Query Selectivity

Measurements

… use of index related to filter.HighHigh

… ordered hash join; drive using Data table.LowHigh

… use of index related to filter.HighLow

… nested loops join; drive using view of rows that the user can see.LowLow

Write final database access query, forcing …FilterUser

Page 40: Understanding Multitenancy and the Architecture of the Salesforce Platform

Apex: Force.com’s procedural frontierInteger NUM = 10; Account[] accs;

// Clean up old data accs = [select id from account where name like 'test%']; delete accs; commit;

accs = new Account[NUM]; for (Integer i = 0; i < NUM; i++){ accs[i] = new Account(name='test ' + i, outstandingshares__c=i); } insert accs;

Contact[] cons = new Contact [0];

for (Account acc : accs){ cons.add(new Contact(lastName=acc.name + '1', accountid=acc.id)); cons.add(new Contact(lastName=acc.name + '2', accountid=acc.id)); }

insert cons;

SOQL Query

VariableDeclaration

Control Structure

Array

Data Operation

CommitTransaction

Page 41: Understanding Multitenancy and the Architecture of the Salesforce Platform

Apex code is stored as metadata, interpreted at runtime, and cached for scalability

Page 42: Understanding Multitenancy and the Architecture of the Salesforce Platform

Apex is deeply integrated with platform features

Bulk DML

Email and messaging

Asynchronous processing (Futures)

XmlStream / HTTP (RESTful) services classes

Declarative exposure as new Web Services

Page 43: Understanding Multitenancy and the Architecture of the Salesforce Platform

FeedsProfiles

FilesSocial Graph

Social

Right ExperienceAny Device

Customizable

Mobile

Real-time notificationsReal-time workflow

Real-time feeds

Real-time

Customer Company PlatformPowered by Multi-tenancy

Open

Open StandardsOpen

TechnologiesOpen Interfaces

Open Languages

What Makes Us Different?

Page 44: Understanding Multitenancy and the Architecture of the Salesforce Platform

Where to go for more information...

http://developer.force.com/architect

http://developer.force.com/security

Other sessions

Page 45: Understanding Multitenancy and the Architecture of the Salesforce Platform
Page 46: Understanding Multitenancy and the Architecture of the Salesforce Platform

We want to hear

from YOU!

Please take a moment to complete our session survey

Surveys can be found in the “My Agenda” portion of the Dreamforce app

Page 47: Understanding Multitenancy and the Architecture of the Salesforce Platform