SlideShare a Scribd company logo
1 of 92
Download to read offline
DEVELOPING WITH CLOUD
       SERVICES
              Chris Richardson

        Author of POJOs in Action
  Founder of the original CloudFoundry.com

                 @crichardson
         crichardson@vmware.com
         http://plainoldobjects.com/
Presentation goal

  How to build robust,
scalable applications with
     Cloud Services
About Chris
(About Chris)
About Chris()
About Chris
About Chris




http://www.theregister.co.uk/2009/08/19/springsource_cloud_foundry/
vmc push About-Chris


    Developer Advocate for
      CloudFoundry.com

Signup at http://cloudfoundry.com
     promo code: cfjavaone
Agenda


• Why   use cloud services?

• Developing    location-based applications

• Building   SMS and telephony enabled applications

• Developing    robust, fault tolerant applications
Three phases of every galactic
          civilization
Survival
Inquiry
Sophistication
Three phases of every galactic
          civilization
How can we eat?
Why do we eat?
Where shall we have lunch?
Where shall we
 have lunch?
     Solved by
  VoteMeetEat.com
VoteMeetEat.com

•What restaurants are nearby?
•Which friends are close by?
•Where do your friends prefer to eat?




                                        To sign up text
                                         "register" to
                                         510-555-????
VoteMeetEat.com

 Restaurant database
          +
        SMS
          +
      Voice calls
                   To sign up text
                    "register" to
                    510-555-????
Key story: registration




             5
551212
Key story: registration

            +5105551212
Key story: voting
        555 1212
Key story: announce location
VOTEMEETEAT.COM

To sign up text
 "register" to
 510-555-????
High-level architecture
                        DIY = DIFFICULT

          Telephony                    Friend Geo
          Integration                   Database
Mobile                      VoteMeet
Phone                          Eat

                                       Restaurant
                                       Database
  Do we really want to
     build all this?
Use cloud-based services


•   Highly scalable services

•   Someone else’s headache to develop and maintain

•   Provided by IaaS/PaaS

•   Provided by 3rd party
Cloud Foundry services
Thousands of 3rd party services




 http://www.slideshare.net/jmusser/j-musser-apishotnotgluecon2012
         http://www.programmableweb.com/apis/directory
Cloud service trends

• Predominantly     REST

• Predominantly     JSON

•> billion API calls/day: Twitter, Google, Facebook, Netflix,
 Accuweather, ...

• Increasing   number of API-only companies

        http://www.slideshare.net/jmusser/j-musser-apishotnotgluecon2012
Diverse
Benefits of cloud services

• Someone      else’s headache to develop and operate

• Focus   on your core business problem

• Get   up and running quickly

• Elasticity

• Capex        Opex
Drawbacks of cloud services



• Complexity   and drawbacks of a distributed system

• You   are dependent on service provider
Risks of cloud services




 Urban Airship’s Strategic Partnership With
   SimpleGeo Turns Into An Acquisition
Cloud Services-based
             architecture

           Twilio
                                  MongoDB
Mobile
Phone               VoteMeetEat


                                  Factual.Com
DEMO
Agenda


• Why   use cloud services?

• Developing    location-based applications

• Building   SMS and telephony enabled applications

• Developing    robust, fault tolerant applications
Location-based services are hot!
Developing applications with Cloud Services  #javaone 2012
Client-side APIs for finding
                location
W3C Geolocation API
BUT what about the server-side?
Lots of really difficult problems

• Scalable, spatial database – CRUD records, find nearby
• Data management – database of places, street information
• Forward geo-coding: address lat/lon
• Reverse geo-coding: lat/lon   address
• Maps
• Directions


    Easier to use Geo-aaS
Examples of Geo-aaS

•   Maps                             • Freely available geographic
•   Forward and reverse geocoding      database
•   Directions                       • Various APIs including
•   Elevation                          reverse geocoding
•   Places



• Business+review database          • Places database
• Neighborhood database             • Reverse geocoding


                                                     Beware the terms of
                                                          service
VOTEMEETEAT & Geo

trait FriendService {
    def addOrUpdate(request : AddOrUpdateUserRequest)
    def findNearbyFriends(request : NearbyFriendsRequest) :
                FindNearbyFriendsResponse
}


trait RestaurantService {
  def findNearbyRestaurants(location: Location) :
                  FindNearbyRestaurantResponse
}
Implementing the friends
      database
MongoDB

• Document-oriented       database

• Very   fast, highly scalable and available

• Rich
     query language that supports location-
 based queries

• Provided      by CloudFoundry.com
Storing friends in MongoDB
             MongoDB server

         Database: VoteMeetEat
        Collection: friendRecord

  {
      "_id": "+15105551212",
      "name": "Chris R.",
      "location": {
         "x": -122.25206103187264,
         "y": 37.847427441773796
      }
  }
Spring Data for MongoDB


• Provides   MongoTemplate

• Analogous    to JdbcTemplate

• Hides   boilerplate code

• Domain     object   Document mapping
Using Spring data: creating an
     index on location attribute
@Component
class MongoFriendService extends FriendService {

  @Autowired
  var mongoTemplate: MongoTemplate = _

  @PostConstruct                              Collection name
  def createGeoIndex {
    val dbo = new BasicDBObject
    dbo.put("location", "2d")
    mongoTemplate.getCollection("friendRecord").ensureIndex(dbo)
  }




                             Create geospatial 2d index
Using Spring Data: adding record
@Component
class MongoFriendService extends FriendService {

  override def addOrUpdate(request: AddOrUpdateUserRequest) = {
    val name = request.name
    val phoneNumber = request.phoneNumber
    val fr = new FriendRecord(phoneNumber, name,
              new Point(request.longitude, request.latitude))
    mongoTemplate.save(fr)
  }


              case class FriendRecord(id : String,
                            name : String,
                            location : Point)
Using Spring Data: finding nearby
               friends
@Component
class MongoFriendService extends FriendService {


