Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

DOTNET: TLS & Its Versions impact on Performance

This will be a fun little lab. Letโ€™s make one self-contained Program.cs you can run from command line and flip between TLS 1.2 and TLS 1.3 without changing code.

Weโ€™ll also add a /metrics endpoint so you can see basic latency stats directly from the app.


1. One-page complete code (Program.cs)

Create a new minimal API:

dotnet new web -n TlsTlsDemoApi
cd TlsTlsDemoApi
Code language: JavaScript (javascript)

Now replace the entire contents of Program.cs with this:


2. How to run with TLS 1.2 vs TLS 1.3

๐Ÿ”น Windows PowerShell

Run with TLS 1.2:

$env:TLS_VERSION = "12"
dotnet run
Code language: PHP (php)

Youโ€™ll see:

Using: TLS 1.2
Listening on: https://localhost:5001
Code language: JavaScript (javascript)

Run with TLS 1.3:

Stop the app, then:

$env:TLS_VERSION = "13"
dotnet run
Code language: PHP (php)

Youโ€™ll see:

Using: TLS 1.3
Listening on: https://localhost:5001
Code language: JavaScript (javascript)

3. How to โ€œload testโ€ it quickly

You can use Postman, or just use curl loops from command line.

๐Ÿ”น Simple curl loop (Linux/macOS / Git Bash)

for i in {1..200}; do curl -k -s "https://localhost:5001/ping" > /dev/null; done
Code language: JavaScript (javascript)

๐Ÿ”น Simple PowerShell loop (Windows)

1..200 | ForEach-Object {
    curl -k -s "https://localhost:5001/ping" > $null
}
Code language: JavaScript (javascript)

Then check metrics:

curl -k "https://localhost:5001/metrics"
Code language: JavaScript (javascript)

Youโ€™ll see something like:

{
  "tls": "TLS 1.2",
  "totalRequests": 200,
  "averageDurationMs": 6.3,
  "maxDurationMs": 15.2
}
Code language: JSON / JSON with Comments (json)

Run again with TLS 1.3 and compare:

  • averageDurationMs
  • maxDurationMs

Under heavier load (larger loops, multiple clients), youโ€™ll see TLS 1.3 usually gives better latency and smoother max values, especially when handshake overhead matters (cold clients).


4. Where to see CPU / memory

You asked:

โ€œDo we have any way to see the load metrics in the code itself?โ€

We did that with /metrics (per-request latency). For CPU and memory, best is:

๐Ÿ”น Option A: dotnet-counters (recommended)

Find PID:

dotnet-counters ps

Then:

dotnet-counters monitor --process-id <PID> System.Runtime
Code language: HTML, XML (xml)

Watch:

  • cpu-usage
  • gc-heap-size
  • gen-0-gc-count etc.

Run your load loop and watch how TLS 1.2 vs 1.3 behaves.

๐Ÿ”น Option B: Task Manager

Just open Task Manager โ†’ Details โ†’ dotnet.exe, watch CPU and Memory while you hit /ping.


5. How to use this in your understanding

  1. Start with TLS 1.2 (TLS_VERSION=12).
  2. Run a curl/Postman loop, show /metrics.
  3. Show CPU/memory with dotnet-counters or Task Manager.
  4. Switch to TLS 1.3 (TLS_VERSION=13).
  5. Repeat same load โ†’ compare metrics.
  6. Explain:
    • Less handshake overhead
    • Better latency
    • Lower CPU under same load (especially when doing many short connections).

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Top 10 Model Benchmarking Suites: Features, Pros, Cons & Comparison

Introduction Model Benchmarking Suites help AI teams test, compare, and validate machine learning models, large language models, multimodal models, and AI agents before they are deployed in…

Read More

Top 10 Model Compression Toolkits: Features, Pros, Cons & Comparison

Introduction Model compression toolkits help AI teams reduce the size, memory usage, latency, and serving cost of machine learning models while keeping useful performance as high as…

Read More

Top 10 Model Quantization Tooling: Features, Pros, Cons & Comparison

Introduction Model quantization tooling helps AI teams make models smaller, faster, and cheaper to run by reducing numerical precision. Instead of running every model weight or activation…

Read More

Top 10 Model Distillation Toolkits: Features, Pros, Cons & Comparison

Introduction Model distillation toolkits help AI teams transfer knowledge from a larger, more capable model into a smaller, faster, and cheaper model. In simple terms, the larger…

Read More

Top 10 RLHF / RLAIF Training Platforms: Features, Pros, Cons & Comparison

Introduction RLHF and RLAIF training platforms help AI teams improve model behavior using structured feedback. RLHF, or reinforcement learning from human feedback, uses human preference signals, ratings,…

Read More

Certified FinOps Architect: The Ultimate Roadmap for Cloud Financial Engineering

Introduction The journey to becoming a Certified FinOps Architect is a strategic move for any technical professional looking to bridge the gap between engineering excellence and financial…

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jason Mitchell
Jason Mitchell
5 months ago

Very helpful article โ€” this gives .NET developers a clear picture of why TLS version matters not just for security but for application performance too. Itโ€™s especially useful how you highlight that upgrading to modern protocols (like TLSโ€ฏ1.3 when available) reduces handshake latency, simplifies cipher negotiation, and reduces computational overhead โ€” all of which lead to faster, more efficient secure connections. Given how many applications rely on HTTPS or secure sockets, adopting TLS bestโ€‘practices in .NET (and letting the OS or runtime choose the latest TLS version rather than hardโ€‘coding older ones) is a smart, futureโ€‘proof move. Thanks for bringing that attention to TLS tuning for real-world .NET workloads. ๐Ÿ‘

Skylar Bennett
Skylar Bennett
5 months ago

This article does an excellent job of explaining how different versions of Transport Layer Security (TLS) impact the performance of .NET applications. It clearly shows why upgrading to a newer version โ€” especially TLS 1.3 โ€” is beneficial: it reduces handshake latency, simplifies cipher suites, and lowers computational overhead, all of which help web services run faster and more securely. The breakdown of how handshake rounds, encryption/decryption cost, and cipher selection affect throughput and responsiveness makes it particularly useful for developers tuning performance under load. In short, this post offers both a clear theoretical foundation and pragmatic guidance for improving security without sacrificing performance.

2
0
Would love your thoughts, please comment.x
()
x