Transcript
Page 1: Open Source Versions of Amazon's SNS and SQS.pptx

CMB

An Open Source Alternative for Queuing and Notification

Cloud Services

Ryan KingComcast Silicon Valley

OpenStack Summit – San Diego 2012

Page 2: Open Source Versions of Amazon's SNS and SQS.pptx
Page 3: Open Source Versions of Amazon's SNS and SQS.pptx

Intro

Page 4: Open Source Versions of Amazon's SNS and SQS.pptx

SummaryA team inside Comcast open sourced a compatible version of Amazon SNS and SQS on top of Cassandra & Redis

Page 5: Open Source Versions of Amazon's SNS and SQS.pptx

Who are we?• Comcast Silicon Valley

– Consumer-facing internet products for Comcast

– Web, Mobile, TV

• Silicon Valley

– Product Development & Innovation Center

Page 6: Open Source Versions of Amazon's SNS and SQS.pptx

CMB

CMB – Message Bus

CNS – Notification Service

CQS – Queue Service

Page 7: Open Source Versions of Amazon's SNS and SQS.pptx

But, wait.. Why build your own???

Page 8: Open Source Versions of Amazon's SNS and SQS.pptx

Comcast building Private Cloud

(… using OpenStack!)

Page 9: Open Source Versions of Amazon's SNS and SQS.pptx

To power next-gen services

(… including TV!)

Page 10: Open Source Versions of Amazon's SNS and SQS.pptx

Latency extremely important

Page 11: Open Source Versions of Amazon's SNS and SQS.pptx

Every millisecond counts

Page 12: Open Source Versions of Amazon's SNS and SQS.pptx

Needs to be cost effective

(… for 50MM users)

Page 13: Open Source Versions of Amazon's SNS and SQS.pptx

What else is out there?

Page 14: Open Source Versions of Amazon's SNS and SQS.pptx

None of those could meet our requirements

Page 15: Open Source Versions of Amazon's SNS and SQS.pptx

Requirements• Compatible with AWS

• Support Active-Active Multi-Data-Center

• Horizontal Scalability

• Guaranteed Delivery

• Very Low Latency

Page 16: Open Source Versions of Amazon's SNS and SQS.pptx

NOT Required1. Order is NOT guaranteed

2. Duplicate messages CAN happen

2. Duplicate messages CAN happen

Page 17: Open Source Versions of Amazon's SNS and SQS.pptx

First, the Queue

CMB – Message Bus

CNS – Notification Service

CQS – Queue Service

Page 18: Open Source Versions of Amazon's SNS and SQS.pptx

What is Simple Queue Service?

(from a Popular Cloud Service Provider)

“Simple Queue Service offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers”

Page 19: Open Source Versions of Amazon's SNS and SQS.pptx

Simple Queue Service

Page 20: Open Source Versions of Amazon's SNS and SQS.pptx

Main SQS Methods

• CreateQueue

• SendMessage

• ReceiveMessage

• DeleteMessage

Page 21: Open Source Versions of Amazon's SNS and SQS.pptx

Our implementation:

CQS

Page 22: Open Source Versions of Amazon's SNS and SQS.pptx

CQS APICQS API

Lists

Redis

Hashtables

Cassandra

Payload cache

API

Page 23: Open Source Versions of Amazon's SNS and SQS.pptx

Cassandra Persistence• Queue sharded over N=100 rows

–Avoids wide rows (> 500K items)

–Reduces “churn” (Tombstones)

–Distributes queue among nodes

Page 24: Open Source Versions of Amazon's SNS and SQS.pptx

CQS APICQS API

API

Lists

Redis

Hashtables

Payload cache

Page 25: Open Source Versions of Amazon's SNS and SQS.pptx

Redis Caching

• Message IDs: List

• Visibility: Hashtable

• Payload cache: Set

Page 26: Open Source Versions of Amazon's SNS and SQS.pptx

CQS Notes• Minimal duplication and good ordering

– When things are happy..

• Cassandra tombstones degrade message performance

– Normally reads => Redis

Page 27: Open Source Versions of Amazon's SNS and SQS.pptx

CQS Performance

0

10

20

30

40

50

60

70

80

90

10 50 75 100 250 500 1000

Late

ncy

(m

s)

Msg/Sec

Page 28: Open Source Versions of Amazon's SNS and SQS.pptx

Why use Cassandra?• very low latency

• very high write throughput

• extremely high availability (across multi-dc)

• Near linear horizontal scalability

Page 29: Open Source Versions of Amazon's SNS and SQS.pptx

Why add Redis?• Queue metadata:

– changes frequently

– not durable

• Needed extremely low latency reads

• Reduces “churn” in Cassandra

Page 30: Open Source Versions of Amazon's SNS and SQS.pptx

Next, Notifications

CMB – Message Bus

CNS – Notification Service

CQS – Queue Service

Page 31: Open Source Versions of Amazon's SNS and SQS.pptx

What is Simple Notification Service?

(from a Popular Cloud Services Provider … in Seattle… )

“Simple Notification Service is a web service that makes it easy to set up, operate, and send notifications from the cloud”

Page 32: Open Source Versions of Amazon's SNS and SQS.pptx

Simple Notification Service

Page 33: Open Source Versions of Amazon's SNS and SQS.pptx

Main SNS Methods

•CreateTopic

•Subscribe

•Publish

Page 34: Open Source Versions of Amazon's SNS and SQS.pptx

Our Implementation:

CNS

Page 35: Open Source Versions of Amazon's SNS and SQS.pptx
Page 36: Open Source Versions of Amazon's SNS and SQS.pptx

Scalability• Publish Requests

=> API servers

• # subscribers => Delivery Producers

• Publishing to endpoints => Delivery Consumers

• Overall => CQS & Cassandra

Page 37: Open Source Versions of Amazon's SNS and SQS.pptx

0

200

400

600

800

1000

1200

500 1000 2000 4000 8000

Late

ncy

(m

s)

Throughput (Msgs/Sec)

Throughput Scalability

6 workers

3 workers

Page 38: Open Source Versions of Amazon's SNS and SQS.pptx

0

500

1000

1500

2000

2500

3000

100 250 500 750 1000 1250 1500

Late

ncy

(m

s)

# of Subscribers per Topic

Subscriber Scalability

3 workers

6 workers

Page 39: Open Source Versions of Amazon's SNS and SQS.pptx

What are we using this for?

Page 40: Open Source Versions of Amazon's SNS and SQS.pptx
Page 41: Open Source Versions of Amazon's SNS and SQS.pptx

Now Open Source!github.com/Comcast/cmb

Page 42: Open Source Versions of Amazon's SNS and SQS.pptx

Next steps• Does this fit into OpenStack?• Get Feedback from the community (you!)

• Questions?

[email protected]• @ryanking• PS - We’re hiring @ Comcast SV!


Top Related