  override def findNearbyFriends(request: NearbyFriendsRequest) = {
    val location = new Point(request.longitude, request.latitude)
    val distance = new Distance(3, Metrics.MILES)
    val query = NearQuery.near(location).maxDistance(distance)

      val result = mongoTemplate.geoNear(query, classOf[FriendRecord])

      val nearby = result.getContent.map(_.getContent)
      FindNearbyFriendsResponse(nearby.map(f => FriendInfo(f.name, f.id)))
  }
MongoDB and Cloud Foundry


$ vmc create-service mongodb vme-mongo
Binding a service to an application
   $ vmc push vme-user --path web/target/
   Application Deployed URL [cer-spring.cloudfoundry.com]:
   Detected a Java SpringSource Spring Application, is this correct? [Yn]:
   Memory Reservation (64M, 128M, 256M, 512M, 1G) [512M]:
    Creating Application: OK
Would you like to bind anyany services to 'vme-user'? [yN]: y
    Would you like to bind services to 'vme-user'? [yN]: y
Would you like to use an an existing provisioned [yN]: y
    Would you like to use existing provisioned service? service? [yN]:       y
The The following provisioned services are available
     following provisioned services are available
1: vme-mongo
   1: vme-mongo
2: mysql-135e0
   2: mysql-135e0
Please select one you wish to use: use: 1
   Please select one you wish to 1
Binding Service [vme-mongo]: OK OK
   Binding Service [vme-mongo]:
   Uploading Application:
     Checking for available resources: OK
     Processing resources: OK
     Packing application: OK
     Uploading (12K): OK
   Push Status: OK
Connecting to MongoDB
	 <bean id="mongoTemplate"
       class="org.springframework.data.mongodb.core.MongoTemplate">
	 	 <constructor-arg ref="mongoFactory" />
	 </bean>
                                         Outside of Cloud Foundry

	 <beans profile="default">
	 	 <mongo:db-factory id="mongoFactory" dbname="surveygeo" />
	 </beans>

                                          Inside Cloud Foundry

	 <beans profile="cloud">
	 	 <cloud:mongo-db-factory id="mongoFactory" />
	 </beans>
Implementing the restaurant
        database
Using Factual


• Geographic     database as a Service

• Including      800,000 restaurants in the US

• Pricing: 10K   calls day free, pay per use
Factual API

• RESTful/JSON     interface

  • Uses   2-legged OAuth 1.0.

  • Geo    and text filters

  • Pagination

• Libraries   for various languages
Restaurant Service
@Service
class FactualRestaurantService extends RestaurantService {

  @Value("${factual_consumer_key}") var consumerKey: String = _
  @Value("${factual_consumer_secret}") var consumerSecret: String = _

  var factual: ThreadLocal[Factual] = _

  @PostConstruct
                                                               Not thread-safe
  def initialize {
    factual = new ThreadLocal[Factual] {
      override def initialValue() = new Factual(consumerKey, consumerSecret, true)
    }
  }

  override def findNearbyRestaurants(location: Location) = {
    val restaurants = factual.get.fetch("restaurants-us",
         new Query().within(new Circle(location.lat, location.lon, 1000)).limit(5))

      val rs = for (map <- restaurants.getData) yield {
        RestaurantInfo(map.get("name").asInstanceOf[String])
      }

      FindNearbyRestaurantResponse(rs.toList)
                                                         5 restaurants within 1km
  }
...
Agenda


• Why   use cloud services?

• Developing    location-based applications

• Building   SMS and telephony enabled applications

• Developing    robust, fault tolerant applications
The telephony and SMS are
                   important
    7/ waking hr !




http://blog.nielsen.com/nielsenwire/online_mobile/new-mobile-obsession-
                                                                          Nielsen
                        u-s-teens-triple-data-usage/
Reporting traffic light problems in London
Google 2-Factor authentication
VoteMeetEat.com & Telephony

• Handling   registration SMS

• Sending   SMS notifying users to vote

• Handling   incoming voice call from voters:

 • Text-to-speech    of restaurants options

 • Collecting   digits entered via keypad

• Sending   SMS notification of voting results
DIY telephony = Difficult

                                           aS:
                                        y-a
                                  hon
• Difficult   to setup and operate
                            Telep
• Expensive
                     e S MS/
             to   us
        ter
• Complex SMS protocols
   Bet
•…
Telephony/SMS - aaS


• SMS                         • SMS
• Inbound and outgoing calls • Inbound and outgoing calls
• Recording and transcription • Recording and transcription
                              • Twitter
                              • IM
Twilio - Telephony and SMS as a
                service
• REST API
  • Allocate phone numbers
  • Make and receive phone calls
  • Send and receive SMS messages
• Pay per use:
  • Phone calls - per-minute
  • SMS – per SMS sent or received
  • Phone number – per month
• Examples
  •   OpenVBX is a web-based, open source phone system
  •   StubHub – notifies sellers of a pending sale via phone
  •   SurveyMonkey – interactive polling
  •   Salesforce – SMS-based voting for 19,000 conference attendees
Using Twilio                      Manage resources
                                                        Send SMS
                                                   Initiate voice calls


                                     REST API

         Voice
         SMS
                                                       Your
                    Twilio         HTTP GET/         Application
                                     POST



                                     TwiML doc
  Phone number
                             Handle incoming SMS and voice calls
SMS URL + VOICE URL                Respond to user input
Handling SMS registration




             5
551212
Handling SMS registration

               HTTP POST
               http://≪smsUrl≫?From=≪PhoneNumber≫
SMS                                           SMS
      Twilio                             REGISTRATION

               <Response>
                <Sms>To complete registration please
                      go to http://...
                </Sms>
               </Response>
Handling SMS registration




                      TwiML document
                       describing the
                         response
Inviting users to vote



    5551212
Inviting users to vote
POST /2010-04-01/Accounts/≪AccountSID≫/SMS/Messages
 From=+15105551212
&To=+14155551212
&Body=≪MESSAGE≫
Authorization: Basic ....




                Basic auth using Twilio
               AccountSid+AuthToken
Sending SMS using the Spring
            REST Template

@Component
class TwilioService {

	   def sendSms(recipient : String, message : String) = {
	   	   val response = postToTwilio("SMS/Messages",
	   	       Map("From" -> twilioPhoneNumber, "To" -> recipient, "Body" -> message))
	   	   (response  "SMSMessage"  "Sid").text
	   }
Sending SMS using the Spring
@Component
              REST Template
class TwilioService {

