Decentralising data distribution

22
Decentralising Data Distribution

Transcript of Decentralising data distribution

Decentralising Data Distribution

Founding CTO at Greta [email protected] https://greta.io

Dennis Mårtensson

Stockholm based startup that was started in 2015.

Greta has developed a distribution script that turns your visitors into points of presence using WebRTC.

• Short on WebRTC • Basics of decentralised data distribution • Different technical options • Security • What’s the point in doing this? • Demo

Topics of today

• Standard (roots in this building! :)) • Most common use: video chat/conference systems • Used in big products like Google Hangout • Supported in Chrome, Firefox, Opera, Edge, native for iOS, Android • Apple’s plans still unknown (http://www.webrtcinwebkit.org/)

What is WebRTC?

pc = new RTCPeerConnection(servers);

navigator.getUserMedia({audio:true}, gotStream);

pc.createDataChannel("sendDataChannel", {reliable: false, ordered: true});

What is WebRTC?

• Serving data peer-to-peer between users. • Using the WebRTC Data channel. • Possible for video, audio, images and of course arbitrary data. • The effect is server offload. • Possibility of faster load times. • Scales with the number of users on your service or site.

Distributing data with WebRTC

How does it work?

A

B

C

D

E

F

G

H

F

G

I J

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

A

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA

How does it work?

B

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA

How does it work?

C

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA

How does it work?

D

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA

Other options: BitTorrent tracker

How does it work?

E

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA

Other options: External signaling Server sent events

How does it work?

F

F

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

What is a good peer?

G

G

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

H

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

Other options: Tracker or other

centralised system

I

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

Other options: Other keys than the hash

J

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

A

B

C

D

E

F

G

H

F

G

I J

USER SERVER

GRETA API

GRETA SIGNALING

SOFIA EMMA

How does it work?

• Using a third party to verify • Subresource Integrity • Peers get random IDs (non PII) • Flow control in signaling • Gossip protocol for blacklisting

What about security?

• You will get POPs like a normal CDN, but the POP’s will be completely dynamic and they will be exactly where your users are.

• You will move load from your servers or CDN to the peer-to-peer network. That will allow you to use less bandwidth and less server capacity.

• You will get very interesting cases where you have users with very low latency high throughput connections. That results in very fast load times and high quality.

• It will also scale more organically, as your distribution capacity increases with the number of concurrent users.

So, what is the effect of doing all this?

Demo!