Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

šŸš— You set the rental price
šŸ” Secure bookings with verified renters
šŸ“ Track your vehicle with GPS integration
šŸ’° Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

dotnet-counters: commands and Metrcies


āœ… dotnet-counters – Command Reference (Explained Simply)

When you run:

dotnet-counters -h

You see 4 main commands:

Commands:
  monitor   Start monitoring a .NET application
  collect   Monitor counters in a .NET application and export the result into a file
  list      Display a list of counter names and descriptions, grouped by provider.
  ps        Lists the dotnet processes that can be monitored.
Code language: CSS (css)

Below is a simple explanation for each.


🟦 1. dotnet-counters monitor

Real-time monitoring (LIVE metrics)

This command shows metrics live in the terminal.

Example:

dotnet-counters monitor --process-id 1234 System.Runtime Microsoft.AspNetCore.Hosting
Code language: CSS (css)

Use when:

  • You want to diagnose CPU spikes
  • You want to monitor GC, ThreadPool, HTTP requests, EF load
  • You need instant insights

🟧 2. dotnet-counters collect

Record metrics into a file (for later analysis)

Example:

dotnet-counters collect --process-id 1234 -o metrics.json
Code language: CSS (css)

Use when:

  • You want offline analysis
  • You want to attach the file to Jira/Slack
  • You want long-running capture for production

The output can be consumed by:

  • PerfView
  • VS Diagnostic tools
  • Custom dashboards

🟩 3. dotnet-counters list

Lists ALL available counters grouped by provider

Example:

dotnet-counters list
Code language: PHP (php)

It shows providers such as:

  • System.Runtime
  • Microsoft.AspNetCore.Hosting
  • Microsoft.EntityFrameworkCore
  • Microsoft.AspNetCore.Http.Connections
  • Grpc.AspNetCore.Server
  • Custom counters you create

Use when:

  • You want to know which counters exist
  • You want to pick the right providers for monitoring

🟪 4. dotnet-counters ps

Shows all .NET processes which can be monitored

Example:

dotnet-counters ps

Output:

1234  Orders.Api
5678  WorkerService1
Code language: CSS (css)

Use when:

  • You don’t know the PID
  • You want to confirm your app is running
  • You want to attach to the correct process

šŸ“ Slide-Ready Summary

dotnet-counters – Core Commands

CommandWhat It DoesWhen to Use
monitorShows live runtime metrics in consoleRealtime troubleshooting
collectRecords metrics to a filePost-analysis / long runs
listShows all available countersDiscover providers/counters
psLists .NET processesTo find PID to attach


Master Table: Important dotnet-counters Metrics (with Explanations & Why They Matter)


1ļøāƒ£ System.Runtime — Core CLR Runtime Metrics

MetricWhat It MeansWhy It’s Important for Performance
CPU Usage (%)CPU percentage used by the .NET processDetects CPU bottlenecks; helps identify CPU-bound workloads, infinite loops, bad parallelism, or excessive processing.
Allocation Rate (B/sec)How fast your app allocates managed memoryHigh allocation rate → frequent GC → latency spikes. Crucial for diagnosing app churn, LINQ inefficiencies, and memory-heavy code.
GC Heap Size (MB)Total memory currently used by the managed heapDetects memory leaks, memory growth over time, and inefficient caching patterns.
GC Committed Bytes (MB)Memory reserved by GC from OSHelps understand total memory pressure; correlates with working set expansion.
% Time in GCPercentage of time spent in garbage collectionHigh value = app is frequently pausing; leads to latency issues and poor throughput.
Time paused by GC (ms/sec)Actual stop-the-world pause timeHigh pause time directly causes slow API responses and jitter.
Gen 0/1/2 GC CountNumber of collections happening per secondHigh Gen0 = object churn. High Gen2 = severe performance issue because Gen2 GCs are expensive.
Gen 0/1/2 SizeTotal bytes in each generationHelps identify long-lived allocations, memory retention, and leaks.
LOH Size (Large Object Heap)Memory used by objects ≄85 KBLOH fragments memory; too big LOH increases GC cost. Critical for APIs that allocate large arrays/JSON blobs.
POH Size (Pinned Object Heap)Memory that GC cannot moveHigh POH = higher fragmentation + potential leaks. Important for interop-heavy systems.
ThreadPool Thread CountNumber of active worker threadsToo low → starvation. Too high → excessive context switching.
ThreadPool Queue LengthWork items waiting for a threadIf >0 consistently → request queuing → latency spikes.
ThreadPool Completed Work Items/secWork throughputHelps measure workload intensity and server utilization.
Lock Contention Count/secThreads waiting to enter locksIndicates concurrency bottlenecks causing hangs and slowdowns.
Exception Count/secExceptions thrown each secondHigh exceptions degrade performance due to stack walking + GC pressure.
Working Set (MB)Total memory used by the processHigh working set may cause swapping or OOM kills in containers.
IL Bytes Jitted / Methods JittedTotal methods compiled by JITHigh values over time = JIT warmup not complete; affects startup latency.
Active TimersNumber of active timer callbacksToo many timers → excessive scheduling overhead.

