architecting a social enterprise application
DESCRIPTION
How do you architect a Social Enterprise application? What are some of the unique considerations when designing a cloud application versus a traditional on-premise application? What are some of the unique use cases, design patterns, and best practices when developing on a cloud platform (like Force.com) and database (like Database.com)? This session will answer these questions and help you architect the next killer cloud app.TRANSCRIPT
Architecting a Social Enterprise Application
Developers Track
Rob Woollen, CTO Platform, salesforce.com
Glenn Weinstein, CTO, Appirio
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, breachof our security measures, the outcome of intellectual property and other litigation, risks associated with 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-Q for the most recent fiscal quarter ended July 31, 2011. This 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.
Agenda
What is a “social enterprise application?”
Development themes – mobile
Development themes – social
Development themes – optimized
Force.com data services
Force.com realtime applications
Force.com optimizations
Glenn WeinsteinCTO, Appirio
What is a “Social Enterprise Application?”
MOBILE Architecture must account for mobile as primary UI device
SOCIAL Taking maximum advantage when “social”-izing apps
OPTIMIZED Accessing ever-larger cloud-based data sources
Development Trends -Mobile
The New Architecture for Mobile Apps
1980s: Desktop apps
• Complex processing• Rich user experience• Connectivity not required• Examples: MSFT Office, Adobe Photoshop
1990s: Client-server• Desktop apps paired with a server• Complex local architectures• Examples: SAP, Oracle Apps
2000s: Web and RIAs
• Browser as universal HTML client• Rich UI and media; server does most logic• Examples: Web editions of enterprise
software
2011+: Mobile• Maximize use of local CPU• Minimize need for data throughput• Examples: Database.com
The New Architecture for Mobile Apps
1980s: Desktop apps
• Complex processing• Rich user experience• Connectivity not required• Examples: MSFT Office, Adobe Photoshop
1990s: Client-server• Desktop apps paired with a server• Complex local architectures• Examples: SAP, Oracle Apps
2000s: Web and RIAs
• Browser as universal HTML client• Rich UI and media; server does most logic• Examples: Web editions of enterprise
software
2011+: Mobile• Maximize use of local CPU• Minimize need for data throughput• Examples: Database.com
The New Mobile Architecture Requires a Different Approach
App Server
The New Mobile Architecture Requires a Different Approach
The New Mobile Architecture Requires a Different Approach
SOAP?REST?
HTML5?Native (iOS, Android)?
The New Mobile Architecture Requires a Different Approach
SOAP?REST?
HTML5?Native (iOS, Android)?
Key ThemesNative > genericMulti-tenant > single-tenantCoarse-grained > fine-grained
Development Trends -Social
Does Your App Have Social Graces?
Phase 1: “Socially Enabled”
Chatter feed on business objects
Does Your App Have Social Graces?
Phase 1: “Socially Enabled”
Chatter feed on business objects
Where should users look for the narrative?
• Record History• Notes & Attachments• Activity History• Chatter Feed• All of the above?
Considerations• “Force” feed• Drop followers at close
Does Your App Have Social Graces?
Phase 2: “Socially Witty”
Have something interesting to say
Does Your App Have Social Graces?
Phase 2: “Socially Witty”
Considerations• Give your app a distinctive “voice”• Go beyond basic field changes
Have something interesting to say
Does Your App Have Social Graces?
Phase 3: “Socially Aware”
Phones use geolocation…
Does Your App Have Social Graces?
Phase 3: “Socially Aware”
Phones use geolocation…
…Chatter-enabled apps can use “social graph location”My Groups Who I’m Following What I’m Following
Development Trends -Optimized
Mobile and Social Apps Produce More Data!
Business records change slowly
Mobile and Social Apps Produce More Data!
Business records change slowly Chatter changes quickly
Mobile and Social Apps Produce More Data!
Larger volumes
Broader variety
Higher velocity
More business value
Business records change slowly Chatter changes quickly
Mobile and Social Apps Produce More Data!
Larger volumes
Broader variety
Higher velocity
More business value
Business records change slowly Chatter changes quickly
Security optimizations REST services Bulk data handling
Rob WoollenCTO, Platform
salesforce.com
@rwoollen
Cloud2 Data Services
Securing Cloud Data
Database.com provides a rich, row-level security model– Powering our CRM application for 10+ years
– Separates the administration of security rules from application development
Query / Search natively support security model– Inaccessible records are automatically filtered out
Multi-Tenant Query Optimizer ensures security handled efficiently
Run pre-queries
Check user Visibility
Check filter selectivity
Write query-based on
results of pre-queries
Execute query
User Visibility
# of rows that the user can access
=
Filter Selectivity
How specificis this filter?=
Multi-tenant Query Optimizer
SharedVisibility
SharedIndexes
ID Data 1 Data 2
10002 unus erat toto naturae
10003 vultus in orbe
10004 quem dixere chaeos
10005 rudis indigestaque
10006 meis perpetuum
10007 deducite temopra
10008 carmen ante
10009 mare et terras
10010 tegit et quod
10011 omnia caelum
10012 unus erat totonaturae
10013 vultus in orbe
10014 quem dixere chaeos
10015 rudis indigestaque
10016 meis perpetuum
10017 deducite temopra
10018 carmen ante
10019 mare et terras
10020 tegit et quod
10021 omnia caelum
10022 unus erat toto naturae
10023 vultus in orbe
10024 quem dixere chaeos
10025 rudis indigestaque
10026 meis perpetuum
10027 deducite temopra
10028 carmen ante
10029 mare et terras
10030 tegit et quod
10031 omnia caelum
10032 unus erat toto naturae
10033 vultus in orbe
ID Data 1 Data 2
10002 unus erat toto naturae
10003 vultus in orbe
10004 quem dixere chaeos
10005 rudis indigestaque
10006 meis perpetuum
10007 deducite temopra
10008 carmen ante
10009 mare et terras
10010 tegit et quod
10011 omnia caelum
10012 unus erat totonaturae
10013 vultus in orbe
10014 quem dixere chaeos
10015 rudis indigestaque
10016 meis perpetuum
10017 deducite temopra
10018 carmen ante
10019 mare et terras
10020 tegit et quod
10021 omnia caelum
10022 unus erat toto naturae
10023 vultus in orbe
10024 quem dixere chaeos
10025 rudis indigestaque
10026 meis perpetuum
10027 deducite temopra
10028 carmen ante
10029 mare et terras
10030 tegit et quod
10031 omnia caelum
10032 unus erat toto naturae
10033 vultus in orbe
Stop
Go
Multi-tenant Optimizer Statistics
Apex REST (Pilot)
APEX Web Services exposed via REST– Allow for custom built web services to be exposed by
customers and partners using REST architecture
– Well suited for Mobile and Cloud applications
Annotation in the APEX class:– @RestResource , @HttpGet, @HttpPost, @HttpPatch, @HttpDelete
Support XML and JSON formats
Apex Rest (Pilot)@RestResource(urlMapping='/CaseManagement/*')global with sharing class CaseManagementRESTSvc {
@HttpGetglobal static Case getCaseRecord(RestRequest req, RestResponse res) {
String caseNum = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Case c = [select id, CaseNumber from Case where caseNumber = :caseNum];
return c;
}
@HttpPostglobal static Case createCaseRecord(RestRequest req, RestResponse res) {
CompositeCaseRecord compositeCaseRec = new CompositeCaseRecord();
Case c = CreateCustomCaseRecord.createCase(compositeCaseRec);
return c;
}
@HttpDeleteglobal static void deleteCaseRecord(RestRequest req, RestResponse res) {
String caseNum = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Case c = [select id, CaseNumber from Case where caseNumber = :caseNum];
delete c;
}
}
Apex Rest (Pilot)public with sharing class CreateCustomCaseRecord {
public static Case createCase( CompositeCaseRecord caseRecord )
{
Savepoint sp = Database.setSavepoint();try
{
Case c = new Case();
c.Status = 'New';
Account a = new Account (Backend_Acct_Number__c = caseRecord.acctNumber);
c.Account = a;
insert c;
c = [select id, CaseNumber, subject, Description, Priority from Case where id=:c.Id];
Labor__c labor = new Labor__c();
labor.Case__c = c.id;
labor.Rate__c = caseRecord.labor_rate;
insert labor;
return c;
}catch (Exception e)
{
Database.rollback(sp);throw e;
}
}
}
FAQ: http://blog.sforce.com/sforce/2011/05/apex-rest-services-in-summer-11.html
Real-time Cloud Apps
Streaming API (Pilot)
Provide a stream of updates based on data changes– Admin define topics via continuous queries
– System runs queries based on a Topic
– Relevance matching kicks in and fetch updates
– Clients subscribe to Topics and listen for updates
Use Cases includes:– Near real time updates: Call Centers, Financial Apps, Calendar
– Data synchronization – immediate updates
– General purpose notifications upon saves and deletes
– Push notifications to mobile devices
Streaming API - Logical Flow
Salesforce.comAccountContacts
LeadsOpportunities
Custom Objects
App ServerManage
SubscriptionsSend
Updates
1. Relevance Checks2. Push Notification Processor3. Event Dispatch4. Query, CRUD, FLS Sharing
Data Changes Processing Updates Notifications
Optimizing Cloud Applications
Large Data Volumes
Bulk API Query
Allow for data to be retrieved via SOQL query– Up to 10 files of 1Gb each file – total of 10Gb
– Query can run for up to 10 attempts, at 10 minutes each
– Results are kept for 7 days in system
– Supports XML and CVS formats
– View results on Monitoring Page
Allow for full LDV lifecycle of data in/out of Salesforce
Scaling Apex Triggers
Basic Trigger Architecture (Bulkification)– Preprocessing
• Query needed rows
• Arrange into data structures
– “The Main For-Loop”• Use a main for loop to ensure that no records are left behind
• Avoid queries and DML operations within for loops
– Clean up and final steps• DML operations
• Emails/Notifications
Asynchronous Processing
NOW
vs.
LATERMove processing that is large or not immediately needed by the user to async
• Avoid limits• Better usability• Higher through-put
Scaling to Large Data
Asynchronous Apex– @Future methods
• Lightweight
• Easy to use (simple method annotation)
• Great for smaller transactions
– Batch Apex• Heavy duty (interface to implement)
• Can process up to 50M rows
But wait, the DevZone has more!
HackathonCheck out the Finale, Thurs, 2:30pm
Open Source LabDiscover new & interesting open projects
Lightning ForumDrop in for a quick blast of knowledge
Tech DemosSee and learn the latest from the experts
Code ConsultationsSign up for 1:1 sessions at the Welcome Desk
@forcedotcom
Watch your inbox at the end of each day for an email from our survey partner, Alliance Tech.
Click on the personalized link to be directed to the survey page for the sessions you attended.
How Could Dreamforce Be Even Better? Tell Us!
Every session survey you submit is a chance to win
an iPad 2!