writing highly scalable websocket using the atmosphere framework and scala

57
Writing highly scalable WebSocket using the Atmosphere Framework Jeanfrancois Arcand Wordnik.com

Upload: jfarcand

Post on 11-May-2015

11.468 views

Category:

Technology


2 download

DESCRIPTION

Devoxx 2011 Atmosphere Framework talk on WebSocket, Redis and Scala

TRANSCRIPT

Page 1: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Writing highly scalable WebSocket using the Atmosphere Framework

Jeanfrancois ArcandWordnik.com

Page 2: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who is Wordnik

2

• Well Funded Silicon Valley based Startup–Creators of Meaning Discovery Engine

• Wordnik extracts Meaning from Text–Lexicographic and Computational Linguistic algorithms

–Data & Algorithms exposed via Swagger API

• Self-updating English Language Dictionary–Based on in-context usage

–Proprietary Text Corpus• Word Graph relates all words in English

• Micro Service Architecture Infrastructure–Java/Scala/MongoDB 2

Page 3: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who I amWho I am

3

• Twitter: @jfarcand

3

Creator of Grizzly

Framework

Creator of Grizzly

Framework

Page 4: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who I amWho I am

44

Creator of Grizzly

Framework

Creator of Grizzly

Framework

Significant contributor of

GlassFish

Significant contributor of

GlassFish

• Twitter: @jfarcand

Page 5: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who I amWho I am

55

Creator of Grizzly

Framework

Creator of Grizzly

Framework

Significant contributor of

GlassFish

Significant contributor of

GlassFish

Creator of the AsyncHttpClie

nt

Creator of the AsyncHttpClie

nt

• Twitter: @jfarcand

Page 6: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who I amWho I am

66

Creator of Grizzly

Framework

Creator of Grizzly

Framework

Significant contributor of

GlassFish

Significant contributor of

GlassFish

Creator of AtmosphereCreator of

Atmosphere

Creator of the AsyncHttpClie

nt

Creator of the AsyncHttpClie

nt

• Twitter: @jfarcand

Page 7: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Who I amWho I am

77

Creator of Grizzly

Framework

Creator of Grizzly

Framework

Significant contributor of

GlassFish

Significant contributor of

GlassFish

Creator of AtmosphereCreator of

Atmosphere

Creator of the AsyncHttpClie

nt

Creator of the AsyncHttpClie

nt

• Twitter: @jfarcand

Tomcat, Apache Digester, Sitebricks,

Jersey, Aether/Maven, etc.

Tomcat, Apache Digester, Sitebricks,

Jersey, Aether/Maven, etc.

Page 8: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

88

A Portable Comet

Framework

A Portable Comet

Framework

Page 9: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

99

A Portable Comet

Framework

A Portable Comet

Framework

Support All native Comet

API and Servlet 3.0

Support All native Comet

API and Servlet 3.0

Page 10: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1010

A Portable Comet

Framework

A Portable Comet

Framework

Support All native Comet

API and Servlet 3.0

Support All native Comet

API and Servlet 3.0

Atmosphere Client JQuery

Plugin

Atmosphere Client JQuery

Plugin

Page 11: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1111

A Portable Comet

Framework

A Portable Comet

Framework

Support All native Comet

API and Servlet 3.0

Support All native Comet

API and Servlet 3.0

Atmosphere Client JQuery

Plugin

Atmosphere Client JQuery

Plugin

Support available

WebSocket Native API

Support available

WebSocket Native API

Page 12: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1212

A Portable Comet

Framework

A Portable Comet

Framework

Support All native Comet

API and Servlet 3.0

Support All native Comet

API and Servlet 3.0

Atmosphere Client JQuery

Plugin

Atmosphere Client JQuery

Plugin

Support available

WebSocket Native API

Support available

WebSocket Native API

Plugs in for Redis, Active

MQ (JMS), JGroups, XMPP,

etc.

Plugs in for Redis, Active

MQ (JMS), JGroups, XMPP,

etc.

Page 13: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1313

A Portable Comet

Framework

A Portable Comet

Framework

