fzi karlsruhe - social applications in the cloud

92
Social Applications in the Cloud OpenSocial and Google App Engine

Upload: patrick-chanezon

Post on 19-May-2015

7.064 views

Category:

Business


0 download

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

Page 1: Fzi Karlsruhe - Social Applications In The Cloud

Social Applications in the CloudOpenSocial and Google App Engine

Page 2: Fzi Karlsruhe - Social Applications In The Cloud

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/

Page 3: Fzi Karlsruhe - Social Applications In The Cloud

Agenda

Google APIsOpenSocial IntroductionHow to build OpenSocial ApplicationsOpenSocial Containers Becoming an OpenSocial containerCloud ComputingGoogle App EngineOpenSocial and Google App EngineSummary

Page 4: Fzi Karlsruhe - Social Applications In The Cloud

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)

Page 5: Fzi Karlsruhe - Social Applications In The Cloud

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)

Page 6: Fzi Karlsruhe - Social Applications In The Cloud

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)

Page 7: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 8: Fzi Karlsruhe - Social Applications In The Cloud

Making the web betterby making it social

What does social mean?

Page 9: Fzi Karlsruhe - Social Applications In The Cloud

What does Social mean?

Eliette what do you do with your friends?

Page 10: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 11: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 12: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 13: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 14: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 15: Fzi Karlsruhe - Social Applications In The Cloud

Raoul: a social object for Charlotte (3 year old)

Page 16: Fzi Karlsruhe - Social Applications In The Cloud
Page 17: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 18: Fzi Karlsruhe - Social Applications In The Cloud

How do we socialize objects online

without having to create yet another social network?

Page 19: Fzi Karlsruhe - Social Applications In The Cloud
Page 20: Fzi Karlsruhe - Social Applications In The Cloud
Page 21: Fzi Karlsruhe - Social Applications In The Cloud
Page 22: Fzi Karlsruhe - Social Applications In The Cloud
Page 23: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 24: Fzi Karlsruhe - Social Applications In The Cloud

OpenSocial

A common API for social applications across multiple web sites

Page 25: Fzi Karlsruhe - Social Applications In The Cloud

OpenSocial Foundation

OpenSocial Foundationhttp://opensocial.org/Keep the specification open

Specifications discussed in public forumSpec evolves using an open source community process

Page 26: Fzi Karlsruhe - Social Applications In The Cloud
Page 27: Fzi Karlsruhe - Social Applications In The Cloud

friendster®

OpenSocial Containers

Page 28: Fzi Karlsruhe - Social Applications In The Cloud

OpenSocial Numbers

88 days old275,000,000 users66,000,000 installs2,000+ apps20,000 developers10,000,000 daily app users

Page 29: Fzi Karlsruhe - Social Applications In The Cloud

Standards-based

html+javascript+REST+oauth

Page 30: Fzi Karlsruhe - Social Applications In The Cloud

Why should you care about OpenSocial?

Developers: Distribution >275 Million users

Containers: Features

Users: More applications

Page 31: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 32: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 33: Fzi Karlsruhe - Social Applications In The Cloud

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 34: Fzi Karlsruhe - Social Applications In The Cloud

A standard for everyone

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Page 35: Fzi Karlsruhe - Social Applications In The Cloud

How To Build OpenSocial Applications - Chris Schalk

Page 36: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 37: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 38: Fzi Karlsruhe - Social Applications In The Cloud

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);}

Page 39: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 40: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 41: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 42: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 43: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 44: Fzi Karlsruhe - Social Applications In The Cloud

Demonstration - Building OpenSocial Applications using the JavaScript API

Page 45: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 46: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 47: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 48: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 49: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 50: Fzi Karlsruhe - Social Applications In The Cloud

OpenSocial Containers - Kevin Marks

Page 51: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 52: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 53: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 54: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 55: Fzi Karlsruhe - Social Applications In The Cloud

The Viewer and Viewer friends

Page 56: Fzi Karlsruhe - Social Applications In The Cloud

Owner and Owner friends

Page 57: Fzi Karlsruhe - Social Applications In The Cloud

Owner and Viewerare defined by Container

The Application gets IDs and connections to other IDs

Page 58: Fzi Karlsruhe - Social Applications In The Cloud

the Owner need not be a PersonIt could be an organisation

or a social object

Page 59: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 60: Fzi Karlsruhe - Social Applications In The Cloud

Kinds of container - Personal dashboard

like Home pagesOwner is Viewer (must be logged in to see)

Friends may not be definedExample:

iGoogle, My Yahoo

Page 61: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 62: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 63: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 64: Fzi Karlsruhe - Social Applications In The Cloud

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)

Page 65: Fzi Karlsruhe - Social Applications In The Cloud

Becoming an Open Social Container - Chris Schalk

Page 66: Fzi Karlsruhe - Social Applications In The Cloud

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!

Page 67: Fzi Karlsruhe - Social Applications In The Cloud

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"

Page 68: Fzi Karlsruhe - Social Applications In The Cloud

Apache Shindig Info...Apache Shindig Website

http://incubator.apache.org/shindig

Page 69: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 70: Fzi Karlsruhe - Social Applications In The Cloud

SocialSite Architecture

Details at https://socialsite.dev.java.net/

Page 71: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 72: Fzi Karlsruhe - Social Applications In The Cloud

ingridmichaelson.com

Page 73: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 74: Fzi Karlsruhe - Social Applications In The Cloud

Cloud Computing

Page 75: Fzi Karlsruhe - Social Applications In The Cloud

Cloud Computing

Grid ComputingGlobus Toolkit

Amazon Web ServicesEC2S3SimpleDbSQS

JoyentFacebook and OpenSocial accelerators

Page 76: Fzi Karlsruhe - Social Applications In The Cloud

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/)

Page 77: Fzi Karlsruhe - Social Applications In The Cloud

Google App Engine

Page 78: Fzi Karlsruhe - Social Applications In The Cloud
Page 79: Fzi Karlsruhe - Social Applications In The Cloud
Page 80: Fzi Karlsruhe - Social Applications In The Cloud
Page 81: Fzi Karlsruhe - Social Applications In The Cloud

We run web applications

We handle the entire lifecycle of an app

Apps are run on Google infrastructure

Page 82: Fzi Karlsruhe - Social Applications In The Cloud

1. Scalable Serving Infrastructure

2. Python Runtime

3. Software Development Kit

4. Web based Admin Console

5. Datastore

Page 83: Fzi Karlsruhe - Social Applications In The Cloud

Authenticate with Google Accounts

Memcache

Send E-Mail

Transform Images

Page 84: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 85: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 86: Fzi Karlsruhe - Social Applications In The Cloud

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...

Page 87: Fzi Karlsruhe - Social Applications In The Cloud

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

Page 88: Fzi Karlsruhe - Social Applications 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/

Page 89: Fzi Karlsruhe - Social Applications In The Cloud

More Presentations about this

Markus Klems excellent PDF slideshttp://markusklems.wordpress.com/2008/06/26/opensocial-applications-in-the-cloud/

Page 90: Fzi Karlsruhe - Social 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

Page 91: Fzi Karlsruhe - Social Applications In The Cloud

Google Code University

Google and IBM, University of Washington

MapReduce, Hadoop, BigTable

http://code.google.com/edu/parallel/

Page 92: Fzi Karlsruhe - Social Applications In The Cloud

Questions