CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser...

30
© 2020 Samsung Research. All rights reserved. CASTANETS: Resource Efficient Distributed Web Browser by Offloading Processes to Remote Edge Devices https://samsung.github.io/Castanets/ https://github.com/Samsung/Castanets Samsung Research HQ: - Eun N.K - Seikwon Kim - In-soon Kim - YongGeol Jung Samsung Research Bangalore: - Nagarajan Narayanan - Venu Madhav Musham - Uzair Jaleel - Chandan Padhi - Venu Gopal SM - Suyambulingam Rathinasamy Muthupandi

Transcript of CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser...

Page 1: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

© 2020 Samsung Research. All rights reserved.

CASTANETS: Resource Efficient Distributed Web Browser

by Offloading Processes to Remote Edge Devices

https://samsung.github.io/Castanets/ https://github.com/Samsung/Castanets

Samsung Research HQ: - Eun N.K - Seikwon Kim - In-soon Kim - YongGeol Jung

Samsung Research Bangalore: - Nagarajan Narayanan - Venu Madhav Musham - Uzair Jaleel - Chandan Padhi - Venu Gopal SM - Suyambulingam Rathinasamy Muthupandi

Page 2: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

1 / 29 © 2020 Samsung Research. All rights reserved.

Web Technology Trends

Web contents getting more complicated Multi-layers High quality effects and animations

Increasing browser resource consumption

High CPU utilization for tree generation High memory consumption Increasing browser binary size

Browser everywhere on any device PC smart devices low-end devices

Conflict!

Fridge TV Smart watch

Browser on Samsung devices

Page 3: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

2 / 29 © 2020 Samsung Research. All rights reserved.

Modern Chromium Browser

Multiprocess architecture One browser process: More graphics bound Multiple renderer processes: More CPU and memory bound

Browser Process

Browser UI Network Storage

Renderer Renderer Renderer

Sandbox Sandbox Sandbox

HTML Renderer

HTML Renderer

HTML Renderer

JS Engine

JS Engine

JS Engine

DOM Bindings

DOM Bindings

DOM Bindings

Page 4: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

3 / 29 © 2020 Samsung Research. All rights reserved.

Castanets (Cast.a.nets)

In This Talk,

Supporting a browser on low-end devices

in the edge computing era

Page 5: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

4 / 29 © 2020 Samsung Research. All rights reserved.

Past, Present, Future Web Engine

Multi device extended Blink

Multi Device,

Multi Process

Webkit

- Multi Thread model architecture

- Lead defecto standard of HTML5

- Composed of feature (Document

Layout, CSS Matching, JS Engine)

Blink

- Fork from Webkit by Google

- Introduce multi process architecture

- Focus on performance enhancement,

experimental technical approach

Webkit 2

- Extend webkit from m-thread model to

m-process model JS Engine

WebCore

Webkit

Application

API

Webkit (Web Process)

Webkit (UI Process)

Browser Process

Renderer process

Single Device, Single Process Single Device, Multi Process

Castanets

Page 6: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

5 / 29 © 2020 Samsung Research. All rights reserved.

Potential Memory Usage Reduction

Average memory usage Renderer process: ~100MB Browser process: ~150MB

Renderer process memory cumulative as tabs open: 1145% with 10 tabs

Page 7: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

6 / 29 © 2020 Samsung Research. All rights reserved.

Potential CPU Usage Reduction

Average CPU usage breakdown Renderer: 42% Browser: 58%

Page 8: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

7 / 29 © 2020 Samsung Research. All rights reserved.

Castanets In a Nutshell

Save HW resource of target device by distributing process Low-end local node: browser process High-end remote node: renderer process Orchestration server

Service discovery Load balancing Hole punching

Orchestration

Resource Monitoring Service discovery Offloading Decision

Compositor

Mediaplayer

Browser Process

Res Dispatcher

Parsers

Renderer Process

Low-end Device High-end Devices

Res Dispatcher

Parsers

Renderer Process

Request Renderer

Select Renderer

Page 9: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

8 / 29 © 2020 Samsung Research. All rights reserved.

Major Changes in Castanets

Browser Process

Browser Shared Memory

Media

Player

Host

GPU

Thread

Host

Res.

Loader

Host

Net.

Socket

I/O

Widget Host

Compositor

Widget Host

Tab Contents

Render Process

Renderer Shared Memory

Net.

Socket

I/O

Res.

Loader

Media

Client

Web Core

JS Engine

RenderLayerTreeImpl LayerPaint

GLES

INF.

Module extensions Resource loader Multimedia pipeline GPU Acceleration And so on…

Modifications

Page 10: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

9 / 29 © 2020 Samsung Research. All rights reserved.

Remote Node 2

Render Process

Client Sock

Service Agent

Castanets Launching Procedure

Server: Browser process Client: Renderer process Daemon: Waits for connection, launches renderer process

Listen Sock

