Sobes.tech
Middle

The service started responding in 3 seconds instead of 100 milliseconds. What would you do first?

sobes.tech AI

Answer from AI

First of all, you need to gather diagnostic data:

  1. Check service logs for errors or warnings.
  2. Measure the execution time of key operations (profiling).
  3. Check CPU, memory, network, and database load.
  4. See if external dependencies (e.g., database, third-party services) have changed.

Next, you can use profilers (pprof in Go) to identify bottlenecks. There may be locks, long database queries, or memory leaks.

Example of running pprof:

import (
    "net/http"
    _ "net/http/pprof"
)

func main() {
    go func() {
        log.Println(http.ListenAndServe("localhost:6060", nil))
    }()
    // other code
}

After collecting data, analyze and optimize problematic areas.

The service started responding in 3 seconds instead… - sobes.tech