                                                                     TODO
    def postToTwilio(resourcePath : String, requestParams : Map[String, String]) = {
	
	    val entity = makeEntity(requestParams)

	    try {
	      val response = restTemplate.postForObject(twilioUrl +
                                                    "/Accounts/{accountSid}/{resource}",
	                                                entity, classOf[String],
                                                 accountSid, resourcePath)
	       XML.loadString(response)
	    } catch {
	       case e : HttpClientErrorException if e.getStatusCode == HttpStatus.BAD_REQUEST =>
	         val body = e.getResponseBodyAsString()
	         val xmlBody = XML.loadString(body)
	         val code = Integer.parseInt((xmlBody  "Code").text)
	         val message = (xmlBody  "Message").text
	         throw new TwilioRestException(message, code)
	    }
}
Voting
   555 1212
Voting
                HTTP POST
                http://≪voiceUrl≫?From=≪PhoneNumber≫

                                          Survey Management
Call            <Response>
       Twilio    <Say> Chris would like to meet and eat. </Say>
                 <Gather action="handleresponse.html"
                         method="POST" numDigits="1">
                  <Say>Press 1 for ....</Say>
                  <Say>Press 2 for ....</Say>
                 </Gather>
                </Response>
Voting
                  HTTP POST
                  http://....handleresponse.html?
                  From=≪PhoneNumber≫&Digits=≪...≫
                                            Survey Management
Digits
                  <Response>
         Twilio       <Say>Thank you for choosing.
                         The most popular place so far is ...
                       </Say>
                      <Pause/>
                      <Say>You will hear from us soon. Good bye</Say>
                      <Hangup/>
                  </Response>
Voting code 1
@Controller
class TwilioController {
  @Autowired
  var surveyManagementService: SurveyManagementService = _

 @RequestMapping(value = Array("/begincall.html"))
 @ResponseBody
 def beginCall(@RequestParam("From") callerId: String) = {
   surveyManagementService.findSurveyByCallerId(callerId) match {
     case None =>
       <Response>
         <Say>Sorry don't recognize your number</Say>
         <Hangup/>
       </Response>
     case Some(survey) =>
       <Response>
         <Say>{ survey.prompt }</Say>
         <Gather action="handleresponse.html" method="POST" numDigits="1">
           {
             for ((choice, index) <- survey.choices zipWithIndex)
               yield <Say>Press { index } for { choice }</Say>
           }
         </Gather>
         <Say>We are sorry you could not decide</Say>
         <Hangup/>
       </Response>
   }
 }
Voting code 2
class TwilioController {
  ...
  @RequestMapping(value = Array("/handleresponse.html"))
  @ResponseBody
  def handleUserResponse(@RequestParam("From") callerId: String,
                         @RequestParam("Digits") digits: Int) = {
    val survey = surveyManagementService.recordVote(callerId, digits)
    <Response>
       <Say>Thank you for choosing. The most popular place so far is
                    { survey.map(_.mostPopularChoice) getOrElse "oops" }
        </Say>
       <Pause/>
       <Say>You will hear from us soon. Good bye</Say>
       <Hangup/>
    </Response>
  }
}
Agenda


• Why   use cloud services?

• Developing    location-based applications

• Building   SMS and telephony enabled applications

• Developing    robust, fault tolerant applications
The need for parallelism
                                  Service B
               b = serviceB()


                                              Call in parallel
                 c = serviceC()
Service A                         Service C



            d = serviceD(b, c)
                                  Service D
Java Futures are a great
        concurrency abstraction


http://en.wikipedia.org/wiki/Futures_and_promises
Akka’s composable futures are
         even better
Using Akka futures
trait FriendService {

    def findNearbyFriends(request : NearbyFriendsRequest) :
                          Future[FindNearbyFriendsResponse]
}
                   trait RestaurantService {

                       def findNearbyRestaurants(location: Location) :
                                   Future[FindNearbyRestaurantResponse]
                   }


    val friendsRequest = NearbyFriendsRequest.fromLocation(vmeRecord.location)
    for (
        (nearbyFriends, nearbyRestaurants) <-
                  friendsService.findNearbyFriends(friendsRequest) zip
                 restaurantService.findNearbyRestaurants(vmeRecord.location)
        ) {

            ....
        }
    }                                                         Two calls execute in parallel
Using external web services =
       Distributed system

         Twilio
                                MongoDB
Mobile
Phone             VoteMeetEat


                                Factual.Com
Internally = Distributed System
       Survey
     management

                                User
                             management

     Registration
        SMS

                    Rabbit
                     MQ
     Registration
      web app

                                VME
                             management
       VME
      web app
Handling failure

Service A                   Service B




            Errors happen
        in distributed systems
About Netflix

         > 1B API calls/day

1 API call   average 6 service calls

    Fault tolerance is essential




                  http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
Use timeouts and retries

       Never wait forever
 Errors can be transient                          retry




                   http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
Use per-dependency bounded thread pool

                   Service A

     Runnable 1               Task 1

     Runnable 2               Task 2
                                                                                   Service B
      Runnable ...            Task ...

    bounded queue         bounded thread pool


       Fails fast if         Limits number of
service is slow or down     outstanding requests



                                                   http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
Use a circuit breaker

         High error rate      stop calling temporarily

            Down     wait for it to come back up

             Slow    gives it a chance to recover

Closed
           errors      Open
           timeout
 success     Half    fail
             open                 http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
On failure
          Return cached data
Avoid
Failing
          Return default data


               Fail fast




                     http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
Aspects + Actors

                    Dependency
     Caller           Invoker         Implements
                      Aspect             circuit
                                     breaker state
                                        machine
                    CircuitBreaker
Equivalent of           Actor
thread pool

                       Worker         Dependency
                        Worker
                       Actor             Stub
                        Actor
@DependencyProxy annotation
 trait RestaurantService {

   def findNearbyRestaurants(location: Location) :
 Future[FindNearbyRestaurantResponse]
 }

 @Service
 @DependencyProxy(circuitBreaker = "factualCircuitBreaker",
                  timeoutInMilliseconds=750)
 class FactualRestaurantService extends RestaurantService {
   ...
 }
Aspect-based Async Execution
@Aspect
class DependencyInvokingAspect {

