Optimizing box-metrics

Nikola Đuza

What's box-metrics?

  • Elixir powered micro service
  • box usage on Semaphore
  • waiting time

Problem

1. Slow API endpoints

Solution

1. Precalculate the data

Problem

2. Slow write/update

Solution

2. Create database index

Database index

“An index makes the query fast”

DB Index

  • structure in the database
  • create index
  • pure redundancy
  • index at the end of a book

Indexes

  • B-tree
  • Hash
  • GiST
  • ...

B-tree

B-tree

B-tree

B-tree

B-tree

  • log2 N
  • log2 (1,000,000) = 20

How to?

Elixir + Ecto

How to?

Rails + ActiveRecord

Optimizing box-metrics

By Nikola Đuza

Optimizing box-metrics

How to optimize a backend by using the power of indexes

  • 1,263