Support All native Comet

API and Servlet 3.0

Support All native Comet

API and Servlet 3.0

Atmosphere Client JQuery

Plugin

Atmosphere Client JQuery

Plugin

Support available

WebSocket Native API

Support available

WebSocket Native API

Plugs in for Redis, Active

MQ (JMS), JGroups, XMPP,

etc.

Plugs in for Redis, Active

MQ (JMS), JGroups, XMPP,

etc.

Supported/Integrated by almost

all major frameworks and javascript library

Supported/Integrated by almost

all major frameworks and javascript library

Page 14: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1414

WebSocket Spec is evolving

fast on both Browser and Server Side

WebSocket Spec is evolving

fast on both Browser and Server Side

Page 15: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1515

WebSocket Spec is evolving

fast on both Browser and Server Side

WebSocket Spec is evolving

fast on both Browser and Server Side

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Page 16: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1616

WebSocket Spec is evolving

fast on both Browser and Server Side

WebSocket Spec is evolving

fast on both Browser and Server Side

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Atmosphere JQuery Plug In hide that and

propose a uniform API

Atmosphere JQuery Plug In hide that and

propose a uniform API

Page 17: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The Atmosphere FrameworkThe Atmosphere Framework

1717

WebSocket Spec is evolving

fast on both Browser and Server Side

WebSocket Spec is evolving

fast on both Browser and Server Side

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Chrome/Safari/Opera: WebSocket

FF: MozWebSocketIE: (crikets …

~10)

Atmosphere JQuery Plug In hide that and

propose a uniform API

Atmosphere JQuery Plug In hide that and

propose a uniform API

Decide the best transport,

negociate it with the server

Decide the best transport,

negociate it with the server

Page 18: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

1818

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Page 19: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

1919

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Page 20: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2020

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Page 21: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2121

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Page 22: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2222

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Page 23: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2323

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Tomcat 7

zzzzzzzzzzzz

Tomcat 7

zzzzzzzzzzzz

Page 24: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2424

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Tomcat 7

zzzzzzzzzzzz

Tomcat 7

zzzzzzzzzzzz

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

Page 25: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2525

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Tomcat 7

zzzzzzzzzzzz

Tomcat 7

zzzzzzzzzzzz

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

Are you crazy enough to

rewrite your entire app?

Are you crazy enough to

rewrite your entire app?

Page 26: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Java LandscapeJava Landscape

2626

Jetty 7.0: First to Support WebSocket

Jetty 7.0: First to Support WebSocket

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.2.x ->

API Changes, break

compatibility

Jetty 7.4.5 and

8.0.2 and up:

Spec change

Jetty 7.4.5 and

8.0.2 and up:

Spec change

GlassF

ish 3

.0 -

> som

e su

pport

GlassF

ish 3

.0 -

> som

e su

pport

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Gla

ssFi

sh 3

.1.2

-> A

PI C

hang

es

Tomcat 7

zzzzzzzzzzzz

Tomcat 7

zzzzzzzzzzzz

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

WOUAAAAAAAAAAAAAAAAtmosphere to the

rescue!!

Are you crazy enough to

rewrite your entire app?

Are you crazy enough to

rewrite your entire app?Really want to

use proprietary

solution like ?

Really want to use

proprietary solution like ?

Page 27: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

2727

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Page 28: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

2828

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Page 29: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

2929

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Want REST like API? Check!

Want REST like API? Check!

Page 30: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

3030

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Want REST like API? Check!

Want REST like API? Check!

Fallback to Comet? Check!

Fallback to Comet? Check!

Page 31: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

3131

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Want REST like API? Check!

Want REST like API? Check!

Fallback to Comet? Check!

Fallback to Comet? Check!

Pure WebSocket?

Check!

Pure WebSocket?

Check!

Page 32: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

3232

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Want REST like API? Check!

Want REST like API? Check!

Fallback to Comet? Check!

Fallback to Comet? Check!

Pure WebSocket?

Check!

Pure WebSocket?

Check!

WebSocket Sub Protocol?

Check

WebSocket Sub Protocol?

