Menu

#1639 feat: initialize token encoders in a goroutine to reduce service star…

open
nobody
None
2024-07-13
2024-07-12
Anonymous
No

Originally created by: vaayne

通过异步 InitTokenEncoders 能够显著减少启动时间,修改之后启动服务在 1s 只能就能接受 request

close [#1638]

我已确认该 PR 已自测通过,相关截图如下:

image

Related

Tickets: #1638

Discussion

  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: songquanpeng

    请求能来但是没办法正常计费,而且也会有并发问题

     
  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: songquanpeng

    我理解可以做的优化是并发初始化Redis,MySQL 以及 token encoder

     
  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: MartialBE

    这个和网络也有关系,如果需要快速启动,还是自己预先下载好。
    你这个属于运气问题,正好请求时 3.5已经初始化好了。 不然在计算时,没初始化好,此时 defaultTokenEncoder还是nil,就报错了

     
  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: vaayne

    我理解可以做的优化是并发初始化Redis,MySQL 以及 token encoder

    嗯呢, Redis 和 MySQL 的初始化时间很短,这个影响很明显。

     
  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: vaayne

    这个和网络也有关系,如果需要快速启动,还是自己预先下载好。

    你这个属于运气问题,正好请求时 3.5已经初始化好了。 不然在计算时,没初始化好,此时 defaultTokenEncoder还是nil,就报错了

    是的,我看看想办法缓存一下这个

     
  • Anonymous

    Anonymous - 2024-07-13

    Originally posted by: codecov[bot]

    Codecov Report

    Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

    Project coverage is 1.22%. Comparing base (6ad1699) to head (2a19e5e).
    Report is 2 commits behind head on main.

    Files Patch % Lines
    main.go 0.00% 1 Missing ⚠️
    Additional details and impacted files :::diff @@ Coverage Diff @@ ## main #1639 +/- ## ===================================== Coverage 1.22% 1.22% ===================================== Files 137 137 Lines 9917 9917 ===================================== Hits 121 121 Misses 9782 9782 Partials 14 14

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

     

Log in to post a comment.

MongoDB Logo MongoDB