fzi karlsruhe - social applications in the cloud
DESCRIPTION
Talk at FZI Karlsruhe about OpenSocial and Google App Engine.Titel:"Social Applications in the Cloud: OpenSocial and Google App Engine"Abstract:OpenSocial is an open specification defining a common API that works on many different social websites, including MySpace, Plaxo, Hi5, Ning, orkut, Salesforce.com and LinkedIn, among others. This allows developers to learn one API, then write a social application for any of those sites: Learn once, write anywhere.In addition, in order to make it easier for developers of social sites to implement the API and make their site an OpenSocial container, the Apache project Shindig provides reference implementations for OpenSocial containers in two languages (Java, PHP). Shindig defines a language specific Service Provider Interface (SPI) that a social site can implement to connect Shindig to People, Persistence and Activities backend services for the social site. Shindig will then expose these services as OpenSocial JavaScript and REST APIs.In this talk, we will explain what OpenSocial is, show examples of OpenSocial containers and applications, demonstrate how to create an OpenSocial application, and explain how to leverage Apache Shindig in order to implement an OpenSocial container.Simple OpenSocial applications can be built without any server side logic, leveraging the OpenSocial persistence API. For more complex applications requiring server side logic, many developers choose to use their own server. As their applications spread virally and become more successful, these developers end up spending most of their time making their applications scale instead of adding new features.Cloud computing services can provide a solution to these problems. We will explain how to build an OpenSocial application with server side business logic, on top of Google App Engine, a Cloud Computing service exposing Google's scalable infrastructure (GFS, BigTable) to developers.We will discuss how to use the Django web framework with the datastore API provided by Google App Engine to build scalable OpenSocial web applications with minimal fuss.TRANSCRIPT
Social Applications in the CloudOpenSocial and Google App Engine
Google APIs Evangelist: Patrick Chanezon
Paris - San FranciscoAPI Evangelist - OpenSocialCheckout, AdWordsSoftware plumberJava geek… in scripting rehab: Ruby, JavaScript, PHP, PythonOpen Source: ROME, AdWords (Java, C#, Ruby)Sun: Blogs, Portals, eCommerceNetscape/AOL: LDAP, Calendar, App Servers, CMS, MyNetscape (RSS)More on my blog http://wordpress.chanezon.com
Links and slides at http://del.icio.us/chanezon/
Agenda
Google APIsOpenSocial IntroductionHow to build OpenSocial ApplicationsOpenSocial Containers Becoming an OpenSocial containerCloud ComputingGoogle App EngineOpenSocial and Google App EngineSummary
Google APIs
Why are we doing do it?Our mission: “Organize the world’s information and make it universally accessible and useful”
We can’t organize it all ourselves14 Google APIs on http://code.google.com… and counting!
Google Data API
Calendar API
Maps APIAdWords APIBlogger APIData APIsDesktop SDKEarth (KML)
Enterprise APIs Homepage APIRelated LinksSitemapsTalk (XMPP)Toolbar APIWeb Search API
(Circa November 2006, Mainz)
Google APIs
Why are we doing do it?Our mission: “Organize the world’s information and make it universally accessible and useful”
We can’t organize it all ourselves32 Google APIs on http://code.google.com… and counting!
Checkout APIData API
8 servicesMaps APIAdWords APIAjax Search APIAjax Feed APIDesktop SDK
Enterprise APIs Homepage APIYouTube APISitemapsTalk (XMPP)Toolbar APIGoogle Web Toolkit…
(Circa May 2007, Buenos Aires)
Google APIs
Why are we doing do it?Our mission: “Organize the world’s information and make it universally accessible and useful”
We can’t organize it all ourselves37 Google APIs on http://code.google.com/apis… and counting!
Checkout APIData API
8 servicesMaps APIAdWords APIAjax Search APIAjax Feed APIDesktop SDK
Enterprise APIs Homepage APIYouTube APISitemapsTalk (XMPP)Toolbar APIGoogle Web Toolkit…
(Circa September 2007, San Francisco)
Google APIs Today (July 2008, Karlsruhe)
var window = new Object();load('http://code.google.com/js/codesite_product_dictionary.js');print(window['CODESITE_productDictionary'].products.keys.length);62
Including 4 Platforms
Why are we doing do it?Our mission (it has not changed): “Organize the world’s information and make it universally accessible and useful”
We can’t organize it all ourselvesN Google APIs on http://code.google.com/apis… and counting!I had to modify my script since april: http://wordpress.chanezon.com/?p=60
Making the web betterby making it social
What does social mean?
What does Social mean?
Eliette what do you do with your friends?
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
Raoul: a social object for Charlotte (3 year old)
Jaiku’s Jyri Engeström's 5 rules for social networks: social objects
1. What is your object?2. What are your verbs?3. How can people share the objects? 4. What is the gift in the invitation?5. Are you charging the publishers or the spectators?http://tinyurl.com/yus8gw
How do we socialize objects online
without having to create yet another social network?
Standards create markets: Hal Varian
OpenSocial is a straightforward application of chapters 8 and 9 of his 1998 book "Information Rules"“Standards change competition for a market to competition within a market”
Network EffectsLock-In and Switching CostsStandards
OpenSocial
A common API for social applications across multiple web sites
OpenSocial Foundation
OpenSocial Foundationhttp://opensocial.org/Keep the specification open
Specifications discussed in public forumSpec evolves using an open source community process
friendster®
OpenSocial Containers
OpenSocial Numbers
88 days old275,000,000 users66,000,000 installs2,000+ apps20,000 developers10,000,000 daily app users
Standards-based
html+javascript+REST+oauth
Why should you care about OpenSocial?
Developers: Distribution >275 Million users
Containers: Features
Users: More applications
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
A standard for everyone
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
How To Build OpenSocial Applications - Chris Schalk
OpenSocial Client API
JavaScript - version 0.7 productionStandard Web development technologies
HTML + JavascriptCan integrate with 3rd party server
REST ServicesBased on Atom publishing protocolAtomPub and JSON
OpenSocial JavaScript API
People & Friends Access friends information programmatically
ActivitiesSee what you’re friends are up toShare what you are doing
PersistenceProvide state without a serverShare data with your friends
The core OpenSocial Services include
People & Friends ExampleRequesting friend Info
function getFriendData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(VIEWER), 'viewer'); req.add(req.newFetchPeopleRequest(VIEWER_FRIENDS), 'viewerFriends'); req.send(onLoadFriends);}
People & Friends Example
function onLoadFriends(resp) { var viewer = resp.get('viewer').getData(); var viewerFriends = resp.get('viewerFriends').getData(); var html = 'Friends of ' + viewer.getDisplayName() + ‘:<br><ul>’; viewerFriends.each(function(person) { html += '<li>' + person.getDisplayName()+'</li>';}); html += '</ul>'; document.getElementById('friends').innerHTML = html;}
Callback function for returned friend data
Activities Example
function postActivity(text) { var params = {}; params[opensocial.Activity.Field.TITLE] = text; var activity = opensocial.newActivity(params); opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, callback);}postActivity("This is a sample activity, created at " + new Date().toString())}
Posting an activity
Persistence Example
function populateMyAppData() { var req = opensocial.newDataRequest(); var data1 = Math.random() * 5; var data2 = Math.random() * 100;
req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField1", data1)); req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField2", data2)); req.send(requestMyData);}
Persisting data
Persistence Example
function requestMyData() { var req = opensocial.newDataRequest(); var fields = ["AppField1", "AppField2"];
req.add(req.newFetchPersonRequest( opensocial.DataRequest.PersonId.VIEWER), "viewer"); req.add(req.newFetchPersonAppDataRequest("VIEWER", fields), "viewer_data"); req.send(handleReturnedData);}
Fetching persisted data
Persistence Example
function handleReturnedData(data) { var mydata = data.get("viewer_data"); var viewer = data.get("viewer"); me = viewer.getData(); // me is global var var data = mydata[me.getId()];
htmlout += "AppField1: " + data["AppField1"] + "<br/>"; htmlout += "AppField2: " + data["AppField2"] + "<br/>"; var div = document.getElementById('content_div'); div.innerHTML = htmlout;}
Displaying fetched (persisted) data
Demonstration - Building OpenSocial Applications using the JavaScript API
Server-side REST Services
/people/{guid}/@all -- Collection of all people connected to user {guid}
/people/{guid}/@friends -- Collection of all friends of user {guid} -- subset of @all
/people/{guid}/@self -- Profile record for user {guid}
/people/@me/@self -- Profile record for requestor
Accessing People information
Server-side REST Services
/activities/{guid}/@self -- Collection of activities generated by given user
/activities/{guid}/@friends -- Collection of activities for friends of the given user {guid}
Accessing Activities information
Server-side REST Services
/appdata/{guid}/@self/{appid} -- All data for user {guid}, app {appid}
/appdata/{guid}/@friends/{appid} -- All data for friends of user {guid} and app {appid}; read-only
Accessing Persistent data
Server-side REST Services
format={format} -- Format desired; one of (atom, json); default is json fields={field+} -- List of fields to include in request
startPage={startPage} -- Index into a paged collection
count={count} -- Set page size for paged collection
Additional query parameters
Resources For Application DevelopersSpecificationhttp://opensocial.org/http://groups.google.com/group/opensocial-and-gadgets-spec
Code Samples and Toolshttp://code.google.com/opensocialhttp://code.google.com/p/opensocial-resources/
Sandboxeshttp://developer.myspace.com/http://www.hi5networks.com/developer/http://opensocial.ning.com/http://code.google.com/apis/orkut/http://code.google.com/apis/igoogle/http://en.netlog.com/go/developer/opensocial
OpenSocial Containers - Kevin Marks
Containers provide a social context
OpenSocial separates application logic from social contextan app sees user ids - the container makes them peopleUsers understand the social contract of the containersSave apps and users from re-registration hell
Containers don’t choose users
Containers set up the social model, users choose to jointhey grow through homophily and affinityNetwork effect can bring unexpected userbases
OpenSocial gets you to all their users
You don't have to pick a site to specialise forYou get to spread through multiple friend groupsYou'll be surprised by where your users areso make sure you plan to localize
Not just Social Network Sites
Social network sites - Profiles and home pagesPersonal dashboardsSites based around a Social ObjectCorporate CRM systemsAny web site
How do we abstract these out?
Viewer + friendsOwner + friends
The Viewer and Viewer friends
Owner and Owner friends
Owner and Viewerare defined by Container
The Application gets IDs and connections to other IDs
the Owner need not be a PersonIt could be an organisation
or a social object
Kinds of container - Social network sites
Profile pagesOwner is profile page ownerViewer may not be known, may be owner or other member
Home pagesOwner is Viewer (must be logged in to see)
ExamplesMySpaceHi5Orkut
Kinds of container - Personal dashboard
like Home pagesOwner is Viewer (must be logged in to see)
Friends may not be definedExample:
iGoogle, My Yahoo
Kinds of container - Social Object site
Pages reflect the object - movie, picture, productOwner is the objectOwner friends are people connected to the object
may be authors or fansViewer is looking at it, Viewer friends are people you may want to share with
Example:Imeem is a bit like this - opportunity for sites like Flickr, YouTube
Kinds of container - CRM systems
Pages reflect the customer Owner is the customerOwner friends are people connected to the customer
may be your colleagues, or other customersViewer is you, Viewer friends are your colleagues or customers
Example:Oracle CRM, Salesforce
Kinds of container - Any web site
Owner is the site
Owner friends are site usersViewer is you,
Viewer friends are your friends who have visited this siteExample:
Google Friend Connect will enable this for any site
Container Sites control policy
Check the EnvironmentGetting information
Viewer information may not be availableor it may be hidden from youCall requestPermission API that can prompt the users
Spreading your applicationActivities display under container controlRequestSendMessageRequestShareApp
Monetization and Installation
Meet the Containers (next session)Best Practices for Spreading your App (tomorrow)
Becoming an Open Social Container - Chris Schalk
Becoming an OpenSocial Container
Question: How do you become an OpenSocial container?
Answer: Utilize existing Open Source container code.
The Apache incubator project “Shindig” serves this purpose!
Apache Shindig
What is Shindig?Open source software that allows you to host OpenSocial applications
Is currently an Apache Software Incubator project Heavy partner involvement (Ning, hi5 …) Serves as open source reference implementation of OpenSocial & gadgets technologies
It’s Goal: “Shindig's goal is to allow new sites to start hosting social apps in well under an hour's worth of work"
Apache Shindig Info...Apache Shindig Website
http://incubator.apache.org/shindig
SocialSiteSocialSite is an Open Source project that allows you to turn your web application in an OpenSocial containerLeverages Apache ShindigBuilt by Sun (Dave "Roller" Johnson), announced at JavaOne this monthAdds a database and widgets to manage your social network
SocialSite Architecture
Details at https://socialsite.dev.java.net/
Google Friend ConnectUsers
... more ways to do more things with my friends
Site owners... more (and more engaged) traffic for my site
App developers... more reach for my apps
http://google.com/friendconnect/sign up for the preview release
ingridmichaelson.com
SummaryOpenSocial is making the web more socialThe current version 0.7 is in production
REST API and 0.8 coming soon
Developers can start creating social applications todayOrkut, Myspace, hi5, Netlog open to 200 M users nowiGoogle, IDTail, Hyves, Imeem sandboxes
Social sites: implement OpenSocial get Shindig and start planningSocialSiteFriend Connect
Advertisers: create brand advertising Apps now
Cloud Computing
Cloud Computing
Grid ComputingGlobus Toolkit
Amazon Web ServicesEC2S3SimpleDbSQS
JoyentFacebook and OpenSocial accelerators
Google App Engine
"We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris .”Larry Wall, Programming Perl (1st edition), Oreilly And AssociatesWorks for Python programmers too:-)
Larry and Guido (Credits Tim Bray http://www.tbray.org/ongoing/)
Google App Engine
We run web applications
We handle the entire lifecycle of an app
Apps are run on Google infrastructure
1. Scalable Serving Infrastructure
2. Python Runtime
3. Software Development Kit
4. Web based Admin Console
5. Datastore
Authenticate with Google Accounts
Memcache
Send E-Mail
Transform Images
Billing and Expected Pricing
Free Quota Price500 MB Storage FREE5 Million Pageviews per Month FREE
Additional Resources PriceCPU ($ / core-hour) $0.09 - $0.12Storage ($ / GB-month) $0.15 - $0.18Bandwidth - Outgoing ($ / GB transferred) $0.10 - $0.14Bandwidth - Incoming ($ / GB transferred) $0.10 - $0.12
OpenSocial and the need the Cloud
Social App’s main issue: when viral growth kicks in, how do you scale your app?OpenSocial persistence API limited in volume and capability
OpenSocial ServerSide Integration Options
Establish a "home" site where gadget can phone home to retrieve, post data
Can host home site on your own, or use services:Amazon EC2JoyentGoogle AppEngine
In addition to using the provided persistence API...
Google AppEngine and OpenSocial
Create an App Engine app as your backend!Use makeRequest() to call back to your AppEngine serverUtilize AppEngine's datastore
New OpenSocial Apps are coming onlineBuddyPoke...
Checkout Lane Liabraaten’s OpenSocial-AppEngine integration article
http://code.google.com/apis/opensocial/articles/appengine.html
Google IO Code Lab about OpenSocial Apps in the Cloud
Demo: Gifts Application on App Engine
Original gifts application athttp://code.google.com/p/opensocial-resources/
Google App Engine version athttp://code.google.com/p/opensocial-gifts/
More Presentations about this
Markus Klems excellent PDF slideshttp://markusklems.wordpress.com/2008/06/26/opensocial-applications-in-the-cloud/
Avoid Lock-In
Good discussion athttp://highscalability.com/google-appengine-second-look
Open Source projects around App Enginehttp://groups.google.com/group/google-appengine/web/google-app-engine-open-source-projects
Open Source Implementation of App EngineApp Engine SDK is Open SourceApp Engine Launcher on MacAppDrop, open source implementation of App Engine
Google Code University
Google and IBM, University of Washington
MapReduce, Hadoop, BigTable
http://code.google.com/edu/parallel/
Questions