Check

Page 33: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

How?How?

3333

Integrate with all

framework? Check!

Integrate with all

framework? Check!

Want Servlet API? Check!Want Servlet API? Check!

Want REST like API? Check!

Want REST like API? Check!

Fallback to Comet? Check!

Fallback to Comet? Check!

Pure WebSocket?

Check!

Pure WebSocket?

Check!

WebSocket Sub Protocol?

Check

WebSocket Sub Protocol?

Check

Atmosphere provides a uniform API and hides

the underlying transport details

(async I/O included)

Atmosphere provides a uniform API and hides

the underlying transport details

(async I/O included)

Page 34: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ConceptsConcepts

3434

Upgrade/SuspendUpgrade/Suspend

Page 35: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ConceptsConcepts

3535

Upgrade/SuspendUpgrade/Suspend

BroadcastBroadcast

Page 36: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ConceptsConcepts

3636

Upgrade/SuspendUpgrade/Suspend

BroadcastBroadcast

ResumeResume

Page 37: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ConceptsConcepts

3737

Upgrade/SuspendUpgrade/Suspend

BroadcastBroadcast

ResumeResume

Client choose the best

technique (ws or comet)

Client choose the best

technique (ws or comet)

Async I/O(Input/Output

Stream)

Async I/O(Input/Output

Stream)

Page 38: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ConceptsConcepts

3838

Upgrade/SuspendUpgrade/Suspend

BroadcastBroadcast

ResumeResume

Cloud enabled (zzzzzz)

Cloud enabled (zzzzzz)

Async I/O(Input/Output

Stream)

Async I/O(Input/Output

Stream)Survive ProxyCloud EnabledSurvive ProxyCloud Enabled

Page 39: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

ZzzzzzzzzEnough Bla Bla Bla,

let’s do Scala!

ZzzzzzzzzEnough Bla Bla Bla,

let’s do Scala!

Page 40: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

APIAPI

4040

AtmosphereHandler

AtmosphereHandler

Page 41: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

APIAPI

4141

Jersey to the rescue!

(@ and Prog API)

Jersey to the rescue!

(@ and Prog API)

AtmosphereHandler

AtmosphereHandler

Page 42: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

APIAPI

4242

AtmosphereHandler

AtmosphereHandler

WebSocketProtocol

WebSocketProtocolJersey to the

rescue!(@ and Prog

API)

Jersey to the rescue!

(@ and Prog API)

Page 43: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

APIAPI

4343

AtmosphereHandler

AtmosphereHandler

WebSocketProtocol

WebSocketProtocol

Servlet APIServlet API

Jersey to the rescue!

(@ and Prog API)

Jersey to the rescue!

(@ and Prog API)

Page 44: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

The DemoThe Demo

4444

Jetty 8Jetty 8 Tomcat 6

Tomcat 6

RedisRedis

ChromeChrome Redis CLIRedis CLI SafariSafari

WebSocketWebSocketWebSocket FAIL ->

StreamingWebSocket FAIL ->

Streaming

Broadcaster

Broadcaster

Broadcaster

Broadcaster

Page 45: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

2005- AtmosphereHandler

45

def onRequest(r: AtmosphereResource[HttpServletRequest, HttpServletResponse]): Unit = {

var req: HttpServletRequest = r.getRequest

var res: HttpServletResponse = r.getResponse

var method: String = req.getMethod

if ("GET".equalsIgnoreCase(method)) {

var b: Broadcaster = lookupBroadcaster(req.getPathInfo)

r.setBroadcaster(b)

if (req.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT).equalsIgnoreCase(HeaderConfig.LONG_POLLING_TRANSPORT)) {

req.setAttribute(ApplicationConfig.RESUME_ON_BROADCAST, true)

r.suspend(-1, false)

} else {

r.suspend(-1)

}

} else if ("POST".equalsIgnoreCase(method)) {

var b: Broadcaster = lookupBroadcaster(req.getPathInfo)

var message: String = req.getReader.readLine

if (message != null && message.indexOf("message") != -1) {

b.broadcast(message.substring("message=".length))

}

}

}

