A Web Widget Platform

35
Introduction Spilgames & Me Old Portals Landscape Overview Evaluation Wish List Tech Wishes Taskforce Wishes Available Frameworks A Widget Platform Components The Flow Testing & Deploying Managing Widgets Holding Control Next Steps Summary Contributions A Web Widget Platform Enrique Paz Senior Backend Developer 13/06/2013 1/33

description

A presentation about a distributed Erlang web platform focused on scalability and feature isolation.

Transcript of A Web Widget Platform

Page 1: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

A Web Widget Platform

Enrique Paz

Senior Backend Developer

13/06/2013

1/33

Page 2: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

About Me

• Passionate Erlang developer• Testing enthusiast• Love beautiful code!

2/33

Page 3: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Spilgames

• Gaming Platform• Serving data to 190+ countries world-wide• 180+ million unique users per month• Multiple Platforms: Desktop, Mobile Native & Web• 300+ employees• Offices in The Netherlands & China• Revenue: Advertising & EUM

3/33

Page 4: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Old Portals Landscape

4/33

Page 5: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Brands and Sites

• 5 Brands/Channels for target audiences• 1-15 Sites for different geographical regions• Strong domains

I www.spel.se for teens in SwedenI www.ojogos.pt for families in Portugal and BrazilI . . .

5/33

Page 6: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Gaming Portals

6/33

Page 7: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Architectural Overview

• Monolithic portals perbrand

• Static pages with lots ofAJAX calls

• Architectural layersdeveloped independently

7/33

Page 8: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

The Good

• Ability to develop per brand and site• Acceptable performance• Clear layer separation• Fast growth

8/33

Page 9: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

The Bad

• Inability to share features between brand codebases• Aggressive multi-level caching needed to perform decently• Lots of logic on the client• Developers can’t switch brands easily• Long time to market

9/33

Page 10: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Wish List

10/33

Page 11: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Isolation & Performance

• Isolated requests, features and crashes• Feature toggling on runtime• Decent number of requests/s with linear

scalability• Technology aligned application and storage

layers

11/33

Page 12: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Increase Development Speed

• Only one modular codebase• Small features, easy to deploy and rollback• Changes testable in isolation

12/33

Page 13: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

What’s out there

• MVC Frameworks (Chicago Boss, Zotonic. . . )I (+) Nice layer separationI (+) Mature solutionsI (+) Easy to use

• But. . .I (-) Feature isolation not key in their designI (-) A VC framework fits better (abstracted model)

13/33

Page 14: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

What’s out there

• MVC Frameworks (Chicago Boss, Zotonic. . . )I (+) Nice layer separationI (+) Mature solutionsI (+) Easy to use

• But. . .I (-) Feature isolation not key in their designI (-) A VC framework fits better (abstracted model)

13/33

Page 15: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

A Widget Platform

14/33

Page 16: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

A Widget Platform

15/33

Page 17: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Widgets

• Isolated• Independent Erlang

applications• Use ErlyDTL for the view• Specification in the .app.src• Can only use what they

specify

16/33

Page 18: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Widgets: declaring everything

• Children• Public properties• Private properties• Themes• JS decoration• CSS decoration

{ env , [{ ch i l d ren , [ wdg_game_list_breadcrumb ] } ,{ i n t e r f a c e , [

{ page , " 1 " } ,{ pageSize , " 20 " }

] } ,{ p r i v a t e _ i n t e r f a c e , [

{ template , wdg_game_list } ,{ css , [ " wdg_game_list " ] } ,{ j s , [ " i n i t . j s " ] } ,{ games , [ ] } ,{ paginat ion_bar , [ ] }

] } ,{ themes , [

{ " teens " , [{ template , wdg_game_list_teens } ,{ css , [ " teens / wdg_game_list_teens " ] } ,{ j s , [ " teens / i n i t . j s " ] }

] }] } ,{ js_modules , [ ] } ,{ j s_event_conf ig , [

{ l i s t e n , [ ’ system . user . search . request ’ ] } ,{ emit , [ ] }

] }] }

17/33

Page 19: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Widget Libraries

• Widget type definitions• Widget behaviour• Wrappers for common actions• Connection to the application

layer• ErlyDTL custom tags

18/33

Page 20: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Widget Platform

• Widget dependencies• Path to widget mapping• Erlang web server• Request Flow• Global error pages

19/33

Page 21: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

NGINX Virtual Host declaration

• Domain mapping• Widget static files• Static error pages• URL rewriting

20/33

Page 22: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Request Flow

21/33

Page 23: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Sets Of Widgets In One Platform

• Allows the cration of small deltas• Different prearranged sets can be requested• Different sets can be built per request

22/33

Page 24: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Master & Slaves In 1 VM

• The platform master node runs:I A web serverI A management interfaceI A specific set of widgets

• Each slave node runs:I Its own specific set of widgets

23/33

Page 25: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Master & Slaves In 1 VM

• The platform master node runs:I A web serverI A management interfaceI A specific set of widgets

• Each slave node runs:I Its own specific set of widgets

23/33

Page 26: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

wdg1/?origins=w1,preview;w5,preview

• Widgets can be called in anynode

• Widgets can fail• Widgets can be disabled

24/33

Page 27: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Managing Widgets

25/33

Page 28: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

The Need For A Widget Manager

• To manage widgets and versions in the platform nodes• To keep the clustered platforms in sync• To make changes in the cluster in an easy way

26/33

Page 29: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

How does it work

• SWIFT as a central widgetrepository

• HTTP interface with simpleGUI

• Uses the platformmanagement interface:

I List nodesI List widgets in a nodeI Enable/disable widget in a

nodeI Change widget version in a

node

• Enforces configuration to newcluster members

27/33

Page 30: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

What’s in the Future?

28/33

Page 31: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Lessons Learned

• Reinforce the concepts adoption often• Review, review, review• Measure performance from early

stages

29/33

Page 32: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Coming in H2

• Native widget to backend connectivity• Per widget render timeout• In req caching of the BE calls• Performance analysis and improvements• Router to be open sourced

30/33

Page 33: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

What We’ve Used

• ErlyDTL• Cowboy• Lager• Rebar

I (*) semantic versioning, i.e. [">=1.3.1", "<2.0.0"]I (*) shared dependenciesI (*) xref fixes

• Lhttpc• Estatsd

31/33

Page 34: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

Questions?

32/33

Page 35: A Web Widget Platform

IntroductionSpilgames & Me

Old PortalsLandscapeOverview

Evaluation

Wish ListTech Wishes

Taskforce Wishes

AvailableFrameworks

A WidgetPlatformComponents

The Flow

Testing &Deploying

ManagingWidgetsHolding Control

Next StepsSummary

Contributions

See You Around!

Thanks!

33/33