Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Klarna Engineering 7 min read Case study easyNovice

How micro should your microservices be?

Klarna split each payment option (pay now, pay later, pay over time) into its own microservice, but shared logic such as authentication, funding sources and risk assessment produced a distributed monolith full of duplicated code and cross-team coordination. A monorepo of still-separate services didn't fix it. Guided by Domain-Driven Design, the team consolidated payments into a modular monolith split by feature modules, with one service and one database and a configurable flow assembled from reusable steps. New payment options now launch in days instead of weeks or months, and the service handles over a million orders daily, including a third of Klarna's Black Friday transactions. The tradeoffs are a single point of failure and the need for strong shared coding and release standards.

Assumes: microservices architectureDomain-Driven Design basics

Related posts

  • You Want Microservices, But Do You Really Need Them?

    Docker easyNovice

    Microservices trade the simplicity of one codebase for network seams, distributed data consistency problems, slow and brittle cross-service testing, and heavy operational tooling, and that trade only pays off at large scale with clear domain boundaries and mature teams. Supporting cases include Amazon Prime Video's VQA team cutting costs 90% by collapsing Step Functions and Lambda into a single process, Twilio Segment merging 140+ services into one monolith, and Shopify choosing a modular Rails monolith. Engineering leaders such as DHH, Jason Warner, Nick Schrock and Kelsey Hightower are quoted in the same direction. The recommended default is a modular monolith, or coarser services, with ACID transactions and in-process calls.

  • Parallel Run Pattern - A Migration Technique in Microservices Architecture

    Zalando Engineering mediumAdept

    Zalando's Returns team extracted returns logic from a legacy monolith into a new microservice using the Parallel Run pattern. After responding to the client, the monolith asynchronously POSTs the original request and its response to a /consistency-checks endpoint, which replays the request locally and compares status, headers and body, emitting matched/unmatched/failed metrics to Prometheus and Grafana. Each endpoint had its own consistency threshold, and traffic was switched one endpoint at a time via the Skipper proxy, which also made rollback a proxy config change. Tradeoffs include roughly doubled load, tricky comparisons (headers, ordering, PDFs), GDPR handling of captured data, unsuitability for non-idempotent endpoints, and significant setup and cleanup effort.

  • Keep the monolith, but split the workloads

    incident.io mediumAdept

    A Go monolith can get much of the reliability isolation of microservices by splitting workloads into separate deployments of the same binary, instead of breaking it into services. After a bad Pub/Sub message caused an unhandled panic that crashed the web, worker and cron threads together for 32 minutes, incident.io split them into independent Heroku dyno tiers selected by command-line flags. They also gave each class of work its own capped Postgres connection pool and statement timeout, so low-priority jobs such as BigQuery event export or best-effort nudges fall behind rather than exhausting the shared database. The main migration hazard is code that assumes a shared process, such as process-local caches, and the fix is to move that coordination into Postgres or Redis.

  • How we use GraphQL at Europe's largest fashion e-commerce company

    Zalando Engineering easyNovice

    Zalando replaced a sprawl of per-page and per-platform Backend-for-Frontend services with a single unified GraphQL API owned via a shared monorepo across 12+ domain teams. The BFFs had duplicated effort, fragmented security and observability, and produced inconsistent data across web and app. The graph is built on Entities such as Product and Campaign and runs on their own GraphQL engine, graphql-jit, under a strict no-business-logic rule. Since 2018 it has grown to serve over 80% of web and 50% of app use cases, with adoption driven by documentation, training and schema consultation, and god-component risk handled through contribution principles, circuit breakers, timeouts, retries and per-platform bulkhead deployments.

  • Scaling Git at OpenAI

    OpenAI hardMaster

    Pando is OpenAI's new Git backend for its monorepo, built to handle the concurrent pushes and fetches generated by Codex-driven parallel development while staying fully compatible with the Git protocol and client. Each branch is coordinated independently: incoming packs are stored as immutable blobs and ref versions are recorded in a horizontally scalable metadata store. This gives per-ref serializability but only causal consistency across the repository. Packfiles are reused across fetches rather than generated per client, trading some redundant bytes for far less server CPU and I/O. Compared with three-phase-commit replicas and a shared-manifest WAL in blob storage, Pando avoids a single write ordering point, and in production it cut median push latency nearly 5x while serving close to a petabyte of Git data per day.

The quest for software engineering knowledge.

Look:
Layout: