drymonfidelia
V2EX  ›  .NET

ASP.NET Core 在 Linux 下部分接口耗时长、并发性能差,除了逐步打印日志,还有什么方便、直观的办法查出是哪一步耗时长吗?

  •  
  •   drymonfidelia · Mar 31, 2024 · 3768 views
    This topic created in 955 days ago, the information mentioned may be changed or developed.
    都是 ASP .NET Core 6.0
    系统大部分是 Ubuntu 22.04 ,也有 20.04 和 18.04 的,总共十几台机器,给不同客户使用
    大部分是裸机部署,也有部署在 Docker 里的
    7 replies  •  2024-04-01 17:36:38 +08:00
    BBCCBB
    BBCCBB
    Mar 31, 2024
    1
    用 jadger, pinpoint 这种链路追踪的库
    PTLin
    PTLin
    Mar 31, 2024
    2
    perf 吧
    hez2010
    hez2010
    Mar 31, 2024❤️1
    3
    可以考虑接上 .NET 自带的 OpenTelemetry 集成? https://learn.microsoft.com/dotnet/core/diagnostics/observability-with-otel
    这样可以详细跟踪你的 asp.net core 的各接口甚至是数据库查询的执行情况,然后你只需要用 Jaeger 之类的就能做分布式追踪。
    ShineyWang
    ShineyWang
    Mar 31, 2024 via Android❤️1
    4
    dottrace 可以检查耗时方法

    它需要附加调试程序
    Allvirus
    Allvirus
    Apr 1, 2024
    5
    都知道是啥接口慢了 还不能知道是自己哪里的问题?
    drymonfidelia
    drymonfidelia
    OP
    Apr 1, 2024
    6
    @Allvirus 一个函数几千行代码的屎山,制造者离职了
    INCerry
    INCerry
    Apr 1, 2024❤️1
    7
    可以使用 dotnet-trace 工具抓取一段时间跟踪信息,然后拉到本地用 VS 打开就可以看到热点函数了。
    https://learn.microsoft.com/zh-cn/dotnet/core/diagnostics/dotnet-trace
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1958 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 15:27 · PVG 23:27 · LAX 07:27 · JFK 10:27
    ♥ Do have faith in what you're doing.