Theme

Interactive diagram · architecture

Design Mint.com

Design Mint.comA client reaches Mint through DNS, a CDN, load balancers, and web servers. Accounts and transaction work flows through APIs, a queue, services, SQL storage, object storage, cache, and read replicas. Design Mint.comDiagram after donnemartin/system-design-primer · CC BY 4.0 ClientDNSCDNLoad BalancerWeb ServerAccounts APISQL WriteMaster–Slave1 · Connect accountCategoryServiceBudgetServiceNotificationServiceTransactionExtractionServiceQueueObjectStore2 · Extract transactions3 · Recommend and notifyRead APIMemory CacheSQL ReadReplicas4 · Read summaries Design Mint.com Mint.com traffic uses DNS, a CDN, load balancers, web servers, APIs, asynchronous services, SQL storage, object storage, a cache, and read replicas. Design Mint.com Diagram after donnemartin/system-design-primer · CC BY 4.0 Client DNS CDN Load Balancer Web Server Accounts API 1 · Connect account CategoryService BudgetService NotificationService TransactionExtractionService Queue ObjectStore 2 · Extract transactions 3 · Recommend and notify Read API Memory Cache SQL WriteMaster–Slave SQL ReadReplicas 4 · Read summaries
×

2 · Extract transactions

Extract transactions

Slow extraction moves to a queue, then the worker stores, categorizes, and aggregates the result.

×

4 · Read summaries

Read summaries

The read path checks memory first and falls back to SQL read replicas.

×

DNS

What it is

It resolves the Mint domain for the client.

Its job here

It receives the client lookup. It directs the client toward Mint's front door.

Trade-off

DNS is one of the components added to address scalability issues.

In the primer

Domain name system › Disadvantage(s): DNS →

×

CDN

What it is

A cache for static content.

Its job here

It serves static content from the Object Store to the client. It reduces work on the Web Server.

Trade-off

Static content can be served from the Object Store and cached on the CDN.

In the primer

Content delivery network › Pull CDNs →

×

Load Balancer

What it is

A replicated front door for application traffic.

Its job here

It receives client traffic after DNS. It forwards requests to the Web Server fleet.

Trade-off

Load balancers and multiple Web Servers address bottlenecks.

In the primer

Load balancer › Horizontal scaling →

×

Web Server

What it is

A reverse proxy for Mint requests.

Its job here

It receives client traffic from the Load Balancer. It forwards account work to Accounts API and reads to Read API.

Trade-off

Internal load balancers are not shown to reduce clutter.

In the primer

Reverse proxy › Load balancer vs reverse proxy →

×

Category Service

What it is

A seller-to-category dictionary.

Its job here

Transaction Extraction Service sends it each transaction. It hands a category back for the Budget Service and SQL Database.

Trade-off

Manual category overrides can supply sellers not initially seeded in the map.

×

Budget Service

What it is

The service that calculates monthly spending by category.

Its job here

It receives categorized transactions from Transaction Extraction Service. It passes budget status to Notification Service and stores monthly spending.

Trade-off

A generic budget template means only user overrides need storage.

×

Notification Service

What it is

A service that tells users about budget and extraction events.

Its job here

It receives budget status from Budget Service and completion events from Transaction Extraction Service. It sends notices to the user asynchronously.

Trade-off

Budget notifications do not need to be instant.

In the primer

Asynchronism › Message queues →

×

Transaction Extraction Service

What it is

A worker that extracts transactions for an account.

Its job here

It pulls jobs from Queue. It writes raw logs to Object Store, calls Category Service and Budget Service, then updates SQL Database.

Trade-off

Extraction can take awhile, so asynchronous work adds complexity.

In the primer

Asynchronism › Task queues →

×

Queue

What it is

A holding area for slow account work.

Its job here

Accounts API puts extraction work on it. Transaction Extraction Service pulls the job and starts processing.

Examples

  • Amazon SQS
  • RabbitMQ

Trade-off

It lets the service extract transactions asynchronously, but adds complexity.

In the primer

Asynchronism › Message queues →

×

Accounts API

What it is

The API that accepts financial account details.

Its job here

It receives account requests from the Web Server. It updates the SQL Database accounts table and queues extraction work.

Trade-off

Account additions and removals are relatively rare.

In the primer

Application layer › Microservices →

×

Read API

What it is

The API for summaries and transactions.

Its job here

It receives read requests from the Web Server. It checks Memory Cache, then fetches from SQL Read Replicas on a miss.

Trade-off

Popular content should use Memory Cache instead of the database.

In the primer

Cache › Cache-aside →

×

Memory Cache

What it is

Memory for sessions, aggregate stats, and recent transactions.

Its job here

Read API checks it first. On a SQL miss, Read API updates it with fetched content.

Examples

  • Redis
  • Memcached

Trade-off

It helps with uneven traffic and traffic spikes.

In the primer

Cache › Cache-aside →

×

SQL Write Master–Slave

What it is

The SQL database that stores accounts, transactions, and monthly spending.

Its job here

Accounts API writes account details here. Transaction Extraction Service writes categorized transactions and monthly aggregates.

Trade-off

A single SQL writer might be tough for transaction writes.

In the primer

Database › Master-slave replication →

×

SQL Read Replicas

What it is

SQL copies that serve read cache misses.

Its job here

They receive cache-miss reads from Read API. They return summaries and transactions to Read API.

Trade-off

Replicas must not be bogged down with replicating writes.

In the primer

Database › Master-slave replication →

×

Object Store

What it is

Storage for raw transaction log files and static content.

Its job here

Transaction Extraction Service writes raw logs here. CDN can serve its static content to the client.

Examples

  • Amazon S3

Trade-off

Running analyses on transaction files can reduce database load.

← → step · space play/pause · R replayStep 4 of 4

Detail · follows playback, or click any box or step to pin it

Click any box for an explanation, or use Next or Play to walk through the four steps.

1 · Connect an account

The client reaches a Web Server, which sends account information to Accounts API. Accounts API updates the SQL accounts table.

2 · Extract transactions

Accounts API queues the slow job. The worker extracts logs, categorizes transactions, aggregates spending, and updates storage.

3 · Recommend and notify

Budget Service calculates spending by category and asks Notification Service to warn users near or over budget.

4 · Read summaries

Read API checks Memory Cache first. On a miss it fetches SQL data and refreshes the cache.