Linux | Check the call duration and details when calling the interface using the curl command

Follow wx:CodingTechWork

introduction

  When calling the interface through the curl command in the server, we often need to analyze some duration. This article mainly summarizes two ways to deal with it.

curl command

Use the time command

time curl -k -u '<username>':'<password>' https://127.0.0.1/xxxx -vvv

Use text

Write time.txt

   time_namelookup:  %{time_namelookup}s\n
        time_connect:  %{time_connect}s\n
     time_appconnect:  %{time_appconnect}s\n
    time_pretransfer:  %{time_pretransfer}s\n
       time_redirect:  %{time_redirect}s\n
  time_starttransfer:  %{time_starttransfer}s\n
                     ----------\n
          time_total:  %{time_total}s\n

Order

curl -k -u '<username>':'<password>' https:///127.0.0.1/xxxx -vvv -w "@time.txt"

Guess you like

Origin blog.csdn.net/Andya_net/article/details/132262273