scaling

Cleo

It's time to discuss the elephant...

Gavin

Pillar lead for EWA + Credit

aka Bodacious

Pop Quiz

What do these four fictional stories have in common?

Pop Quiz: Answer

They are all examples of people misunderstanding scale!

Spiderman

Explanation:

  • Ratio of surface area to mass too low
  • Would need enormous hands, 1m wide
  • Would rip his skin apart

Wall crawling works at spider scale, not human scale

King Kong

Explanation:

  • Bones would not support weight
  • Would struggle to dissipate heat
  • Heart could not produce enough pressure to circulate blood around his body

Gorillas work at gorilla scale, not King Kong scale

The Borrowers

Explanation:

  • Would lose a lot of body heat and water
  • Struggle to breathe
  • Would be practically blind

Humans work at human scale, not at borrower (5cm) scale

Up

Explanation:

  • Would require an impossible amount of balloons
  • Would take too long to fill those balloons
  • House would rip apart from the forces

Lifting things with balloons works at toy scale, not at house scale

2x 8 inches

1x 12 inches

Pop quiz 2:  Choose

The point?

We really struggle to understand scale!

  • Specifically, we struggle to understand non-linear scaling
  • When we change one dimension of a system, we often see disproportionate result
  • Non-linear scaling can mean that limiting factors can surprise us

Non-linear scaling

5

3

1

2

4

Expectation

Reality

Cleo is scaling!

  • Scaling in our data
  • Scaling in our code
  • Scaling in our organisation

Challenge: Database capacity

Hard limit

Bajillion TB

Expectation

Reality

Join performance suddenly degrades!

Latency

Join size (memory)

Expectation

Reality

Index performance suddenly plummets!

Latency

Index size

Expectation

Reality

More connections throttles PG performance

Latency

Connections

Challenge: Code complexity

  • Code metrics (LoC etc), tend to scale linearly
  • Interactions between code objects scale non-linearly

Challenge: Code complexity

Challenge: Code complexity

Challenge: Code complexity

Code complexity

Expectation

Reality

Code objects

Complexity

Challenge: Code complexity

Challenge: Code complexity

Challenge: Code complexity

Challenge: Organisational complexity

Solving problems with Lego!

The point?

Solutions are scale-specific

  • Solutions to problems are only useful at certain scale
  • When we reach a limiting factor, the solution has to change

How are we going to solve our problems of scale?

Modularise!

Take some inspiration from nature

Bacteria => Whale

  • Smallest living organism
    • Mycoplasma genitalium - 10^-16 grams
  • Largest living creature
    • Blue whale - 10^8 grams
  • 24 orders of magnitude
  • Greater than the diff. between Earth and the Milky Way
  • Nature knows how to scale!

Take some inspiration from nature

Bacteria => Whale

Blue whale

Mycoplasma Genitalium

10^ -16 grams

10^ 8 grams

How nature scales

  • Organises around capability/specialisation
  • Encapsulates—fanatically!
  • Communicates through stable interfaces
  • Uniform design principle
  • Operates under constant failure

How Cleo will scale

  • Organise around capabilities

👣

🫏

🚙

🚂

⛴️

🛩️

Capabilities are fairly constant

Even when the tech changes

Payments

Chat

Transactions

Subscriptions

How Cleo will scale

  • Organise around capabilities
  • Encapsulate—fanatically!

Encapsulate fanatically!

How Cleo will scale

  • Organise around capabilities
  • Encapsulate—fanatically!
  • Communicate through stable interfaces

Communicate through stable interfaces

Communicate through stable interfaces

Communicate through stable interfaces

image/svg+xml Openclipart 2010-09-23T04:19:58 https://openclipart.org/detail/86401/internet-icon-by-ben ben
  • Icon
  • internet
  • world
  • Communicate through stable interfaces

    # some other domain 
    
    class DoThingWithUser
      
      def user_is_nitro?
        Subscriptions.current_user_tier_nitro?(user_id: @user.id)
      end
      
    end

    Encapsulate - fanatically!

    Subscriptions

    Payments

    Chat

    How Cleo will scale

    • Organise around capabilities
    • Encapsulate—fanatically!
    • Communicate through stable interfaces
    • Use a uniform design

    Uniform design principle

    Domain A

    Domain B

    Ruby core object

    Ruby core

    object

    Ambassador

    Param

    Object

    ❌ ActiveRecord::Relation

    Uniform design principle

    Domain A

    Domain B

    Uniform design principle

    Domain A

    Domain B

    📡

    👂

    Domain C

    👂

    How Cleo will scale

    • Organise around capabilities
    • Encapsulate—fanatically!
    • Communicate through stable interfaces
    • Use a uniform design
    • Build for failure

    Recap

    Solutions do not scale linearly

    We struggle to understand non-linear scale

    Cleo is scaling - we need to understand this!

    To operate at larger scale, we will modularise

    Recap (...cont)

    Enforce encapsulation

    Enforce stable interfaces

    Uniform design pattern

    Organise around capabilities

    Work so far

    We've established a Proof of Concept with Subscriptions

    We've currently modularising transactions

    Timeline

    2026

    2027

    End of T1

    T2

    T1

    T3

    • Transactions done
    • Second domain done ✅

    End of T2

    • Third domain done

    End of T3

    • Fourth domain done

    #collab-modular_monolith

    Fin!

    Scale

    By Gavin Morrice