    @Pointcut("execution(* (@DependencyProxy *).*(..))")
    def dependencyProxyMethods {}

    @Around("dependencyProxyMethods()")
    def invoke(jp: ProceedingJoinPoint) = {
      val a = AnnotationUtils.findAnnotation(jp.getTarget.getClass, classOf[DependencyProxy])
      val actor = findActor(a)
      val timeout = Timeout(a.timeoutInMilliseconds milliseconds)
      actor.ask(InvokeDependency( () => jp.proceed())) (timeout)
    }

}




            Ask actor to invoke jp.proceed() and return Future
See
https://github.com/cer/votemeeteat


    for the Actor code
Summary

Cloud services are highly scalable services developed and
                operated by a 3rd party

     Let’s you focus on your core business problem

   Risk: provider is acquired and stops offering service

 Developing an application that reliably consumes cloud
           services requires careful design
@crichardson crichardson@vmware.com
             http://slideshare.net/chris.e.richardson/




                      Questions?
Sign up for CloudFoundry.com using promo code cfjavaone

More Related Content

What's hot

Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and ScalabilityKarthik Babu Sekar
 
Amazon CloudFront - Delivering Dynamic Content From The Edge
Amazon CloudFront - Delivering Dynamic Content From The EdgeAmazon CloudFront - Delivering Dynamic Content From The Edge
Amazon CloudFront - Delivering Dynamic Content From The EdgeAmazon Web Services
 
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB AtlasWebinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB AtlasMongoDB
 
Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Adrian Cockcroft
 
Professional Frontend Engineering
Professional Frontend EngineeringProfessional Frontend Engineering
Professional Frontend EngineeringNate Koechley
 
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012Amazon Web Services
 
Automating Your Azure Environment
Automating Your Azure EnvironmentAutomating Your Azure Environment
Automating Your Azure EnvironmentMichael Collier
 
Windows Azure for Developers - Building Block Services
Windows Azure for Developers - Building Block ServicesWindows Azure for Developers - Building Block Services
Windows Azure for Developers - Building Block ServicesMichael Collier
 
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDBWebinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDBMongoDB
 
Responsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at ScaleResponsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at Scalescottjehl
 
Couchbase Chennai Meetup: Developing with Couchbase- made easy
Couchbase Chennai Meetup:  Developing with Couchbase- made easyCouchbase Chennai Meetup:  Developing with Couchbase- made easy
Couchbase Chennai Meetup: Developing with Couchbase- made easyKarthik Babu Sekar
 
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudWindows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudMichael Collier
 
cloud conference 2013 - Infrastructure as a Service in Amazon Web Services
cloud conference 2013 - Infrastructure as a Service in Amazon Web Servicescloud conference 2013 - Infrastructure as a Service in Amazon Web Services
cloud conference 2013 - Infrastructure as a Service in Amazon Web ServicesVMEngine
 
Why we chose mongodb for guardian.co.uk
Why we chose mongodb for guardian.co.ukWhy we chose mongodb for guardian.co.uk
Why we chose mongodb for guardian.co.ukGraham Tackley
 
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)Amazon Web Services
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Datadeimos
 
What's New for the Windows Azure Developer? Lots!!
What's New for the Windows Azure Developer?  Lots!!What's New for the Windows Azure Developer?  Lots!!
What's New for the Windows Azure Developer? Lots!!Michael Collier
 
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Lucas Jellema
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...Amazon Web Services Japan
 

What's hot (20)

Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
Couchbase Sydney meetup #1    Couchbase Architecture and ScalabilityCouchbase Sydney meetup #1    Couchbase Architecture and Scalability
Couchbase Sydney meetup #1 Couchbase Architecture and Scalability
 
Amazon CloudFront - Delivering Dynamic Content From The Edge
Amazon CloudFront - Delivering Dynamic Content From The EdgeAmazon CloudFront - Delivering Dynamic Content From The Edge
Amazon CloudFront - Delivering Dynamic Content From The Edge
 
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB AtlasWebinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
 
Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)
 
Professional Frontend Engineering
Professional Frontend EngineeringProfessional Frontend Engineering
Professional Frontend Engineering
 
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012
MED101 Introduction to Amazon CloudFront - AWS re: Invent 2012
 
Automating Your Azure Environment
Automating Your Azure EnvironmentAutomating Your Azure Environment
Automating Your Azure Environment
 
Windows Azure for Developers - Building Block Services
Windows Azure for Developers - Building Block ServicesWindows Azure for Developers - Building Block Services
Windows Azure for Developers - Building Block Services
 
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDBWebinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
 
Responsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at ScaleResponsive & Responsible: Implementing Responsive Design at Scale
Responsive & Responsible: Implementing Responsive Design at Scale
 
Couchbase Chennai Meetup: Developing with Couchbase- made easy
Couchbase Chennai Meetup:  Developing with Couchbase- made easyCouchbase Chennai Meetup:  Developing with Couchbase- made easy
Couchbase Chennai Meetup: Developing with Couchbase- made easy
 
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudWindows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
 
cloud conference 2013 - Infrastructure as a Service in Amazon Web Services
cloud conference 2013 - Infrastructure as a Service in Amazon Web Servicescloud conference 2013 - Infrastructure as a Service in Amazon Web Services
cloud conference 2013 - Infrastructure as a Service in Amazon Web Services
 
Why we chose mongodb for guardian.co.uk
Why we chose mongodb for guardian.co.ukWhy we chose mongodb for guardian.co.uk
Why we chose mongodb for guardian.co.uk
 
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
AWS re:Invent 2016: Migrating Enterprise Messaging to the Cloud (ENT217)
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
 
Cqrs api v2
Cqrs api v2Cqrs api v2
Cqrs api v2
 
What's New for the Windows Azure Developer? Lots!!
What's New for the Windows Azure Developer?  Lots!!What's New for the Windows Azure Developer?  Lots!!
What's New for the Windows Azure Developer? Lots!!
 
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
 

Viewers also liked

Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Chris Richardson
 
Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Chris Richardson
 
Polygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @OakjugPolygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @OakjugChris Richardson
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012Chris Richardson
 
Decomposing applications for scalability and deployability - svcc sv_code_ca...
Decomposing applications for scalability and deployability  - svcc sv_code_ca...Decomposing applications for scalability and deployability  - svcc sv_code_ca...
Decomposing applications for scalability and deployability - svcc sv_code_ca...Chris Richardson
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Chris Richardson
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Chris Richardson
 
Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Chris Richardson
 
Developing polyglot persistence applications (gluecon 2013)
Developing polyglot persistence applications (gluecon 2013)Developing polyglot persistence applications (gluecon 2013)
Developing polyglot persistence applications (gluecon 2013)Chris Richardson
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)Chris Richardson
 
Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)Chris Richardson
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Chris Richardson
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Chris Richardson
 

Viewers also liked (14)

Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...
 
Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)Developing polyglot persistence applications (devnexus 2013)
Developing polyglot persistence applications (devnexus 2013)
 
Polygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @OakjugPolygot persistence for Java Developers - August 2011 / @Oakjug
Polygot persistence for Java Developers - August 2011 / @Oakjug
 
Developing polyglot persistence applications #javaone 2012
Developing polyglot persistence applications  #javaone 2012Developing polyglot persistence applications  #javaone 2012
Developing polyglot persistence applications #javaone 2012
 
Decomposing applications for scalability and deployability - svcc sv_code_ca...
Decomposing applications for scalability and deployability  - svcc sv_code_ca...Decomposing applications for scalability and deployability  - svcc sv_code_ca...
Decomposing applications for scalability and deployability - svcc sv_code_ca...
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)
 
Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)Improving application design with a rich domain model (springone 2007)
Improving application design with a rich domain model (springone 2007)
 
Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)Developing polyglot persistence applications (SpringOne China 2012)
Developing polyglot persistence applications (SpringOne China 2012)
 