Accept

Sock

Orchestration Request tab open Send server IP, Port

Network connection

Remote Node 1

Render Process

Client Sock

Service Agent

Launch

Browser Process

Page 11: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

10 / 29 © 2020 Samsung Research. All rights reserved.

Chromium Resource Loader

Resource loading process in Chromium 1. RP requests resources to BP 2. BP fetches resources via network 3. BP writes to shared memory 4. BP sends shared memory handler to RP

BP RP

Resource

Dispatcher

Host

IPC::

Channel

Proxy

URL

Request

IPC::

Channel

Proxy

Resource

Dispatcher

Resource

Loader

RequestResource_Msg

ReceivedResponse_Msg

DataReceived_Msg

DataReceivedACK_Msg

RequestComplete_Msg

Shared Memory

{shm-handle}

* RP: Renderer Process * BP: Browser Process

Page 12: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

11 / 29 © 2020 Samsung Research. All rights reserved.

Castanets Resource Loader

Remote device resource loading Performance improvement Reduce extra network traffic

Browser Process

Resource

Dispatcher

Host

IPC::

Channel

Proxy

URL

Request

IPC::

Channel

Proxy

Resource

Dispatcher

Resource

Loader

Network Process

ResourceDispatcherHost

Invoke Process RequestResourceMsg

.. RequestCompleteMsg

URL Request

Renderer Process

Migration

Page 13: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

12 / 29 © 2020 Samsung Research. All rights reserved.

Chromium Multimedia Support

According to global Alexa Top 50: Youtube – 2nd Twitch – 26th

Original Chromium generates media pipeline in RP

HTMLMediaElement

Chromium Pipeline WebMediaPlayerImpl

FFMpeg

Source Demux Decoder AudioRenderer

Renderer Process

Browser Process

URLRequest AudioRendererHost

System Audio Device Shared Memory

VideoRenderer

Invalidate (new frame available)

Media pipeline in Chromium

Page 14: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

13 / 29 © 2020 Samsung Research. All rights reserved.

Castanets Multimedia Support

Performance issues of distributing RP and BP for multimedia support BP media file transfers to RP via network Decoded media stream transfers to BP via network

Castanets renders media in BP Reduces performance penalty

Renderer Process HTMLMediaElement

Browser Process

Media pipeline

MediaPlayerManagerHost

Media Framework

Codec Demux Source Audio Sink

Video Sink

Player Msg.(IPC)

Create Instance/Playback Control

H/W Codec Audio Device

WebMediaPlayer_Port

RenderMediaPlayerManager

Media Frame (surface) WebMediaPlayer

VideoFrameProvider

RenderViewObserver

overlay

Video hole

System

Page 15: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

14 / 29 © 2020 Samsung Research. All rights reserved.

Limitations and Issues

Communication Between heterogeneous web engines Between different versions

IPC message with different parameter

Network problem Disconnection while JS execution, sending tiles, and so on Renderer device turns off All other kinds of disconnections

Page 16: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

15 / 29 © 2020 Samsung Research. All rights reserved.

What is Service Discovery Agent?

User scenario in Castanets Device 1

Device 2 Device 3 Device 1

* Requirement Need to manage device status Need to load balancing Consider user network environment …

Page 17: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

16 / 29 © 2020 Samsung Research. All rights reserved.

What is Service Discovery Agent?

Service Discovery Agent

Service Discovery Agent

Server Client Browser Process

Renderer Process

- Resource monitoring - Network tunneling - Version management + Additional feature!

- Device status - Service request

Device A Device B

Page 18: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

17 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Overview

STUN Server

Service

Interface

Device Discovery

Server

Resource Monitor

Server

Service Provider

Chooser

Service

Launcher

Device Discovery

Client

Device Monitor

Client

Process

Coordinator

IPC Msg.

Request RP (DBUS)

Web Engine (BP)

STUN Message STUN Message

MDNS Query(M)

Resp.(U)

Dev. Status

Service Request

Fork & Exec

Network

Tunneling

Network

Tunneling

Web Engine (RP)

UDP Hole Punching Packet.

STUN : session traversal utilities for NAT

libedge.so

Page 19: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

18 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Considerable device network environment

NAT Traversal

STUN

Same NAT 3 1 2 4

Multicast discovery Remote discovery Packet Relay

Connection device Discovery method Network Env. Description

( 1 ~ 2 ) Multi-Cast MDNS Same NAT Direct send / recv

(1, 2 ~ 3) NAT Traversal

(direct connection) Single NAT NAT Traversal with UDP hole punching

(1, 2, 3 ~ 4) STUN Server Nested NAT Packet relay via STUN server (*Not supported)

Coverage of service discovery

Page 20: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

19 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Offloading decision Goal : Select best-fit provider from available device list Consideration

Best performance Service stability Usability consistency

Effective Factor Resource status : Network bandwidth, CPU load and frequency Network latency between service provider & consumer

