SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Enhancing Quality & Performance for Mobile VOIP & Messaging Apps

   Guy Fighel - Director of R&D Vonage Mobile
Vonage Mobile
Overview

• High Quality Global VOIP & Messaging Mobile App

• Phone calls to ANY Vonage user == Free!

• Text Messages to ANY Vonage user == Free!

• Phone call to any other destination == low cost

• iPhone & Android
Software Architecture
• Telephony
  • Vonage Proprietary SIP Proxies & Media Relays (C++)
  • Billing/Rating Engine (C++)
  • Real Time Call State Managers (C++)
• Application APIs
  • REST APIs (JAVA)
  • Vonage Push Service to communicate with Apple Push & Google Cloud
    Messaging Service
• Messaging APIs
  • REST APIs (JAVA)
  • Redis (with persistency)
Challenges
• Delay/Low Bandwidth/Traffic Blocking for VOIP Calls
• Global users - Peer to Peer vs. “Tromboning”
• Messages Storage/Performance
• Centralize Architecture for PSTN calls vs. Distributed
  Network
• Providing Client Properties for multiple environments
USA




Singapore
                    UK (over 3G)
(over WiFi)
USA




Attachments



                            RTP



Singapore
                    UK (over 3G)
(over WiFi)
Using EC2
• Media Relays
  • Deployed our Relays in Ireland, Singapore, Virginia, California, Sao
    Paulo
  • In each zone, we are using ELB with Static IP
  • In each zone we start with 4 instances and dynamically can scale
    up (up to 10)
  • High-CPU Extra Large Instance 7 GiB of memory, 20 EC2
    Compute Units (8 virtual cores with 2.5 EC2 Compute Units each),
    1690 GB of local instance storage, 64-bit platform
  • Monitoring using CloudWatch (NOC dashboard)
  • All sites are connected back into Vonage’s Data Centers using
    VPC with ACLs & Encryption
Closer to the customer

• Client sends SIP Registration Message to Proxy
• Proxy determines client’s IP address (using STUN)
• Proxy performs Geo Location query using external API
• Based on Geo Location, Proxy chooses ELB Public IP in
  the relevant region
• SIP continues to flow between Mobile client and Vonage’s
  DC, but Media flows directly into Amazon EC2 instance
• (In Beta) - Client always puts IP address record using
  Route53 as the Relay. Dynamically gets best closest route
• Override table has been implemented as well
Proxy Code - Choosing Relay
void GetGeoRelayGroupIDList(RelayGroupList * apRelayGroupIDList, const
string& arEndPointIP)
{
    string tCountry;
    string tRegion;


    // step 1 : MYSQL lookup in GeoRelayLocOverride table
    if (!GetLocationOverride(arEndPointIP, tCountry, tRegion))
    {
        // step 2 : Geo IP lookup
        GetLocationFromGeoIPData(arEndPointIP, tCountry, tRegion);
    }
Maxmind API
https://github.com/maxmind/geoip-api-c

1. Syncing the data file every day

2. Loading the Data file into memory and map it using the local
library
Using S3
• Mobile Messages API
  • Using S3 instances in US multiple regions (Always in full
     redundancy mode)
 •   Messages are stored in Vonage internal Redis NoSQL DB
 •   When Mobile client sends an attachment, it generates a
     unique ID for the file
 •   Mobile Client uses S3 SDK for iPhone/Android in order to
     save the object, encrypt it and sends to Redis the
     attachment’s reference ID
 •   When the Mobile client uses the ‘getMessage’ API, it fetches
     from Redis the S3 Attachment ID of a specific Message ID,
     and directly retrieves it from S3
Mobile Messages
 * saves a file into S3 storage using an input stream.
 * @param attachment the attachment to save
 * @return key the key used when sending to AWS
 * Note: this method should not close the input stream.
 * @throws MessagingException

 public String save(Attachment attachment) {
          FileMetaData metaData = attachment.getFileMetaData();
     String key = makeKey(metaData);
     InputStream istream = attachment.getInputStream();
          if (istream == null)
              throw new MessagingException("Unable to process attachment " +
metaData.getFileName(),
                                    " - attachment meta data error: no stream" );
     ObjectMetadata awsMetadata = new ObjectMetadata();
     awsMetadata.setContentType(metaData.getMimeType());
     awsMetadata.setContentLength(metaData.getSize());
Mobile Messages with Encryption
if (ServiceProperties.getBoolean(SERVER_SIDE_ENCRYPTION)) {
          awsMetadata.setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTIO
N);
    }


    PutObjectRequest request = new PutObjectRequest(bucket, key, istream, awsMetadata);
    attachment.setStoreType(type);


    try {
        getAwsClient().putObject(request);
    } catch (Exception e) {
                          throw new MessagingException("Unable to store attachment " +
metaData.getFileName(),
                                 " - Aws S3 error: " + e.getMessage());
    }
    return key; }
