%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
Breaking a monolith: In-place refactoring with service-oriented architecture at a life-sciences startup
1. Breaking a Monolith
In-Place Refactoring with Service-Oriented Architecture
at a Life-Sciences Startup
Ryan M Harrison, PhD
Head of Engineering
BioBright
12. 12
Code: 2016
exports.lastActions = function(req, res) { // data query for lastActions, ember data model
console.log("req: ", req.query);
var user = req.query.user; // get user
var x1 = Math.floor(req.query.x[0]); // get start of time range
var x2 = Math.floor(req.query.x[1]); // end of time range
coknexions[req.lab]('data') // query from data table on users lab
.whereIn('source', user) // query source
.whereBetween("x",[x1, x2]) // query range
.orderBy('x', 'desc') // oldest to newest
.then(function(r){ // results in r
res.json({lastActions:r}); // send in form expected by ember
});
};
13. 13
Self-reflection
exports.lastActions = function(req, res) {
console.log("req: ", req.query);
var user = req.query.user;
var x1 = Math.floor(req.query.x[0]);
var x2 = Math.floor(req.query.x[1]);
coknexions[req.lab]('data')
.whereIn('source', user)
.whereBetween("x",[x1, x2])
.orderBy('x', 'desc')
.then(function(r){
res.json({lastActions:r});
});
};
No documentation
14. 14
Self-reflection
exports.lastActions = function(req, res) {
console.log("req: ", req.query);
var user = req.query.user;
var x1 = Math.floor(req.query.x[0]);
var x2 = Math.floor(req.query.x[1]);
coknexions[req.lab]('data')
.whereIn('source', user)
.whereBetween("x",[x1, x2])
.orderBy('x', 'desc')
.then(function(r){
res.json({lastActions:r});
});
};
Minimal logging
15. 15
Self-reflection
exports.lastActions = function(req, res) {
console.log("req: ", req.query);
var user = req.query.user;
var x1 = Math.floor(req.query.x[0]);
var x2 = Math.floor(req.query.x[1]);
coknexions[req.lab]('data')
.whereIn('source', user)
.whereBetween("x",[x1, x2])
.orderBy('x', 'desc')
.then(function(r){
res.json({lastActions:r});
});
};
No input specification
(or validation)
No output specification
16. 16
Self-reflection
exports.lastActions = function(req, res) {
console.log("req: ", req.query);
var user = req.query.user;
var x1 = Math.floor(req.query.x[0]);
var x2 = Math.floor(req.query.x[1]);
coknexions[req.lab]('data')
.whereIn('source', user)
.whereBetween("x",[x1, x2])
.orderBy('x', 'desc')
.then(function(r){
res.json({lastActions:r});
});
};
Inadequate interface to DB layer
20. 20
Not tall enough
Dev portal
Monitoring
On demand infra scaling
Continuous Integration
Continuous Deployment
21. 21
Glide paths
API spec → API docs → Dev portal
Logging → Monitoring
Infra → On demand infra scaling
Testing → Continuous Integration
Deployment → Continuous Deployment
35. 35
Summary
API spec Borrow OpenAPI
Logging Borrow + Buy Bunyan +
CloudWatch
Infra Borrow Terraform
Testing Borrow Dredd
Deployment Buy ElasticBeanStalk or
ECS
36. 36
1:1 Service : Swagger controller
1:1 Service : CloudWatch log group
1:1 Service : Terraform Module
1:1 Service : Repo (or Container)
Service Oriented Architecture