Page 21: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

20 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Select Best Performing Renderer

Key factor: Network bandwidth, CPU usage

2

12

22

32

42

52

62

0 500 1000 1500 2000 2500 3000 3500

Average loading time / Bandwidth

Estimated Loading Time Loading / kBps

𝐿𝑜𝑎𝑑𝑖𝑛𝑔 𝑇𝑖𝑚𝑒 ≈ 8770 ∗ 𝑥−0.9

Page 22: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

21 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Select Best Performing Renderer

Key factor: Network bandwidth, CPU usage (Frequency, Utilization, # Cores )

𝐿𝑜𝑎𝑑𝑖𝑛𝑔 𝑇𝑖𝑚𝑒 ≈ 5.66 ∗ 𝑥−0.66

2

2.5

3

3.5

4

4.5

1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4

Frequency

Estimated loading time Loading / GHz

𝐿𝑜𝑎𝑑𝑖𝑛𝑔 𝑇𝑖𝑚𝑒 ≈ 3.22 ∗ 𝑥−0.241

0

1

2

3

4

5

6

0 0.2 0.4 0.6 0.8 1

Core Utilization

Estimated loading time Loading / Utilization

𝑥: Normalized CPU utilization

Page 23: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

22 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Renderer Score Calculation Network score + CPU score (frequency score, utilization score, core score )

Select Renderer With Service Stability

Moving average from renderer scores

𝑆𝑡𝑎𝑏𝑙𝑒𝑆𝑐𝑜𝑟𝑒 = 1

𝑛 𝑆𝑐𝑜𝑟𝑒(𝑚 − 𝑖)𝑛−1𝑖=0

Page 24: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

23 / 29 © 2020 Samsung Research. All rights reserved.

Linear Regression Technique

How to find best-fit line? MSE(Mean squared error): minimize distance between line and dots

Minimize Sum

cost =1

𝑛 (𝑦𝑖 − 𝑦𝑖 )

2𝑛𝑖=1

Finding minimized cost for parameter 𝒘𝟏 and 𝒘𝟐 for 𝒚 = 𝒘𝟏𝒙 + 𝒘𝟐

Differentiation

Find minimum cost where gradient = 0

Page 25: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

24 / 29 © 2020 Samsung Research. All rights reserved.

Polynomial Regression Technique

What if line is not linear but polynomial?

y = 𝑎 𝑒𝑏𝑥

ln y = ln (𝑎 𝑒𝑏𝑥)

ln y = ln𝑎 + ln𝑒𝑏𝑥

ln y = ln𝑎 + 𝑏𝑥

Let ln y = z, ln𝑎 = 𝑤2, 𝑏=𝑤1

𝒛 = 𝒘𝟏𝒙 +𝒘𝟐 Linear regression!

Page 26: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

25 / 29 © 2020 Samsung Research. All rights reserved.

How Service Discovery Agent Works

Device Pairing : Example of in-home device configuration

Fridge

- 8 Core @ 3.2GHz

- Utilization: 75%

- Bandwidth: 10MB

TV

- 4 Core @ 1.6GHz

- Utilization: 50%

- Bandwidth: 30MB

Refrigerator

- 4 Core @ 2.4GHz

- Utilization: 25%

- Bandwidth: 1MB

Smart phone

- 2 Core@ 2.0GHz

- Utilization: 0%

- Bandwidth: 2MB

Score: 3.40 Score: 2.68 Score: 2.10 Score: 2.28

pairing

7.8sec 10.79sec 17.79sec 5.96sec

Page 27: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

26 / 29 © 2020 Samsung Research. All rights reserved.

Methodology

Local system target Chrome Firefox Opera-mini Castanets BP

Local Node Specification

Core Arm Cortex A55 big-little octa-core Bigcore: 4 @ 2.7GHz

Littlecore: 4 @ 1.8GHz

Memory 4GB DDR

OS Android

Remote system target Castanets RP

Samsung QB75H

Page 28: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

27 / 29 © 2020 Samsung Research. All rights reserved.

Memory Usage Evaluation

Firefox: +3.89% Opera mini: -31.73% Castanets BP: -25.94%

Page 29: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

28 / 29 © 2020 Samsung Research. All rights reserved.

CPU Utilization Evaluation

Firefox: +27.64% Opera mini: +5.02% Castanets BP: -44.08%

Page 30: CASTANETS - World Wide Web Consortium · 2020. 6. 11. · Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation

29 / 29 © 2020 Samsung Research. All rights reserved.

Conclusion

Castanets is an edge distributed browser Browser process + renderer process + orchestration Browser process: graphics operation Renderer process: calculations Orchestration: load balancing, pairing

Communication problem exists in Castanets Between heterogeneous web engines Between different versions

IPC message with different parameter

Short way to solve problems Orchestration engine can manage versions and engine type

Long way to solve problems Match all communication messages between browsers