Retrieve Messages
public InputStream get(FileMetaData metaData)
  {
            String key = metaData.getKey();
      try
      {
          S3Object object = getAwsClient().getObject(new GetObjectRequest(bucket, key));


          if (object == null)
          {
              throw new ClientRequestException("File " + metaData.getFileName() + " does not
exist",
                   " - Sws S3 returns null " + metaData.toString());
          }
          return object.getObjectContent();
Client Properties Using SimpleDB
• SimpleDB Domains per number of environments

ISO_CODE             CLIENT_TAG          DOMAIN

1                    BETA                BetaDomain

1                    PROD                ProdDomain

1                    QA                  QaDoamin

44                   PROD                ProdDomain



     If mobile client has no ‘CLIENT_TAG’, then:‘DOMAIN’
                          always overrides
Client Properties Using SimpleDB - cont.
• ProdDomain

Attribute 1       Attribute 2        Client_Type

YES               Server Address 1   iPhone

YES               Server Address 2   Android

No                Server Address 1   Windows Phone
SimpleDB
public class SimpleDB {
  public static void main(String[] args) throws Exception {
    AmazonSimpleDB sdb = new AmazonSimpleDBClient(new PropertiesCredentials(
            SimpleDBSample.class.getResourceAsStream("AwsCredentials.properties")));
    try {
      String myDomain = "Domain0";
      // Select data from a domain
      String selectExpression = "select * from `" + myDomain + "`;
      SelectRequest selectRequest = new SelectRequest(selectExpression);
      for (Item item : sdb.select(selectRequest).getItems()) {
            System.out.println(" Item");
            System.out.println("    Name: " + item.getName());
            for (Attribute attribute : item.getAttributes()) {
                System.out.println("    Attribute");
                System.out.println("      Name: " + attribute.getName());
                System.out.println("      Value: " + attribute.getValue());
            }
      }
      System.out.println();
www.vonagemobile.com
@vonagemobile @guyfig
/guyfig

Weitere ähnliche Inhalte

Mehr von Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Mehr von Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

MBL204 Enhancing Quality & Performance for Vonage Mobile VOIP and Messaging Application using AWS - AWS re: Invent 2012

  • 1. Enhancing Quality & Performance for Mobile VOIP & Messaging Apps Guy Fighel - Director of R&D Vonage Mobile
  • 2. Vonage Mobile Overview • High Quality Global VOIP & Messaging Mobile App • Phone calls to ANY Vonage user == Free! • Text Messages to ANY Vonage user == Free! • Phone call to any other destination == low cost • iPhone & Android
  • 3.
  • 4. Software Architecture • Telephony • Vonage Proprietary SIP Proxies & Media Relays (C++) • Billing/Rating Engine (C++) • Real Time Call State Managers (C++) • Application APIs • REST APIs (JAVA) • Vonage Push Service to communicate with Apple Push & Google Cloud Messaging Service • Messaging APIs • REST APIs (JAVA) • Redis (with persistency)
  • 5. Challenges • Delay/Low Bandwidth/Traffic Blocking for VOIP Calls • Global users - Peer to Peer vs. “Tromboning” • Messages Storage/Performance • Centralize Architecture for PSTN calls vs. Distributed Network • Providing Client Properties for multiple environments
  • 6. USA Singapore UK (over 3G) (over WiFi)
  • 7. USA Attachments RTP Singapore UK (over 3G) (over WiFi)
  • 8. Using EC2 • Media Relays • Deployed our Relays in Ireland, Singapore, Virginia, California, Sao Paulo • In each zone, we are using ELB with Static IP • In each zone we start with 4 instances and dynamically can scale up (up to 10) • High-CPU Extra Large Instance 7 GiB of memory, 20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each), 1690 GB of local instance storage, 64-bit platform • Monitoring using CloudWatch (NOC dashboard) • All sites are connected back into Vonage’s Data Centers using VPC with ACLs & Encryption
  • 9. Closer to the customer • Client sends SIP Registration Message to Proxy • Proxy determines client’s IP address (using STUN) • Proxy performs Geo Location query using external API • Based on Geo Location, Proxy chooses ELB Public IP in the relevant region • SIP continues to flow between Mobile client and Vonage’s DC, but Media flows directly into Amazon EC2 instance • (In Beta) - Client always puts IP address record using Route53 as the Relay. Dynamically gets best closest route • Override table has been implemented as well
  • 10. Proxy Code - Choosing Relay void GetGeoRelayGroupIDList(RelayGroupList * apRelayGroupIDList, const string& arEndPointIP) { string tCountry; string tRegion; // step 1 : MYSQL lookup in GeoRelayLocOverride table if (!GetLocationOverride(arEndPointIP, tCountry, tRegion)) { // step 2 : Geo IP lookup GetLocationFromGeoIPData(arEndPointIP, tCountry, tRegion); }
  • 11. Maxmind API https://github.com/maxmind/geoip-api-c 1. Syncing the data file every day 2. Loading the Data file into memory and map it using the local library
  • 12. Using S3 • Mobile Messages API • Using S3 instances in US multiple regions (Always in full redundancy mode) • Messages are stored in Vonage internal Redis NoSQL DB • When Mobile client sends an attachment, it generates a unique ID for the file • Mobile Client uses S3 SDK for iPhone/Android in order to save the object, encrypt it and sends to Redis the attachment’s reference ID • When the Mobile client uses the ‘getMessage’ API, it fetches from Redis the S3 Attachment ID of a specific Message ID, and directly retrieves it from S3
  • 13. Mobile Messages * saves a file into S3 storage using an input stream. * @param attachment the attachment to save * @return key the key used when sending to AWS * Note: this method should not close the input stream. * @throws MessagingException public String save(Attachment attachment) { FileMetaData metaData = attachment.getFileMetaData(); String key = makeKey(metaData); InputStream istream = attachment.getInputStream(); if (istream == null) throw new MessagingException("Unable to process attachment " + metaData.getFileName(), " - attachment meta data error: no stream" ); ObjectMetadata awsMetadata = new ObjectMetadata(); awsMetadata.setContentType(metaData.getMimeType()); awsMetadata.setContentLength(metaData.getSize());
  • 14. Mobile Messages with Encryption if (ServiceProperties.getBoolean(SERVER_SIDE_ENCRYPTION)) { awsMetadata.setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTIO N); } PutObjectRequest request = new PutObjectRequest(bucket, key, istream, awsMetadata); attachment.setStoreType(type); try { getAwsClient().putObject(request); } catch (Exception e) { throw new MessagingException("Unable to store attachment " + metaData.getFileName(), " - Aws S3 error: " + e.getMessage()); } return key; }
  • 15. Retrieve Messages public InputStream get(FileMetaData metaData) { String key = metaData.getKey(); try { S3Object object = getAwsClient().getObject(new GetObjectRequest(bucket, key)); if (object == null) { throw new ClientRequestException("File " + metaData.getFileName() + " does not exist", " - Sws S3 returns null " + metaData.toString()); } return object.getObjectContent();
  • 16. Client Properties Using SimpleDB • SimpleDB Domains per number of environments ISO_CODE CLIENT_TAG DOMAIN 1 BETA BetaDomain 1 PROD ProdDomain 1 QA QaDoamin 44 PROD ProdDomain If mobile client has no ‘CLIENT_TAG’, then:‘DOMAIN’ always overrides
  • 17. Client Properties Using SimpleDB - cont. • ProdDomain Attribute 1 Attribute 2 Client_Type YES Server Address 1 iPhone YES Server Address 2 Android No Server Address 1 Windows Phone
  • 18. SimpleDB public class SimpleDB { public static void main(String[] args) throws Exception { AmazonSimpleDB sdb = new AmazonSimpleDBClient(new PropertiesCredentials( SimpleDBSample.class.getResourceAsStream("AwsCredentials.properties"))); try { String myDomain = "Domain0"; // Select data from a domain String selectExpression = "select * from `" + myDomain + "`; SelectRequest selectRequest = new SelectRequest(selectExpression); for (Item item : sdb.select(selectRequest).getItems()) { System.out.println(" Item"); System.out.println(" Name: " + item.getName()); for (Attribute attribute : item.getAttributes()) { System.out.println(" Attribute"); System.out.println(" Name: " + attribute.getName()); System.out.println(" Value: " + attribute.getValue()); } } System.out.println();