Ilya Brin - Software Engineer

History is written by its contributors

API Gateway Pattern: управление API на Go

2025-06-10 4 min read Architecture Ilya Brin

API Gateway - это единая точка входа для всех клиентов. Он маршрутизирует запросы к нужным микросервисам, обрабатывает аутентификацию, rate limiting и агрегирует ответы. Давайте построим его на Go.

Continue reading

Go Channel Hell: How We Defeated chan map[string]*map[int]chan struct{}

2025-05-14 8 min read Golang Concurrency Refactoring Ilya Brin

Hey Gopher! 👋

Have you ever seen code like chan map[string]*map[int]chan struct{}? If yes, then you know what channel hell is.

This is a story about how we started simple, reached nightmare, and found an elegant solution. A real-time notification system that grew from 100 users to 100,000, and how we refactored the channel architecture.

Spoiler: we ended up replacing all this horror with 3 simple interfaces and typed channels 🚀

Continue reading

Test Doubles: Mocks, Stubs and Dependency Injection in Go

Hey tester! 👋

Are your tests slow, brittle, and dependent on external services? Every time the database is unavailable, half your tests fail?

Test Doubles are your salvation. Instead of real dependencies, use fakes: mocks, stubs, fakes.

Let’s break down how to properly isolate code for testing and write fast, reliable unit tests in Go 🚀

Continue reading

Probability Theory: Bayesian Statistics for A/B Testing in Go

2025-04-29 5 min read Mathematics Ilya Brin

A/B testing is everywhere: button colors, pricing, algorithms. But most implementations use frequentist statistics. Bayesian approach gives you probability of being better, not just “statistically significant”. Let’s implement it in Go.

Frequentist vs Bayesian

Frequentist: “Is the difference statistically significant?”

  • p-value < 0.05 → reject null hypothesis
  • Doesn’t tell you probability of A being better than B

Bayesian: “What’s the probability that B is better than A?”

  • Direct answer: “B is better with 95% probability”
  • Updates beliefs as data arrives

Basic A/B Test

type Variant struct {
    Name        string
    Conversions int
    Visitors    int
}

func (v *Variant) Rate() float64 {
    if v.Visitors == 0 {
        return 0
    }
    return float64(v.Conversions) / float64(v.Visitors)
}

Beta Distribution

For conversion rates, we use Beta distribution:

Continue reading
Older posts Newer posts