.NET Academy

Visualizers & labs

Interactive models of what happens under the hood. They also appear inside the lessons they belong to.

Memory: stack & heap

Step through code and watch variables, references and objects. Used in Value types vs reference types.

Interactive

Stack & heap

References: two variables, one object

1/9

Code

1int age = 36;
2var ada = new Person("Ada");
3var alias = ada;
4alias.Name = "Grace";
5Rename(ada);
6ada = null;
7alias = null;
8
9void Rename(Person p)
10{
11 p.Name = "Linus";
12}

Stack

Main()

  • intage36

Heap

(empty)

age is an int — a value type. The number 36 is stored directly inside the method's stack frame.

Garbage collection

Allocate objects, drop references and see generations at work. Used in Track 5 · Memory & Runtime.

Interactive

Garbage collector

Allocate objects, drop references, and run collections

Gen 0

2/8 · collected 0×

New objects. Collected often & fast.

Gen 1

collected 0×

Survived one GC. A buffer.

Gen 2

collected 0×

Long-lived. Collected rarely.

reachable (click to drop its reference) garbageObjects freed so far: 0
  • Long-lived objects (config, logger, cache) already sit in older generations.

async / await and threads

Compare blocking and asynchronous request handling on the same thread pool. Used in Track 6 · Async & Concurrency.

Interactive

Threads: blocking vs async/await

Each request: 1 unit of CPU work, a 4-unit database call, then 1 more unit of CPU

01234567891011

Requests

Request 1T1T1done at 6
Request 2T2T2done at 6
Request 3T1T1done at 12
Request 4T2T2done at 12

Thread pool

Thread 11133
Thread 22244
T1CPU work on a threadWaiting for the databaseQueued: no free thread

All requests finished at

t = 12

async: 7

Average response time

9.0

async: 6.5

Thread time wasted blocked

16 units

async: 0

With blocking code (var rows = db.Query(...) or .Result), a thread sits idle while the database works — the striped cells. Other requests queue up even though the CPU has nothing to do. Switch to async / await to compare.

The journey of a request

DNS, TLS, load balancers, servers, caches and databases. Used in Track 7 · Backend Fundamentals.

Interactive

The journey of a request

From pressing Enter to a rendered page

1/13

Browser

Your computer

DNS

Name → IP address

Load balancer

203.0.113.10

Web server

ASP.NET Core

Cache

Redis

Database

SQL Server

Browserhttps://shop.example/products/42+0 ms · total ≈ 0 ms
You type a URL and press Enter. The browser splits it into scheme (https), host (shop.example) and path (/products/42). It first checks whether it already has a fresh copy in its own cache — it doesn't.

HTTP Playground

Send real-looking HTTP requests to a mock API and read the raw responses. Used in Anatomy of an HTTP request.

Interactive

HTTP Playground

Send requests to a mock todo API at https://api.example.com — it runs in your browser

Server state: 2 todos — #1 ✓ Learn HTTP, #2 ○ Build an API

JSON Web Tokens

Decode tokens, read claims and see why signatures matter. Used in Track 7 · Auth & security.

Interactive

JWT decoder

Decode a JSON Web Token and verify its signature (HS256)

Generating a sample token…

A JWT is signed, not encrypted: anyone can decode the header and payload — never put secrets in them. The signature only proves the token was issued by someone who knows the secret and hasn't been modified. Try Tamper: the payload now says admin, but the signature no longer matches. Without the secret, an attacker can't produce a valid one — that's what an API checks on every request.

ASP.NET Core middleware

Follow requests through the pipeline, including short-circuits and exceptions. Used in Track 11 · Web with ASP.NET Core.

Interactive

ASP.NET Core middleware pipeline

Follow a request in through each middleware and the response back out

1/10
GET https://shop.example/api/orders
Authorization: Bearer eyJhbGci…
  1. 1Exception handler↓ request
  2. 2HTTPS redirection
  3. 3Static files
  4. 4Routing
  5. 5Authentication
  6. 6Authorization
  7. 7Endpoint

Program.cs

var app = builder.Build();
 
app.UseExceptionHandler("/error");
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/api/orders", GetOrders).RequireAuthorization();
 
app.Run();

Middleware runs in the order it's registered. Each one can act, then call next() — or stop the request right there.

The request enters the pipeline. The exception handler wraps everything after it in a try/catch.

LINQ → SQL

See the SQL Entity Framework Core generates — and the N+1 problem. Used in Track 10 · Data & EF Core.

Interactive

LINQ → SQL

What Entity Framework Core actually sends to the database (SQL Server)

C# (LINQ)

var cheap = await db.Products
    .Where(p => p.Price < 20)
    .OrderBy(p => p.Name)
    .ToListAsync();

Generated SQL1 query sent

SELECT [p].[Id], [p].[Name], [p].[Price], [p].[Stock]
FROM [Products] AS [p]
WHERE [p].[Price] < 20.0
ORDER BY [p].[Name]

Rows returned

IdNamePriceStock
2Mouse19.9910
3Notebook4.5100
4Pen1.20
Where becomes WHERE and OrderBy becomes ORDER BY. The filtering happens in the database — only matching rows travel over the network.

SQL sandbox

Write real SQL against a small shop database, and solve the challenges. Used in Track 7 · Databases.

Interactive

SQL sandbox

A real SQLite database running in your browser — a small online shop

Challenge

List the names and emails of all customers who live in London.

HintUse WHERE city = 'London' — text values go in single quotes.
Loading editor…
Ctrl + Enter to run

Caching

Hit rates, latency, LRU eviction, TTLs and stale data. Used in Track 7 · Performance & scaling.

Interactive

Caching

20 products, popular ones requested far more often · database 80 ms · cache 2 ms

Hit rate

0%

Avg response time

0 ms

Database queries

0 / 0

Stale reads

0

Recent requests

  • Send some requests…

Cache contents (0/5) — most recently used first

Database: product #1 is at version v1.

A hit is served from memory in 2 ms; a miss goes to the database (80 ms) and stores the result. Because a few products are much more popular, even a small cache gets a high hit rate. Try disabling the cache, shrinking it, or then click Update product #1.

Scaling

Add servers, caches and replicas as traffic grows — and watch the bottleneck move. Used in Track 7 · Performance & scaling.

Interactive

Scaling a web app

Each request needs one database query unless the cache answers it

Web servers1
Read replicas0

Users

200 req/s

Load balancer

1 target

Server 1

200 rps

DB primary

200 q/s

Latency (typical)

342 ms

Failed requests

25%

Busiest tier

> 100%

Monthly cost

$240

Overloaded: 25% of requests fail (timeouts / 503s). The bottleneck is the web servers. Scale out — add servers behind the load balancer — or scale up to larger machines.

System design

Sketch architectures for real products and check them against requirements. Used in Track 7 · System design basics.

Interactive

System design canvas

Build an architecture, then check it against the requirements

Turn long URLs into short links (like bit.ly). 100 million redirects a day, but only 1 million new links. Reads vastly outnumber writes, and redirects must be fast.

Add components with the buttons above. Click a component to select it, then “Connect selected” and click another.

Requirements check: 0/4

  • ○ Clients reach the system through a load balancerOne public entry point that can route around failures.
  • ○ At least 2 API servers behind the load balancerNo single point of failure, and room to scale out.
  • ○ API servers store links in a databaseThe mapping short code → URL must survive restarts.
  • ○ A cache sits next to the API for hot linksPopular links get millions of hits; serve them from memory.