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 AI Audit Sampling Optimization Tools: Features, Pros, Cons & Comparison

Introduction AI Audit Sampling Optimization Tools are platforms that use artificial intelligence, statistical modeling, and data analytics to improve how audit samples are selected, tested, and validated….

Read More

Top 10 AI GRC Evidence Collection Tools: Features, Pros, Cons & Comparison

Introduction AI GRC Evidence Collection Tools are platforms that help organizations automatically gather, organize, and validate compliance evidence across systems, applications, and workflows using AI-driven automation. In…

Read More

Top 10 AI Third-Party Risk Analytics Tools: Features, Pros, Cons & Comparison

Introduction AI Third-Party Risk Analytics tools are platforms that help organizations assess, monitor, and manage risks originating from external vendors, suppliers, partners, and service providers. These systems…

Read More

Top 10 AI Insider Trading Risk Detection Tools: Features, Pros, Cons & Comparison

Introduction AI Insider Trading Risk Detection tools use machine learning, natural language processing (NLP), behavioral analytics, and network graph modeling to identify suspicious trading behavior that may…

Read More

Top 10 AI AML Case Triage Assistants: Features, Pros, Cons & Comparison

Introduction AI AML (Anti-Money Laundering) Case Triage Assistants are intelligent systems designed to help financial institutions automatically prioritize, classify, investigate, and escalate suspicious financial activities. These tools…

Read More

Top 10 AI KYC Identity Verification with ML Tools: Features, Pros, Cons & Comparison

Introduction AI KYC (Know Your Customer) Identity Verification with Machine Learning refers to intelligent systems that verify customer identities using AI-powered document analysis, facial recognition, liveness detection,…

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
6 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
6 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