Notes
Wall time: Elapsed real time (opens in a new tab)
Benchmark
- Measure the end to end time for some operations for making comparisons
shell - time
The time command runs the arguments given to it, and records three lines of additional output:
real: the wall clock time.user: the process CPU time.sys: the operating system CPU time due to system calls from the process.
Java Microbenchmark Harness (JMH)
-
Use
Maven archetypeto scaffold a benchmarking project -
Build executable
jarfile to run the benchmark test cases independently. Use IDE or other tools to run the test cases might affect environment and therefore benchmark results. -
Resources
-
Examples
Disk I/O Performance
fio
-
Resources
Network I/O Performance
HTTP
wrk
k6
Gatling
nghttp2 - h2load
siege
- GitHub - JoeDog/siege (opens in a new tab)
- Resources utilization in reactive services (opens in a new tab)
HAR Analyzer
-
Google Admin Toolbox - HAR Analyzer (opens in a new tab)
Works offline
SSL/TLS
Measure TLS connection and handshake time
openssl s_time -connect $host:$port -newMeasure speed of various security algorithms
openssl speed $algorithmShell CLI
Show how long a command takes
time $commandor
hyperfine $commandShow performance counter stats for a command
perf stat $commandResources
PostgreSQL
-
Part II. The SQL Language - Chapter 14. Performance Tips (opens in a new tab)
-
pg_stat_statements (opens in a new tab)
A PostgreSQL extension tracks statistics of SQL planning and execution
-
Included in
rpmpackagepostgresql-contrib
Query Performance
Log slow queries
# Log all statements executed longer than 3000 milliseconds
log_min_duration_statement = 3000- F.3. auto_explain — log execution plans of slow queries (opens in a new tab)
- 14.1. Using EXPLAIN (opens in a new tab)
Performance maintenance routines
- For each table, run a manual
VACUUM (ANALYZE)operation on the table. This makes sureVACUUMupdates thevisibility mapandANALYZEupdates statistics. - For indexes used by the query, check their estimated bloat percentage. Compare the estimated and actual figures. Consider a
REINDEX CONCURRENTLYfor indexes to rebuild them. - If
Autovacuumseems to be falling behind, add more resources toAutovacuumglobally or per table. You may also schedule supplemental maintenance operations.
Redis
Apache Kafka
Git
Resources - Reading
-
Blogs