Meteor in production

39
IN PRODUCTION

Transcript of Meteor in production

IN PRODUCTION

Remco Veldkamp

★ Q42 - “happy place for nerds”

★ full-stack developer

★ worked on Rijksmuseum.nl

★ Meteor fan \o/

Q42 & Meteor

★ weekend hacks

★ prototypes

★ internal apps

★ …?

DemocratieLAB

★ “museum-tour”

★ 1 class of students at the time

★ tablet app guides student through museum

★ student answers questions on tablet

★ printed certificate at the end

Tablet app

Tech requirements

30 x Samsung G Tab

2

1 Windows pc

bad wifi :-(

recap

★ distributed application

★ robust w/r lossy network

This is a job for..

UX opportunities

realtime reactivity

‘Balie pc’ - teacher

Teacher - insert a new class

Classes = new Mongo.Collection(‘classes’);

Classes.insert({

location: "Aa en Hunze",

schoolType: "Basisonderwijs",

route: "42",

active: true

});

<button data-action=continue

class="fade {{#if activeClass}}visible{{/if}}">

ga verder

</button>

Template.player_welcome.helpers({

activeClass : function() {

return Classes.findOne({ active:true }); // livequery

}

});

Student view reacts

Realtime feedback

for free :-)

Realtime dashboard

Realtime dashboard

Teachers

★ instant feedback

about what’s going

on

★ more control: ability

to take action

Testing

Testing

★ end-to-end

★ the whole flow

★ real hardware

★ loadtest on location with real wifi conditions

Testing

one problem...

Autoplaytm

★ Hidden feature

behind debug flag

★ Accessible from

dashboard

Autoplaytm

Students.find(Session.get(‘studentId’)).observe({

changed: function(student) {

if (student.autoplay)

Meteor.setInterval(randomAnswer,

1000);

}

});

Performance under load

Requirements:

★ 30 tablets

★ pressing buttons every second

Autoplay!

Load test

Load test results

Latency compensation hides most of the delays

★ starting Tour was slow

★ circles in dashboard were lagging

Let’s investigate!

Load test results

Kadira

Arunoda Susiripala

Kadira: metrics

★ cpu usage

★ memory usage

★ pub/sub response time

★ method response time

Wait a minute..

Autopublish!

Solution

$ meteor remove autopublish

Solution

// server

Meteor.publish("studentById", function (id) {

return Students.find(id);

});

// client

Tracker.autorun(function() {

Meteor.subscribe("studentById", Session.get('studentId'));

});

±25ms

method response time

Conclusions

Conclusions

★ Real-time reactivity: UX opportunities

★ autopublish: use only for prototyping

★ latency compensation may hide problems

★ Kadira is a must-have

★ Meteor is ready for production

★ We’ll definitely be using it at Q42!

Conclusions

Q42.com

@remcoder

thx