meteor @ sharethis

25
SHARETHIS Insights Ishika Paul Principle Engineer

Upload: ishika-paul

Post on 09-Aug-2015

163 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Meteor @ Sharethis

SHARETHISInsights

Ishika Paul

Principle Engineer

Page 2: Meteor @ Sharethis

The Team

Jack Zhang Neil Lobo Jeff Blanding Ishika Paul

Page 3: Meteor @ Sharethis

SHARING TOOLS AT SCALE

2.4 MM SITES AND APPS

120 SOCIAL CHANNELS

1. comScore Media Matrix Report * Includes PC, Tablet, and Mobile sites.

210 MM US USERS1

95% REACH*

Page 4: Meteor @ Sharethis

EVENT INSIGHTS

Page 5: Meteor @ Sharethis

BRAND ACTIVATION INSIGHTS30 DAY ACTIVITY

TRENDSCHANNEL BREAKOUT

GENDER BREAKOUT AGE BREAKOUT

Page 6: Meteor @ Sharethis

Challenge● Shut down 3 hadoop

clusters (~100 machines)● integrate 4 existing

products ● Support over 30 insights

reports● Release to clients by

June 1 (dev started in early March)

Page 7: Meteor @ Sharethis

Challenge

● Build a new team

● Analyze 350TB of Data

● increase response time

by 100x

Page 8: Meteor @ Sharethis

Challenge Accepted

● Relatively Clean Code

● Reuseable code

● Reactive and

Responsive UI

● Unit Testing

Page 9: Meteor @ Sharethis
Page 10: Meteor @ Sharethis

Reactiveness with Meteor

● Built in integration with Mongodb

● Publish - Subscribe for immediate

reactiveness

● No polling for up-to-date data

● Use of websockets is opaque to developers

Page 11: Meteor @ Sharethis

Response Architecture Demo

Page 12: Meteor @ Sharethis

Response Architecture

ServerMeteor.publish("job-status", function (jobId) { return JobCollection.find(jobId);});

ClientTracker.autorun(function () { var jobId =

Session.get("jobId"); Meteor.subscribe("job-status",

jobId); var item =

Downloads.findOne({"jobId":jobId}); if (!item) { return; } var job =

jobService.getJob(jobId); if (job && job.key) { downloadReport(job,

item.campaignGroup); }

}

Page 13: Meteor @ Sharethis

Jasmine Integration

Page 14: Meteor @ Sharethis

Meteor: Jasmine integration

What we loved

● writing test are easy!

● Peace of mind

Not so much

● mocking meteor mongo

● no code coverage

● have to remember to add

tests

Page 15: Meteor @ Sharethis

Free Stuff!

Page 16: Meteor @ Sharethis

What is a Insights Report?

Each type a client calls a report:● Create a valid job for that particular type of Insights

● Return cached report data if job already ran

● Create new job, send back jobId to client.

Spawn off Async job to:o Call Rest-Insights

o save BQ data into S3 and key into Mongo

o Update Job state (Success | Failed)

Page 17: Meteor @ Sharethis
Page 18: Meteor @ Sharethis

Building New Reports is Easy CampaignInsights Prototypes Example

CampaignInsights = function() {};

CampaignInsights.prototype = new baseInsights(new CampaignJobService());CampaignInsights.prototype._decorateData = function (results) {};CampaignInsights.prototype._callInsights = function (job, report, callback) {};

Page 19: Meteor @ Sharethis

CampaignJobService = function() {};CampaignJobService.prototype = Object.create(JobService.prototype);

CampaignJobService.prototype._requiredFields = [campaign required fields];

CampaignJobService.prototype._generatedFields = [generated fields that will be produced];CampaignJobService.prototype.getFilter = function getFilter(aJob) {};CampaignJobService.prototype._enrichJob = function (job) {};CampaignJobService.prototype._generateS3FileName = function (job, partialName){};

Building New Reports is Easy CampaignJobService Prototype Example

Page 20: Meteor @ Sharethis

Prototype Benefits

● No code duplication

● Faster development turn around time

● Common functionality guaranteed to work!

Page 21: Meteor @ Sharethis
Page 22: Meteor @ Sharethis

Response Architecture

● BigQuery supports SQL!● Common Inputs● Report Definition Loading into Mongo:

insertReportWithDefaults({ reportName: "Income Segments of Ad Clickers", insightsType: INSIGHT_TYPE.CAMPAIGN, funcName: 'getInsightsByCampaign', fileName: 'income_segments_clickers', schema: 'segment_name,dlx,count', tooltip: "Number of ad clickers by household income group." });

Page 23: Meteor @ Sharethis

Demo

Page 24: Meteor @ Sharethis

We are hiring :)www.sharethis.com/rocketship

▪ Software Engineers ▪ Site Reliability Engineer / DevOps ▪ Data Scientists▪ Big Data▪ Full Stack▪ Machine Learning / Optimizations

Page 25: Meteor @ Sharethis

QA