Protocols Flashcards

(14 cards)

1
Q

Websockets

A

Good choice:
- low latency (real time data)
- 2 way communication
- persistent connection

Bad choice:
- If you don’t need real time data, might be too much overhead

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SOAP

A

Good choice:
- Financial and payment services
- Security and reliability are key

Bad choice:
- complex and verbose, so if not needed avoid it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

REST

A

Built on HTTP methods

Good choice:
- Commonly known
- Easy

Bad choice:
- Real time data
- Highly connected data model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Graph QL

A

Not just an architectural style, but a query language.

Good choice:
- Minimizes data transmission (Client asks for specific data, gets only what they asked for back)
- Faster responses (due to limited data sent)

Bad choice:
- Steep learning curve
- Requires more processing on server side due to flexible querying capabilities

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

gRPC

A

Technically its a framework. The protocol is HTTP/2. gRPC web downgrades the protocol to HTTP/1.

Good choice:
- fast (uses protocol buffers to SerDe and send data in binary)
- can stream (bi directional communication over 1 persistent connection)
- can multiplex (can have multiple parallel streams over 1 connection)

Bad choice:
- if you have browser client (limited browser support)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Webhook

A

Good choice:
- event driven
- async

Bad choice:
- sync
- immediate response

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

HTTP long polling vs Websockets

A

Http long polling good when:
- communication frequency isn’t very often
- websockets can’t be used (old browser support, pre HTTP 1.1 support, environment doesn’t supportt websockets)
- infra can’t handle the number of persistent connections that would be used with websockets

Otherwise use websockets:
- persistent connections, so saves overhead
- 2 way communication
- faster (often used for real time data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

gRPC vs REST

A

gRPC:
- faster (less data transmitted because uses Protocol Buffers to SerDe data in binary)
- can have multiple, parallel requests over 1 connection
- can do 2 way connections
- CON: data not human readable
- CON: limited browser compatibility
- use cases: internal services, streaming

REST
- data in JSON so human readable
- good browser compatibility
- simplicity and ease of use are the priority
- use cases: public APIs, simple apps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

HTTP 1 vs HTTP 2

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

gRPC vs Websockets

A

gRPC:
- Does not support streaming (multiple requests over 1 connection) or bidirectional communication with browsers because of reliance on HTTP2

Both:
- cross platform
- support bidirectional communication and streams (gRPC web supports neither though)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

gRPC Web

A

gRPC relies on HTTP/2. Modern browsers can do HTTP/2, but still can’t give gRPC the level of control it needs. Old browsers can’t do HTTP/2 at all.

gRPC web is a client side server that translates HTTP/2 requests to HTTP/1 so the browser can handle them. This limits gRPC’s capabilities though.

gRPC Web does not support:
- bidirectional messages
- streams (multiple requests over a persistent connection)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

RTMP

A

Real time messaging protocol

RTMP breaks video data into smaller chunks and sends them in a continuous stream.

Good for:
- The typical streaming protocol (twitch, youtube, FB live)
- low latency

Bad for:
- browsers don’t support it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

HLS (HTTP Live Streaming)

A

Breaks the video into 2-10 second chunks and sends those.

Has a 10 - 30 second delay.

An extension, low latency HLS (LL-HLS) lowers the delay to 5 - 10 seconds by sending the stream in smaller chunks.

Good for:
- Client choose the quality they want
- Browser support
- Compatible with CDNs
- LL-HLS is pretty fast.

Bad for:
- Higher latency than RTMP (LL-HLS is only ~2 seconds slower than RTMP (3 - 10 seconds))
-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

HTTP Long polling

A

Client sends request to server, leaves connection open waiting for response. When response received, connection closes, but the client immediately creates a new connection and waits for more data.

Not a true persistent connection, but basically is.

Connection only has 1 way communication while client waiting (only server can send data).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly