Slide 1

Slide 1 text

Monolithic Problems

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

EVIL MARTIANS

Slide 4

Slide 4 text

EVIL MARTIANS

Slide 5

Slide 5 text

Nikolay Sverchkov @ssnickolay Math Elixir

Slide 6

Slide 6 text

My name is potato

Slide 7

Slide 7 text

What is a Monolith?

Slide 8

Slide 8 text

https://en.wikipedia.org/wiki/Monolithic_application

Slide 9

Slide 9 text

Monolithic Application is one git repo with 99% code base of project

Slide 10

Slide 10 text

What is a Huge Monolith?

Slide 11

Slide 11 text

How I can understand my Monolith is Huge or no?

Slide 12

Slide 12 text

Let’s Estimate it!

Slide 13

Slide 13 text

Monolith Estimation: by commits count

Slide 14

Slide 14 text

Monolith Estimation: by commits count

Slide 15

Slide 15 text

Cons: Strategy: merge or rebase? Monolith Estimation: by commits count

Slide 16

Slide 16 text

Cons: Strategy: merge or rebase? Atomic commits or one commit per feature (Pull request)? Monolith Estimation: by commits count

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Monolith Estimation: by count lines of code

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Monolith Estimation: by count lines of code Pros: Amount of commits does not influence on count of code lines

Slide 22

Slide 22 text

Monolith Estimation: by count lines of code Pros: Amount of commits does not influence on count of code lines Cons: There is no connection to REAL production

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

What is it in real and what it seems to be

Slide 25

Slide 25 text

Monolith Estimation: by DataBase size?

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

What does "Large Database” mean?

Slide 28

Slide 28 text

The size of the database for a regular web application can be considered as “Web Big Data” when the backup of this database cannot be restored to the developer computer. Funny Law of “Web BigData”

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Huge Monolith: A lot of commits + A lot of code lines + Deep Production

Slide 31

Slide 31 text

Your Project Team

Slide 32

Slide 32 text

Rails Project Architecture Shark Head

Slide 33

Slide 33 text

Rails Project Architecture Shark Head Elephant Body +

Slide 34

Slide 34 text

Rails Project Architecture Shark Head Elephant Body + Tiger and Rhino Legs +

Slide 35

Slide 35 text

Rails Project Architecture Shark Head Elephant Body + Tiger and Rhino Legs + AND BLASTERS

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

EVIL MARTIANS

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

cloc —exclude- dir=log,node_modules, public,tmp,vendor,lurker, .idea ./ https://github.com/ AlDanial/cloc

Slide 40

Slide 40 text

------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Ruby 3671 30458 3106 145366 JSX 571 5759 43 52618 YAML 182 90 20 33753 JavaScript 492 3247 144 22763 ERB 617 1569 58 18599 Sass 480 3552 194 18024 CoffeeScript 150 874 92 5227 …… …… ------------------------------------------------------------------------------- SUM: 6231 52012 7778 306167 ------------------------------------------------------------------------------- Fountain. 30/05/2018 25.5k commits SUM: 306,167 LOC

Slide 41

Slide 41 text

Is it big enough?

Slide 42

Slide 42 text

Is it big enough?

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Shopify 30/05/2018 ? commits SUM: ? LOC

Slide 49

Slide 49 text

-------------------------------------------------------------------------------- Language files blank comment code -------------------------------------------------------------------------------- Ruby 13995 271122 19124 1290867 YAML 1791 8962 1166 559395 JSON 332 77 0 303475 Sass 484 39191 4968 185032 ERB 2584 7208 83 111490 JavaScript 1065 22635 5956 109023 CoffeeScript 667 12130 1003 45734 SQL 4 14 0 28300 TypeScript 455 3794 190 23939 liquid 64 4391 28 21809 …… …… -------------------------------------------------------------------------------- SUM: 21742 376631 38507 2705978 -------------------------------------------------------------------------------- Shopify 30/05/2018 306k commits SUM: 2.7M LOC

Slide 50

Slide 50 text

Teaser for @isleofruby @eljojo

Slide 51

Slide 51 text

Monolithic Project Health Level

Slide 52

Slide 52 text

Monolith Health Levels Healthy

Slide 53

Slide 53 text

Monolith Health Levels Normal Healthy

Slide 54

Slide 54 text

Monolith Health Levels Normal Healthy Legacy

Slide 55

Slide 55 text

Monolith Health Levels Normal Healthy Legacy

Slide 56

Slide 56 text

Normal • Rails 4 Healthy • Rails 5+ • Rails 4 -> Rails 5 in process Legacy • Rails 3 and lower Monolith Healthy Level: by Rails version

Slide 57

Slide 57 text

Normal • 2.3+ Healthy • Last stable Legacy • 1.9* - What wrong with you, guys? >_< Monolith Healthy Level: by Ruby version

Slide 58

Slide 58 text

Why we should update Ruby?

Slide 59

Slide 59 text

Because yield_self is powerful feature?

Slide 60

Slide 60 text

Security Vulnerabilities

Slide 61

Slide 61 text

Healthy • Use bundler-audit Legacy • Don’t use bundler-audit Monolith Healthy Level: by gems version

Slide 62

Slide 62 text

All Evil Martians projects use “bundler-audit”

Slide 63

Slide 63 text

All Evil Martians projects use “bundler-audit” and “nsp check”

Slide 64

Slide 64 text

Monolith Healthy Level: by Architecture

Slide 65

Slide 65 text

Healthy • It is easy to make changes • You have permanent refactor for an old code Legacy • You use Rails way (sorry, DHH) • You have a bunch of different patterns Monolith Healthy Level: by Architecture

Slide 66

Slide 66 text

Houston, we have a problem (c)

Slide 67

Slide 67 text

Problem = 
 Cause + Solution

Slide 68

Slide 68 text

Solution Cause I need to use some framework… e.g. Trailblazer! Rails MVC is sucks

Slide 69

Slide 69 text

#TODO My opinion about Trailblaizer

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Saint P NickConf

Slide 75

Slide 75 text

Solution Cause Rails MVC is sucks Use MCC! M - Model C - Cells C - Controller

Slide 76

Slide 76 text

class UsersController < ApplicationController def show user = User.find(params[:id]) render_app_cell(Users::Cell::Show, user: user) end end MC(ells)C Example

Slide 77

Slide 77 text

class UsersController < ApplicationController def show user = User.find(params[:id]) render_app_cell(Users::Cell::Show, user: user) end end class ApplicationController < ActionController::Base def render_app_cell(*args) render html: cell(*args), layout: 'application' end end MC(ells)C Example

Slide 78

Slide 78 text

HANAMI

Slide 79

Slide 79 text

Talk about Elixir at the Ruby Conference

Slide 80

Slide 80 text

Solution Cause I can use ROM! ActiveRecord is sucks

Slide 81

Slide 81 text

I

Slide 82

Slide 82 text

I ROM

Slide 83

Slide 83 text

Talk twice about Elixir at the Ruby Conference ROM.rb ~ Ecto

Slide 84

Slide 84 text

Solution Cause I can use ROM! If you can work with complex solutions ActiveRecord is sucks

Slide 85

Slide 85 text

Solution Cause Microservices! Monolithic architecture It’s all sucks

Slide 86

Slide 86 text

Monolithic Microservices vs

Slide 87

Slide 87 text

Monolithic Microservices !=

Slide 88

Slide 88 text

Monolithic Microservices >

Slide 89

Slide 89 text

Monolithic Microservices >

Slide 90

Slide 90 text

Solution Cause Microservices! Good choice! Monolithic architecture It’s all sucks

Slide 91

Slide 91 text

And Last but not to least

Slide 92

Slide 92 text

Opportunity for what?

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

https:// github.com/ palkan/ test-prof

Slide 95

Slide 95 text

https://github.com/palkan/ clowne

Slide 96

Slide 96 text

https://github.com/marshall- lee/sidekiq-postpone

Slide 97

Slide 97 text

https://github.com/marshall- lee/sidekiq-postpone

Slide 98

Slide 98 text

Blood Contracts

Slide 99

Slide 99 text

Next: Blood Contracts @ssnickolay