Developing polyglot persistence applications (gluecon 2013)
Developing polyglot persistence applications (gluecon 2013)Developing polyglot persistence applications (gluecon 2013)
Developing polyglot persistence applications (gluecon 2013)
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
 
Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)Microservices pattern language (microxchg microxchg2016)
Microservices pattern language (microxchg microxchg2016)
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
 

Similar to Developing applications with Cloud Services #javaone 2012

Developing applications with Cloud Services (jax jax2013)
Developing applications with Cloud Services (jax jax2013)Developing applications with Cloud Services (jax jax2013)
Developing applications with Cloud Services (jax jax2013)Chris Richardson
 
Azure and web sites hackaton deck
Azure and web sites hackaton deckAzure and web sites hackaton deck
Azure and web sites hackaton deckAlexey Bokov
 
Couchbase Mobile on Android
Couchbase Mobile on AndroidCouchbase Mobile on Android
Couchbase Mobile on AndroidPhilipp Fehre
 
Running a business in the Cloud with AWS
Running a business in the Cloud with AWSRunning a business in the Cloud with AWS
Running a business in the Cloud with AWSConor O'Neill
 
Introduction to Neo4j and .Net
Introduction to Neo4j and .NetIntroduction to Neo4j and .Net
Introduction to Neo4j and .NetNeo4j
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and rollDavid Giard
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBDenny Lee
 
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event)
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event) Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event)
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event) Codit
 
Understanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST APIUnderstanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST APIChris Beckett
 
MongoDB Mobile
MongoDB Mobile MongoDB Mobile
MongoDB Mobile MongoDB
 
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...MongoDB
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB
 
Social Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DaySocial Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DayTechMaster Vietnam
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS'sMongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS'sMongoDB
 
Technology Overview
Technology OverviewTechnology Overview
Technology OverviewLiran Zelkha
 
WIN401_Migrating Microsoft Applications to AWS
WIN401_Migrating Microsoft Applications to AWSWIN401_Migrating Microsoft Applications to AWS
WIN401_Migrating Microsoft Applications to AWSAmazon Web Services
 
Introduction to Amazon CloudFront - Pop-up Loft Tel Aviv
Introduction to Amazon CloudFront - Pop-up Loft Tel AvivIntroduction to Amazon CloudFront - Pop-up Loft Tel Aviv
Introduction to Amazon CloudFront - Pop-up Loft Tel AvivAmazon Web Services
 
Windows Azure Mobile Services at ReBOOT Cloud Camp , Bangalore
Windows Azure Mobile Services at ReBOOT Cloud Camp , BangaloreWindows Azure Mobile Services at ReBOOT Cloud Camp , Bangalore
Windows Azure Mobile Services at ReBOOT Cloud Camp , BangaloreSenthil Kumar
 

Similar to Developing applications with Cloud Services #javaone 2012 (20)

Developing applications with Cloud Services (jax jax2013)
Developing applications with Cloud Services (jax jax2013)Developing applications with Cloud Services (jax jax2013)
Developing applications with Cloud Services (jax jax2013)
 
Azure and web sites hackaton deck
Azure and web sites hackaton deckAzure and web sites hackaton deck
Azure and web sites hackaton deck
 
Couchbase Mobile on Android
Couchbase Mobile on AndroidCouchbase Mobile on Android
Couchbase Mobile on Android
 
Running a business in the Cloud with AWS
Running a business in the Cloud with AWSRunning a business in the Cloud with AWS
Running a business in the Cloud with AWS
 
Introduction to Neo4j and .Net
Introduction to Neo4j and .NetIntroduction to Neo4j and .Net
Introduction to Neo4j and .Net
 
Cloud and azure and rock and roll
Cloud and azure and rock and rollCloud and azure and rock and roll
Cloud and azure and rock and roll
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
 
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event)
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event) Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event)
Introduction to Azure PaaS services (Nick Trogh at Codit Azure PaaS Event)
 
Understanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST APIUnderstanding and programming the SharePoint REST API
Understanding and programming the SharePoint REST API
 
MongoDB Mobile
MongoDB Mobile MongoDB Mobile
MongoDB Mobile
 
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...
MongoDB World 2019: REST-less Mobile Apps: Why Offline-first and Sync Matters...
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
 
Social Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DaySocial Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech Day
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS'sMongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
 
Technology Overview
Technology OverviewTechnology Overview
Technology Overview
 
WIN401_Migrating Microsoft Applications to AWS
WIN401_Migrating Microsoft Applications to AWSWIN401_Migrating Microsoft Applications to AWS
WIN401_Migrating Microsoft Applications to AWS
 
