Sobes.tech
Senior

How to determine why an application is slow if it is a running binary without logs?

sobes.tech AI

Answer from AI

If you have a running binary without logs and need to understand why the application is slow, you can use the following approaches:

  1. Real-time profiling:

    • Use system monitoring tools (top, htop, pidstat) to assess CPU, memory, IO load.
    • Apply strace or dtrace to track system calls and identify blocking.
  2. Taking a profile dump:

    • If the application is written in Go, you can send the SIGQUIT signal (kill -QUIT pid) to get goroutine stacks in stdout or stderr.
    • Use pprof if the application supports an HTTP profiling endpoint.
  3. Analyzing thread states:

    • Use gdb or delve to attach to the process and view thread states, call stacks.
  4. Checking for deadlocks and locks:

    • Goroutine stack analysis will show where goroutines are waiting (e.g., on mutexes, channels).
  5. Resource monitoring:

    • Check if resources are exhausted: memory, file descriptors, network.
  6. Temporary logging addition:

    • If possible, rebuild the binary with logging or add tracing points.

Thus, without logs, diagnostics boil down to analyzing the process state and system resources using external tools and signals.

How to determine why an application is slow if it is… - sobes.tech