Scaling Shiny Apps - EARL 2017 San Francisco

25
1 EARL 2017 SF How we built a Shiny App for 700 users

Transcript of Scaling Shiny Apps - EARL 2017 San Francisco

Page 1: Scaling Shiny Apps - EARL 2017 San Francisco

1

EARL 2017 SF

How we built a Shiny App for 700 users

Page 2: Scaling Shiny Apps - EARL 2017 San Francisco

CEOFilip Stachura

Passionate about Data Analysis and Visualisation

Contributor to R and Shiny community

Page 3: Scaling Shiny Apps - EARL 2017 San Francisco

 

Page 4: Scaling Shiny Apps - EARL 2017 San Francisco

4

“It took us one month to get from sketch to

a working application”.

John Dannberg, The Boston Consulting Group

Page 5: Scaling Shiny Apps - EARL 2017 San Francisco

5

Facebook made spreadsheet UI passé. Nowadays business's expect better design and experience.

USER EXPERIENCE

This approach delivers superior resultscompared to pure machine learning models and well beyond manual work.

BLENDING HUMAN KNOWLEDGE WITH ML

The shiny.collections package allows us to build distributed R apps with realtime collaboration in mind.

INTRODUCTION OF SHINY.SEMANTIC

EARL 2016 Boston

Page 6: Scaling Shiny Apps - EARL 2017 San Francisco

6

6 MONTHS

Page 7: Scaling Shiny Apps - EARL 2017 San Francisco

7

6 MONTHS

Dozens of advanced Shiny dashboards.

Page 8: Scaling Shiny Apps - EARL 2017 San Francisco

PREDICTINGSUPPLY AND

DEMAND

Page 9: Scaling Shiny Apps - EARL 2017 San Francisco

9

MARITIMEOPTIMISATION

Page 10: Scaling Shiny Apps - EARL 2017 San Francisco

10

MARGINMAXIMISATION

Page 11: Scaling Shiny Apps - EARL 2017 San Francisco

11 Appsilon Stack

END-TO-END SOLUTION

Allows for training and validating

models and running them in the

production environment.

PLATFORM

This can be an API or a Shiny

dashboard. Interactive dashboards

are a perfect decision support

systems.

INTERFACE

The initial part of each project

starts with data. Make sure not to

put garbage into your models.

DATA ACQUISITION

Models are a crucial element of the data science process. They range from linear models, up to deep learning model.

MODELS

Page 12: Scaling Shiny Apps - EARL 2017 San Francisco

12 Appsilon Stack

END-TO-END SOLUTION

Allows for training and validating

models and running them in the

production environment.

PLATFORM

This can be an API or a Shiny

dashboard. Interactive dashboards

are a perfect decision support

systems.

INTERFACE

The initial part of each project

starts with data. Make sure not to

put garbage into your models.

DATA ACQUISITION

Models are a crucial element of the data science process. They range from linear models, up to deep learning model.

MODELS

Page 13: Scaling Shiny Apps - EARL 2017 San Francisco

13

Case Study:SCALING SHINY APPS TO 700 USERS

Page 14: Scaling Shiny Apps - EARL 2017 San Francisco

14 CHALLENGES

UI UX SCALE

Page 15: Scaling Shiny Apps - EARL 2017 San Francisco

15

BEAUTIFULUI

Page 16: Scaling Shiny Apps - EARL 2017 San Francisco

16

Page 17: Scaling Shiny Apps - EARL 2017 San Francisco

17

Page 18: Scaling Shiny Apps - EARL 2017 San Francisco

18 USER INTERFACE

USING SHINY.SEMANTIC

Our clients were so happy with the

prototype design they’ve decided to skip the

designing phase of the project.

SKIP GRAPHIC DESIGN

Using shiny.semantic makes it is easy to deliver advanced components not available in the Shiny base.

HIGHLY CUSTOMIZABLE

We were able to deliver results at the same

pace or faster as with standard shiny

components.

NO OVERHEAD

UI GREATLOOK

CUSTOM

FAST

Page 19: Scaling Shiny Apps - EARL 2017 San Francisco

19

USER EXPERIENCE

Page 20: Scaling Shiny Apps - EARL 2017 San Francisco

20 LESSONS LEARNED

USER EXPERIENCE

Rendering plotly charts onlywhen the plot is visible

saved precious resources

LAZY RENDERING

Reactivity is great, but

sometimes it just makes

sense to get away

(NON-)REACTIVE

Adding a front end router toan app significantly improves

the user and development experience

ROUTING

We have managed to achieve

20x speedups in Shiny app

lookups

INDEX DATA SETS

Page 21: Scaling Shiny Apps - EARL 2017 San Francisco

SCALE UP

Page 22: Scaling Shiny Apps - EARL 2017 San Francisco

SUCCESSFUL SCALING

CONTAINERS

Each Shiny Server has the same

configuration, and we run the

same app in each container

We move authorization to

a separate layer of our

stack

Improves the distribution of

workloads across multiple

servers

LOADBALANCER

AUTH

Page 23: Scaling Shiny Apps - EARL 2017 San Francisco

23

Proxy

Container

NGINX Shiny

Authorization

Container

NGINX Shiny

Container

NGINX Shiny

COMPATIBLE WITH:

On-Premise

OurArchitecture

Page 24: Scaling Shiny Apps - EARL 2017 San Francisco

24

DEMO

Page 25: Scaling Shiny Apps - EARL 2017 San Francisco

QUESTIONS?

filipstachura 

[email protected]

appsilondatascience.com