Introduction to Amazon CloudFront - Pop-up Loft Tel Aviv
Introduction to Amazon CloudFront - Pop-up Loft Tel AvivIntroduction to Amazon CloudFront - Pop-up Loft Tel Aviv
Introduction to Amazon CloudFront - Pop-up Loft Tel Aviv
 
Windows Azure Mobile Services at ReBOOT Cloud Camp , Bangalore
Windows Azure Mobile Services at ReBOOT Cloud Camp , BangaloreWindows Azure Mobile Services at ReBOOT Cloud Camp , Bangalore
Windows Azure Mobile Services at ReBOOT Cloud Camp , Bangalore
 

More from Chris Richardson

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?Chris Richardson
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternChris Richardson
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...Chris Richardson
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Chris Richardson
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsChris Richardson
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfChris Richardson
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Chris Richardson
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...Chris Richardson
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Chris Richardson
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 Chris Richardson
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureChris Richardson
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Chris Richardson
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled servicesChris Richardson
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Chris Richardson
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...Chris Richardson
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Chris Richardson
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...Chris Richardson
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationChris Richardson
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate PlatformChris Richardson
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolithChris Richardson
 

More from Chris Richardson (20)

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-pattern
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patterns
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled services
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders application
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate Platform
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith
 

Recently uploaded

SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTxtailishbaloch
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2DianaGray10
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTopCSSGallery
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)IES VE
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 

Recently uploaded (20)

SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
Top 10 Squarespace Development Companies
Top 10 Squarespace Development CompaniesTop 10 Squarespace Development Companies
Top 10 Squarespace Development Companies
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)The Importance of Indoor Air Quality (English)
The Importance of Indoor Air Quality (English)
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 

