请求需要时间来触发响应式 api

问题描述

我有 2 个具有以下端点的 Java 微服务。服务 A 调用服务 B 以获取用户详细信息。 从 zipkin 跟踪中,我能够确定完整的调用需要 450 毫秒,其中服务 B 需要 50 毫秒。 此外,服务 A 的 api 在 200 毫秒后被击中。 所以时间的分岔如下: 200 毫秒 + 服务 A(200 毫秒)+ 服务 B(50 毫秒)。我不确定最初的 200 毫秒为何以及在哪里进行。

  1. spring 反应式(服务 A) 端点 -> api/v1/users/{userId} - 耗时 200+200 毫秒

  2. spring 非响应式(服务 B) 端点 -> api/v1/users/{userId} - 耗时 50 毫秒

    @GetMapping(value = "/users/{userId}") public Mono getUser(@PathVariable("userId") String userId) { 返回 userService.getUser(userId); }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)