Lessons Learned from Building aHigh-Traffic Express Webapp – NodeConf Barcelona 2015 – Bad Example – do not do this!



Lessons Learned from Building aHigh-Traffic Express Webapp – NodeConf Barcelona 2015 – Bad Example – do not do this!

0 0


lessons-learned

Lessons Learned from Building a High-Traffic Express Webapp - Presentation from NodeConf Barcelona 2015

On Github pahund / lessons-learned

Lessons Learned from Building aHigh-Traffic Express Webapp

NodeConf Barcelona 2015

Patrick Hund, software developer at mobile.de

  • shortcut "b" for black screen
  • don't talk too much about project yet, just read what's on the slide
  • personal introduction

Germany's biggest automotive ecommerce platform

part of since 2004

10.81M visitors / month

(AGOF Digital Facts 2015-06)

~300 requests / second

high traffic:
  • performance
  • safety – failure affects many, many customers
exciting project: throw away the old stuff, rebuild from scratch, every dev's dream
  • clearer, more modern layout
  • optimized for touch devices (tablets)

Breaking the Monolith

  • most important aspect from a technical point of view
  • ongoing process since last year
  • monolith? large, complex system of tightly coupled modules and components
  • crippling technical debt
  • making changes: great cost and high risk
  • rembember the wrecking ball!

Service-oriented Architecture (SOA)

  • most are still Java, but engineers have leeway to choose right tool for the job
  • loosely coupled webapps and services
  • easy to maintain and even replace single parts

Service-oriented Architecture (SOA)

Lessons Learned

not enough time to talk about all of them, just the most important
  • story: fixed deadline, exciting weeks of coding, new technology
  • load tests started just a few days before launch date
  • "silent" release before launch
  • Gatling tests run against production system
  • massive performance problems
  • "hackathon" to remove faulty module
a phenomenon every developer knows: tearing down with your butt what you've build up with your hands

Bad Example – do not do this!

config.js

const path = "./makes.json"

export default {
    path
};
                        

makes.js

import config from "./config";

const data = require(config.path);

function get(segment) {
    return data[segment];
}

export default {
    get
};
                        

makes-test.js

import chai from "chai";
import makes from "./makes";

chai.should();

let result = null;

describe("When I use the makes module", () => {
    describe("to get car makes", () => {
        before(() => result = makes.get("cars"));
        describe("the result", () => {
            it("is a list of car makes", () => {
                result[0].name.should.equal("Abarth");
                result[1].name.should.equal("AC");
                result[2].name.should.equal("Acura");
            });
        });
    });
});
                        

Good Example

config.js

const path = "./makes.json"

export default {
    getPath() {
        return path;
    }
};
                        

makes.js

import config from "./config";

let data = null;

function init() {
    data = require(config.getPath());
}

function get(segment) {
    return data ? data[segment] : null;
}

export default {
    init,
    get
};
                        

makes-test.js

import chai from "chai";
import sinon from "sinon";
import config from "./config";
import makes from "./makes";

chai.should();

let result = null;

describe("When I use the makes module", () => {
    describe("to get car makes", () => {
        before(() => {
            sinon.stub(config, "getPath").returns("./test-makes.json");
            makes.init();
            result = makes.get("cars");
        });
        describe("the result", () => {
            it("is a list of car makes", () => {
                result[0].name.should.equal("CarMake1");
                result[1].name.should.equal("CarMake2");
                result[2].name.should.equal("CarMake3");
            });
        });
        after(() => config.getPath.restore());
    });
});
                        

Patrick Hund Software developer at mobile.de

Follow me on Twitter: @wiekatz

Slides available on GitHub: pahund.github.io/lessons-learned

Visit the eBay Technology Europe blog: technology.ebay.de

Cross stitch headlines made with Photofunia

Lessons Learned from Building aHigh-Traffic Express Webapp NodeConf Barcelona 2015 Patrick Hund, software developer at mobile.de shortcut "b" for black screen don't talk too much about project yet, just read what's on the slide personal introduction