linkyndy
linkyndy

Reputation: 17920

View metrics or more insights on HTTP::Server

We're running a production system on Crystal/Kemal. The calling service sees quite often a Connection refused error. I was wondering how can I see more insights/metrics into a running instance of HTTP::Server/Kemal. I'm referring to the number of fibers running/waiting (out of the maximum number allowed), how large is the backlog of connections, how many have been refused and so on.

Upvotes: 2

Views: 131

Answers (1)

Sergey Fedorov
Sergey Fedorov

Reputation: 4440

Built-in tools: crystal tool -h

    context                  show context for given location
    expand                   show macro expansion for given location
    format                   format project, directories and/or files
    hierarchy                show type hierarchy
    implementations          show implementations for given call in location
    types                    show type of main variables

Common tools:

  1. lsof +p $(pidof <process_name>) — display connections/socket for process.
  2. ss -ier — display internal socket stats.
  3. strace -p $(pidof <process_name>) -s 300 -yyfq — useful tool for process introspection.
  4. tcpdump & wireshark — dump and explore network packets
  5. ngrep — like grep but for network packets.
  6. LLDB — native debugger for LLVM-based app (tutorial)
  7. CodeLLDB — Native VSCode debugger based on LLDB.

And don't forget crystal build ./app.cr --debug

Upvotes: 1

Related Questions