45

http://is.gd/hH3AaHhttp://is.gd/hH3AaH

Page 46: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

1999 – Servlet API

46

override def doGet(req: HttpServletRequest, res: HttpServletResponse): Unit = {

var m: org.atmosphere.cpr.Meteor = org.atmosphere.cpr.Meteor.build(req)

m.addListener(new Console)

res.setContentType("text/html;charset=ISO-8859-1")

var b: Broadcaster = lookupBroadcaster(req.getPathInfo)

m.setBroadcaster(b)

if (req.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT).equalsIgnoreCase(HeaderConfig.LONG_POLLING_TRANSPORT)) {

req.setAttribute(ApplicationConfig.RESUME_ON_BROADCAST, true)

m.suspend(-1, false)

}

else {

m.suspend(-1)

}

}

override def doPost(req: HttpServletRequest, res: HttpServletResponse): Unit = {

var b: Broadcaster = lookupBroadcaster(req.getPathInfo)

var message: String = req.getReader.readLine

if (message != null && message.indexOf("message") != -1) {

b.broadcast(message.substring("message=".length))

}

}

46

http://is.gd/GcnG0Ahttp://is.gd/GcnG0A

Page 47: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

2007 – REST API

47

@Path("/resource/{topic}")

@Produces(Array("text/html;charset=ISO-8859-1"))

class Resource {

@PathParam("topic") private var topic: Broadcaster = null

@GET

def subscribe: SuspendResponse[String] = {

return new SuspendResponse.SuspendResponseBuilder[String]()

.broadcaster(topic)

.outputComments(true)

.addListener(new Console)

.build

}

@POST

@Broadcast

def publish(@FormParam("message") message: String): Broadcastable = {

return new Broadcastable(message, "", topic)

}

47

http://is.gd/Df9Uvmhttp://is.gd/Df9Uvm

Page 48: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

2011 – WebSocket API

4848

http://is.gd/SEa4AKhttp://is.gd/SEa4AK

Page 49: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

2011 – Client API

4949

http://is.gd/9jumKthttp://is.gd/9jumKt

Page 50: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5050

HTTP/REST Over

WebSocket

HTTP/REST Over

WebSocket

Page 51: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5151

HTTP/REST Over

WebSocket

HTTP/REST Over

WebSocket

JSON based protocol

JSON based protocol

Page 52: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5252

HTTP/REST Over

WebSocket

HTTP/REST Over

WebSocket

JSON based protocol

JSON based protocol

Support Pipelined Requests

Support Pipelined Requests

Page 53: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5353

HTTP/REST Over

WebSocket

HTTP/REST Over

WebSocket

JSON based protocol

JSON based protocol

Support Pipelined Requests

Support Pipelined Requests

Fully ASYNCHRONOUS

Fully ASYNCHRONOUS

Page 54: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5454

HTTP/REST Over

WebSocket

HTTP/REST Over

WebSocket

JSON based protocol

JSON based protocol

Support Pipelined Request

Support Pipelined Request

Fully ASYNCHRONOUS

Fully ASYNCHRONOUS

•Work with ANY existing technology, without any

changes

• No need to use Atmosphere API directly

• Protocol easily extensible

•Work with ANY existing technology, without any

changes

• No need to use Atmosphere API directly

• Protocol easily extensible

Page 55: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

SwaggerSocket ProtocolSwaggerSocket Protocol

5555

WebServer

WebServer

Atmosphere

Atmosphere

WebSocket

WebSocket

WebSocket

Protocol

WebSocket

Protocol

JerseyJerseyREST Resource

REST Resource

Page 56: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Benchmark

56

Comparing HTTP/keep-alive vs WebSocket

56

Page 57: Writing highly scalable WebSocket using the Atmosphere Framework and Scala

Conclusion

57

• Writing WebSocket doesn’t have to be complex

• Use technology/API that you know, don’t re-invent the wheel again!

• Twitter: @atmo_framework• Github: http://github.com/Atmosphere/atmosphere

• Wordnik: http://wordnik.com57