Engineering Notes

Field memos on Linux systems, storage engines, TLS operations, and small-scale backend architecture.

SQLite WAL Mode Under Concurrent Read/Write Workloads

2026-11-18 · storage · linux

For single-node services handling moderate write throughput alongside frequent read queries, switching SQLite from rollback journal to PRAGMA journal_mode=WAL removes writer-blocks-reader contention while keeping operational overhead near zero.

  • Set busy_timeout = 5000 on every connection so brief write lock handoffs do not fail immediately with SQLITE_BUSY.
  • Keep synchronous = NORMAL in WAL mode for a practical balance between fsync latency and crash durability.
  • Monitor -wal file growth; long-lived read transactions pin older frames and defer automatic checkpoints.

Checklist for TLS 1.3 & ECDSA Certificate Rollouts

2026-11-09 · tls · operations

Moving edge listeners to P-256 ECDSA certificates cuts handshake payload size and CPU verification cost compared to RSA-2048. Before rotating production chains, verify three invariants locally:

openssl s_client -connect 127.0.0.1:443 -servername notes.jinnia.top -tls1_3 -alpn h2 </dev/null
nginx -t && systemctl reload nginx

Ensure renewal deploy hooks reload dependent daemons cleanly and preserve restrictive permissions (0640) on private key material owned by the service group.

Zero-Allocation Ring Buffers for Telemetry Batching

2026-10-27 · runtime · performance

When aggregating high-frequency request metrics inside an event loop, allocating per-event structs creates avoidable GC pressure. A fixed-capacity power-of-two ring buffer backed by a pre-allocated slice keeps tail latency flat under burst load.

If consumers fall behind, prefer dropping oldest samples with an explicit overflow counter rather than blocking request paths or growing heap queues unboundedly.

Minimal systemd Hardening Baseline for Internal Daemons

2026-10-12 · systemd · security

Most small Go and Rust services only need read access to their config directory and write access to a dedicated state path. Adding NoNewPrivileges=yes, ProtectSystem=strict, and PrivateTmp=yes takes four lines in the unit file and eliminates an entire class of accidental filesystem writes.