Below is a compact, copy-pasteable cheat-sheet to find which process, user, or application is consuming the most CPU and memory, plus MySQL/MariaDB commands to pinpoint hot databases and queries.
# Top CPU processes (non-interactive)| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Order; | |
| using System; | |
| using System.Linq; | |
| namespace BenchmarkDotNetLab | |
| { | |
| // Captures allocations & GC info | |
| [MemoryDiagnoser] | |
| // Rank methods from fastest to slowest |
| using System.Diagnostics; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| // Minimal API demo to show bad vs good threading practices in .NET | |
| var builder = WebApplication.CreateBuilder(args); | |
| var app = builder.Build(); | |
| // Simple concurrency metrics |
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("========================================="); | |
| Console.WriteLine(" .NET GC Generations Demo (Gen0/1/2) "); |
| using System.Diagnostics; | |
| using System.Text; | |
| var builder = WebApplication.CreateBuilder(args); | |
| var app = builder.Build(); | |
| // =============================================== | |
| // INTENTIONAL MEMORY LEAK DEMO | |
| // =============================================== | |
| // |
| using System.Diagnostics; | |
| using System.Net; | |
| using System.Security.Authentication; | |
| using System.Threading; | |
| // Simple .NET minimal API to demo TLS 1.2 vs TLS 1.3 impact | |
| // and expose basic in-process metrics at /metrics | |
| var builder = WebApplication.CreateBuilder(args); |
| // ============================================================ | |
| // Circular Dependency Example (BAD) + Fixed Example (GOOD) | |
| // Single-file demonstration for training | |
| // ============================================================ | |
| using System; | |
| using Microsoft.Extensions.DependencyInjection; | |
| namespace CircularDependencyDemo | |
| { |
| <?php | |
| $host = 'n1smtpout.europe.secureserver.net'; | |
| $port = 25; | |
| $from = 'contact@guestpostai.com'; | |
| $to = 'contact@guestpostai.com'; | |
| echo "<pre>Connecting to SMTP ($host:$port)...\n"; |
| first | last | address | city | phone | |
|---|---|---|---|---|---|
| Jane | Garcia | 643 2nd Ave | Boston | 9325763815 | |
| Emma | Smith | 5399 Maple St | Houston | 9084802186 | |
| Bob | Smith | 5016 Cedar St | Boston | 8985554810 | |
| Alice | Brown | 3417 1st Ave | San Jose | 2684754835 | |
| Olivia | Miller | 4543 Oak St | San Jose | 2339613320 | |
| Jane | Martinez | 9221 Pine St | Dallas | 8705643176 | |
| Alice | Miller | 7568 Broadway | Houston | 4414732574 | |
| Chris | Jones | 9324 Maple St | Chicago | 9741513938 | |
| Michael | Johnson | 4990 Maple St | Houston | 3556216310 |
Below is a compact, copy-pasteable cheat-sheet to find which process, user, or application is consuming the most CPU and memory, plus MySQL/MariaDB commands to pinpoint hot databases and queries.
# Top CPU processes (non-interactive)| #!/bin/bash | |
| # === Variables === | |
| DB_NAME="artifactory" | |
| DB_USER="artifactory" | |
| DB_PASS="StrongPassword123!" | |
| ARTIFACTORY_VERSION="7.117.7" | |
| echo "=== JFrog Artifactory $ARTIFACTORY_VERSION Installation Started ===" |