Developing applications with Cloud Services #javaone 2012

  • 1. DEVELOPING WITH CLOUD SERVICES Chris Richardson Author of POJOs in Action Founder of the original CloudFoundry.com @crichardson crichardson@vmware.com http://plainoldobjects.com/
  • 2. Presentation goal How to build robust, scalable applications with Cloud Services
  • 8. vmc push About-Chris Developer Advocate for CloudFoundry.com Signup at http://cloudfoundry.com promo code: cfjavaone
  • 9. Agenda • Why use cloud services? • Developing location-based applications • Building SMS and telephony enabled applications • Developing robust, fault tolerant applications
  • 10. Three phases of every galactic civilization Survival Inquiry Sophistication
  • 11. Three phases of every galactic civilization How can we eat? Why do we eat? Where shall we have lunch?
  • 12. Where shall we have lunch? Solved by VoteMeetEat.com
  • 13. VoteMeetEat.com •What restaurants are nearby? •Which friends are close by? •Where do your friends prefer to eat? To sign up text "register" to 510-555-????
  • 14. VoteMeetEat.com Restaurant database + SMS + Voice calls To sign up text "register" to 510-555-????
  • 16. Key story: registration +5105551212
  • 17. Key story: voting 555 1212
  • 19. VOTEMEETEAT.COM To sign up text "register" to 510-555-????
  • 20. High-level architecture DIY = DIFFICULT Telephony Friend Geo Integration Database Mobile VoteMeet Phone Eat Restaurant Database Do we really want to build all this?
  • 21. Use cloud-based services • Highly scalable services • Someone else’s headache to develop and maintain • Provided by IaaS/PaaS • Provided by 3rd party
  • 23. Thousands of 3rd party services http://www.slideshare.net/jmusser/j-musser-apishotnotgluecon2012 http://www.programmableweb.com/apis/directory
  • 24. Cloud service trends • Predominantly REST • Predominantly JSON •> billion API calls/day: Twitter, Google, Facebook, Netflix, Accuweather, ... • Increasing number of API-only companies http://www.slideshare.net/jmusser/j-musser-apishotnotgluecon2012
  • 26. Benefits of cloud services • Someone else’s headache to develop and operate • Focus on your core business problem • Get up and running quickly • Elasticity • Capex Opex
  • 27. Drawbacks of cloud services • Complexity and drawbacks of a distributed system • You are dependent on service provider
  • 28. Risks of cloud services Urban Airship’s Strategic Partnership With SimpleGeo Turns Into An Acquisition
  • 29. Cloud Services-based architecture Twilio MongoDB Mobile Phone VoteMeetEat Factual.Com
  • 30. DEMO
  • 31. Agenda • Why use cloud services? • Developing location-based applications • Building SMS and telephony enabled applications • Developing robust, fault tolerant applications
  • 34. Client-side APIs for finding location W3C Geolocation API
  • 35. BUT what about the server-side?
  • 36. Lots of really difficult problems • Scalable, spatial database – CRUD records, find nearby • Data management – database of places, street information • Forward geo-coding: address lat/lon • Reverse geo-coding: lat/lon address • Maps • Directions Easier to use Geo-aaS
  • 37. Examples of Geo-aaS • Maps • Freely available geographic • Forward and reverse geocoding database • Directions • Various APIs including • Elevation reverse geocoding • Places • Business+review database • Places database • Neighborhood database • Reverse geocoding Beware the terms of service
  • 38. VOTEMEETEAT & Geo trait FriendService { def addOrUpdate(request : AddOrUpdateUserRequest) def findNearbyFriends(request : NearbyFriendsRequest) : FindNearbyFriendsResponse } trait RestaurantService { def findNearbyRestaurants(location: Location) : FindNearbyRestaurantResponse }
  • 40. MongoDB • Document-oriented database • Very fast, highly scalable and available • Rich query language that supports location- based queries • Provided by CloudFoundry.com
  • 41. Storing friends in MongoDB MongoDB server Database: VoteMeetEat Collection: friendRecord { "_id": "+15105551212", "name": "Chris R.", "location": { "x": -122.25206103187264, "y": 37.847427441773796 } }
  • 42. Spring Data for MongoDB • Provides MongoTemplate • Analogous to JdbcTemplate • Hides boilerplate code • Domain object Document mapping
  • 43. Using Spring data: creating an index on location attribute @Component class MongoFriendService extends FriendService { @Autowired var mongoTemplate: MongoTemplate = _ @PostConstruct Collection name def createGeoIndex { val dbo = new BasicDBObject dbo.put("location", "2d") mongoTemplate.getCollection("friendRecord").ensureIndex(dbo) } Create geospatial 2d index
  • 44. Using Spring Data: adding record @Component class MongoFriendService extends FriendService { override def addOrUpdate(request: AddOrUpdateUserRequest) = { val name = request.name val phoneNumber = request.phoneNumber val fr = new FriendRecord(phoneNumber, name, new Point(request.longitude, request.latitude)) mongoTemplate.save(fr) } case class FriendRecord(id : String, name : String, location : Point)
  • 45. Using Spring Data: finding nearby friends @Component class MongoFriendService extends FriendService { override def findNearbyFriends(request: NearbyFriendsRequest) = { val location = new Point(request.longitude, request.latitude) val distance = new Distance(3, Metrics.MILES) val query = NearQuery.near(location).maxDistance(distance) val result = mongoTemplate.geoNear(query, classOf[FriendRecord]) val nearby = result.getContent.map(_.getContent) FindNearbyFriendsResponse(nearby.map(f => FriendInfo(f.name, f.id))) }
  • 46. MongoDB and Cloud Foundry $ vmc create-service mongodb vme-mongo
  • 47. Binding a service to an application $ vmc push vme-user --path web/target/ Application Deployed URL [cer-spring.cloudfoundry.com]: Detected a Java SpringSource Spring Application, is this correct? [Yn]: Memory Reservation (64M, 128M, 256M, 512M, 1G) [512M]: Creating Application: OK Would you like to bind anyany services to 'vme-user'? [yN]: y Would you like to bind services to 'vme-user'? [yN]: y Would you like to use an an existing provisioned [yN]: y Would you like to use existing provisioned service? service? [yN]: y The The following provisioned services are available following provisioned services are available 1: vme-mongo 1: vme-mongo 2: mysql-135e0 2: mysql-135e0 Please select one you wish to use: use: 1 Please select one you wish to 1 Binding Service [vme-mongo]: OK OK Binding Service [vme-mongo]: Uploading Application: Checking for available resources: OK Processing resources: OK Packing application: OK Uploading (12K): OK Push Status: OK
  • 48. Connecting to MongoDB <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongoFactory" /> </bean> Outside of Cloud Foundry <beans profile="default"> <mongo:db-factory id="mongoFactory" dbname="surveygeo" /> </beans> Inside Cloud Foundry <beans profile="cloud"> <cloud:mongo-db-factory id="mongoFactory" /> </beans>
  • 50. Using Factual • Geographic database as a Service • Including 800,000 restaurants in the US • Pricing: 10K calls day free, pay per use
  • 51. Factual API • RESTful/JSON interface • Uses 2-legged OAuth 1.0. • Geo and text filters • Pagination • Libraries for various languages
  • 52. Restaurant Service @Service class FactualRestaurantService extends RestaurantService { @Value("${factual_consumer_key}") var consumerKey: String = _ @Value("${factual_consumer_secret}") var consumerSecret: String = _ var factual: ThreadLocal[Factual] = _ @PostConstruct Not thread-safe def initialize { factual = new ThreadLocal[Factual] { override def initialValue() = new Factual(consumerKey, consumerSecret, true) } } override def findNearbyRestaurants(location: Location) = { val restaurants = factual.get.fetch("restaurants-us", new Query().within(new Circle(location.lat, location.lon, 1000)).limit(5)) val rs = for (map <- restaurants.getData) yield { RestaurantInfo(map.get("name").asInstanceOf[String]) } FindNearbyRestaurantResponse(rs.toList) 5 restaurants within 1km } ...
  • 53. Agenda • Why use cloud services? • Developing location-based applications • Building SMS and telephony enabled applications • Developing robust, fault tolerant applications
  • 54. The telephony and SMS are important 7/ waking hr ! http://blog.nielsen.com/nielsenwire/online_mobile/new-mobile-obsession- Nielsen u-s-teens-triple-data-usage/
  • 55. Reporting traffic light problems in London
  • 57. VoteMeetEat.com & Telephony • Handling registration SMS • Sending SMS notifying users to vote • Handling incoming voice call from voters: • Text-to-speech of restaurants options • Collecting digits entered via keypad • Sending SMS notification of voting results
  • 58. DIY telephony = Difficult aS: y-a hon • Difficult to setup and operate Telep • Expensive e S MS/ to us ter • Complex SMS protocols Bet •…
  • 59. Telephony/SMS - aaS • SMS • SMS • Inbound and outgoing calls • Inbound and outgoing calls • Recording and transcription • Recording and transcription • Twitter • IM
  • 60. Twilio - Telephony and SMS as a service • REST API • Allocate phone numbers • Make and receive phone calls • Send and receive SMS messages • Pay per use: • Phone calls - per-minute • SMS – per SMS sent or received • Phone number – per month • Examples • OpenVBX is a web-based, open source phone system • StubHub – notifies sellers of a pending sale via phone • SurveyMonkey – interactive polling • Salesforce – SMS-based voting for 19,000 conference attendees
  • 61. Using Twilio Manage resources Send SMS Initiate voice calls REST API Voice SMS Your Twilio HTTP GET/ Application POST TwiML doc Phone number Handle incoming SMS and voice calls SMS URL + VOICE URL Respond to user input
  • 63. Handling SMS registration HTTP POST http://≪smsUrl≫?From=≪PhoneNumber≫ SMS SMS Twilio REGISTRATION <Response> <Sms>To complete registration please go to http://... </Sms> </Response>
  • 64. Handling SMS registration TwiML document describing the response
  • 65. Inviting users to vote 5551212
  • 66. Inviting users to vote POST /2010-04-01/Accounts/≪AccountSID≫/SMS/Messages From=+15105551212 &To=+14155551212 &Body=≪MESSAGE≫ Authorization: Basic .... Basic auth using Twilio AccountSid+AuthToken
  • 67. Sending SMS using the Spring REST Template @Component class TwilioService { def sendSms(recipient : String, message : String) = { val response = postToTwilio("SMS/Messages", Map("From" -> twilioPhoneNumber, "To" -> recipient, "Body" -> message)) (response "SMSMessage" "Sid").text }
  • 68. Sending SMS using the Spring @Component REST Template class TwilioService { TODO def postToTwilio(resourcePath : String, requestParams : Map[String, String]) = { val entity = makeEntity(requestParams) try { val response = restTemplate.postForObject(twilioUrl + "/Accounts/{accountSid}/{resource}", entity, classOf[String], accountSid, resourcePath) XML.loadString(response) } catch { case e : HttpClientErrorException if e.getStatusCode == HttpStatus.BAD_REQUEST => val body = e.getResponseBodyAsString() val xmlBody = XML.loadString(body) val code = Integer.parseInt((xmlBody "Code").text) val message = (xmlBody "Message").text throw new TwilioRestException(message, code) } }
  • 69. Voting 555 1212
  • 70. Voting HTTP POST http://≪voiceUrl≫?From=≪PhoneNumber≫ Survey Management Call <Response> Twilio <Say> Chris would like to meet and eat. </Say> <Gather action="handleresponse.html" method="POST" numDigits="1"> <Say>Press 1 for ....</Say> <Say>Press 2 for ....</Say> </Gather> </Response>
  • 71. Voting HTTP POST http://....handleresponse.html? From=≪PhoneNumber≫&Digits=≪...≫ Survey Management Digits <Response> Twilio <Say>Thank you for choosing. The most popular place so far is ... </Say> <Pause/> <Say>You will hear from us soon. Good bye</Say> <Hangup/> </Response>
  • 72. Voting code 1 @Controller class TwilioController { @Autowired var surveyManagementService: SurveyManagementService = _ @RequestMapping(value = Array("/begincall.html")) @ResponseBody def beginCall(@RequestParam("From") callerId: String) = { surveyManagementService.findSurveyByCallerId(callerId) match { case None => <Response> <Say>Sorry don't recognize your number</Say> <Hangup/> </Response> case Some(survey) => <Response> <Say>{ survey.prompt }</Say> <Gather action="handleresponse.html" method="POST" numDigits="1"> { for ((choice, index) <- survey.choices zipWithIndex) yield <Say>Press { index } for { choice }</Say> } </Gather> <Say>We are sorry you could not decide</Say> <Hangup/> </Response> } }
  • 73. Voting code 2 class TwilioController { ... @RequestMapping(value = Array("/handleresponse.html")) @ResponseBody def handleUserResponse(@RequestParam("From") callerId: String, @RequestParam("Digits") digits: Int) = { val survey = surveyManagementService.recordVote(callerId, digits) <Response> <Say>Thank you for choosing. The most popular place so far is { survey.map(_.mostPopularChoice) getOrElse "oops" } </Say> <Pause/> <Say>You will hear from us soon. Good bye</Say> <Hangup/> </Response> } }
  • 74. Agenda • Why use cloud services? • Developing location-based applications • Building SMS and telephony enabled applications • Developing robust, fault tolerant applications
  • 75. The need for parallelism Service B b = serviceB() Call in parallel c = serviceC() Service A Service C d = serviceD(b, c) Service D
  • 76. Java Futures are a great concurrency abstraction http://en.wikipedia.org/wiki/Futures_and_promises
  • 77. Akka’s composable futures are even better
  • 78. Using Akka futures trait FriendService { def findNearbyFriends(request : NearbyFriendsRequest) : Future[FindNearbyFriendsResponse] } trait RestaurantService { def findNearbyRestaurants(location: Location) : Future[FindNearbyRestaurantResponse] } val friendsRequest = NearbyFriendsRequest.fromLocation(vmeRecord.location) for ( (nearbyFriends, nearbyRestaurants) <- friendsService.findNearbyFriends(friendsRequest) zip restaurantService.findNearbyRestaurants(vmeRecord.location) ) { .... } } Two calls execute in parallel
  • 79. Using external web services = Distributed system Twilio MongoDB Mobile Phone VoteMeetEat Factual.Com
  • 80. Internally = Distributed System Survey management User management Registration SMS Rabbit MQ Registration web app VME management VME web app
  • 81. Handling failure Service A Service B Errors happen in distributed systems
  • 82. About Netflix > 1B API calls/day 1 API call average 6 service calls Fault tolerance is essential http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 83. Use timeouts and retries Never wait forever Errors can be transient retry http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 84. Use per-dependency bounded thread pool Service A Runnable 1 Task 1 Runnable 2 Task 2 Service B Runnable ... Task ... bounded queue bounded thread pool Fails fast if Limits number of service is slow or down outstanding requests http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 85. Use a circuit breaker High error rate stop calling temporarily Down wait for it to come back up Slow gives it a chance to recover Closed errors Open timeout success Half fail open http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 86. On failure Return cached data Avoid Failing Return default data Fail fast http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 87. Aspects + Actors Dependency Caller Invoker Implements Aspect circuit breaker state machine CircuitBreaker Equivalent of Actor thread pool Worker Dependency Worker Actor Stub Actor
  • 88. @DependencyProxy annotation trait RestaurantService { def findNearbyRestaurants(location: Location) : Future[FindNearbyRestaurantResponse] } @Service @DependencyProxy(circuitBreaker = "factualCircuitBreaker", timeoutInMilliseconds=750) class FactualRestaurantService extends RestaurantService { ... }
  • 89. Aspect-based Async Execution @Aspect class DependencyInvokingAspect { @Pointcut("execution(* (@DependencyProxy *).*(..))") def dependencyProxyMethods {} @Around("dependencyProxyMethods()") def invoke(jp: ProceedingJoinPoint) = { val a = AnnotationUtils.findAnnotation(jp.getTarget.getClass, classOf[DependencyProxy]) val actor = findActor(a) val timeout = Timeout(a.timeoutInMilliseconds milliseconds) actor.ask(InvokeDependency( () => jp.proceed())) (timeout) } } Ask actor to invoke jp.proceed() and return Future
  • 91. Summary Cloud services are highly scalable services developed and operated by a 3rd party Let’s you focus on your core business problem Risk: provider is acquired and stops offering service Developing an application that reliably consumes cloud services requires careful design
  • 92. @crichardson crichardson@vmware.com http://slideshare.net/chris.e.richardson/ Questions? Sign up for CloudFoundry.com using promo code cfjavaone