2ļøāƒ£ Microsoft.AspNetCore.Hosting — Request & Application Metrics

MetricWhat It MeansWhy It Matters
Requests/secIncoming requests throughputMeasures system load; used to detect saturation and capacity.
Current RequestsIn-flight HTTP requestsHigh values = backpressure or slow request handlers.
Total RequestsCumulative number of served requestsUseful for verifying app activity during load tests.
Failed RequestsNumber of failed requestsIdentifies reliability/stability issues.
Request Queue LengthPending incoming requestsQueue > 0 → server not keeping up → potential cascading failure.

3ļøāƒ£ Microsoft-AspNetCore-Server-Kestrel — Server-Level Metrics

MetricMeaningWhy It Matters
Current ConnectionsActive TCP connectionsDetects overload, DDoS-like patterns, or connection leaks.
Connection Queue LengthPending connections before they’re acceptedHigh queue = server saturation.
TLS Handshake FailuresFailed SSL handshakesIndicates certificate issues or client misconfigurations.
Request Queue LengthHTTP requests waiting to be processedEarly warning sign of API latency under load.
Connections/secNew incoming connections/secondHigh churn can cause CPU spikes and port exhaustion.

4ļøāƒ£ Microsoft.AspNetCore.Http.Connections — SignalR & WebSockets

MetricMeaningWhy It Matters
Current ConnectionsActive WebSocket/SignalR connectionsHelps size the real-time workload.
Connections StartedNew connections openedHigh rate = scaling pressure on real-time hubs.
Connections StoppedClosed connectionsSharp increases indicate instabilities.
Connections Timed OutConnections dropped unexpectedlyIndicates networking or idle-time issues.
Connection DurationAvg time connections remain openUseful for capacity planning.

5ļøāƒ£ System.Net.Http — Outbound HTTP Client Metrics

MetricMeaningWhy It Matters
Requests Started/secOutbound calls initiatedHelps measure dependency load.
Requests Failed/secOutbound failuresUseful for detecting flaky downstream services.
Current HTTP/1.1 ConnectionsActive pooled connectionsHelps identify connection pool exhaustion.
HTTP/2 StreamsStreams in useCritical for gRPC or HTTP/2 workloads.
DNS Lookup DurationTime taken for DNS resolutionSlow DNS = global latency issues.
Sockets QueuedPending socket requestsToo many ⇒ networking bottleneck.

6ļøāƒ£ Microsoft.EntityFrameworkCore — Database & Query Performance

MetricMeaningWhy It’s Critical
Queries Executed/secDatabase query rateDetects DB overload & slow query patterns.
Active DbContextsNumber of active EF contextsHigh values = context leaks or too many parallel queries.
Command Execution CountDB commands executedMeasures DB workload intensity.
Optimistic Concurrency FailuresVersion conflictsIndicates concurrency problems & row contention.
Queries Compilation EventsEF query compilationHigh compilation rate = missing compiled query reuse → performance loss.

7ļøāƒ£ Additional Important Diagnostic Signals

MetricMeaningWhy It’s Useful
GC Fragmentation %How fragmented the heap isFragmentation increases GC time & reduces memory efficiency.
GC BudgetTarget allocation for next GCHelps understand upcoming GC cycles.
JIT Time (ms/sec)Time spent JIT-compiling codeAffects startup and ā€œwarm-upā€ performance.
Assemblies LoadedNumber of loaded assembliesToo many → high memory + startup time.

šŸŽÆ Summary: Why These Metrics Matter

This table covers all critical metrics for diagnosing:

  • High CPU
  • Memory leaks
  • High GC pressure
  • Large object allocations
  • ThreadPool starvation
  • Lock contention
  • Slow database queries
  • HTTP failures & timeouts
  • Real-time connection pressure
  • Throughput & latency degradation
  • Container OOM kills
  • Cold-start & JIT issues

dotnet-counters is the first tool you should use during:

  • Load Testing
  • Performance Engineering
  • CPU/Memory profiling
  • Cloud production incidents
  • GC or memory leak investigations

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

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