【问题标题】:Google Cloud Run randomly spiking requestsGoogle Cloud Run 随机峰值请求
【发布时间】:2021-09-13 22:56:21
【问题描述】:

我已通过 Cloud Run 部署了两个 Hasura 实例,但其中一个容器会定期收到随机峰值请求。据我所知,这不是由我们的任何前端发起的,并且尖峰看起来不规则。奇怪的是,这个问题只发生在我们的一个实例上。

为每个请求获取以下消息:

#1:

{
  "insertId": "x",
  "jsonPayload": {
    "type": "webhook-log",
    "detail": {
      "http_error": null,
      "response": null,
      "message": null,
      "method": "GET",
      "status_code": 200,
      "url": "x/auth"
    },
    "timestamp": "2021-08-26T22:35:40.857+0000",
    "level": "info"
  },
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "service_name": "x",
      "configuration_name": "x",
      "location": "us-central1",
      "project_id": "x",
      "revision_name": "x"
    }
  },
  "timestamp": "2021-08-26T22:35:41.839935Z",
  "labels": {
    "instanceId": "x"
  },
  "logName": "x",
  "receiveTimestamp": "2021-08-26T22:35:42.002274277Z"
}

#2:

{
  "insertId": "x",
  "jsonPayload": {
    "timestamp": "2021-08-26T22:35:40.857+0000",
    "detail": {
      "user_vars": null,
      "event": {
        "type": "accepted"
      },
      "connection_info": {
        "msg": null,
        "token_expiry": null,
        "websocket_id": "x"
      }
    },
    "level": "info",
    "type": "websocket-log"
  },
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "project_id": "x",
      "revision_name": "x",
      "service_name": "x",
      "configuration_name": "x",
      "location": "us-central1"
    }
  },
  "timestamp": "2021-08-26T22:35:41.839957Z",
  "labels": {
    "instanceId": "x"
  },
  "logName": "x",
  "receiveTimestamp": "2021-08-26T22:35:42.002274277Z"
}

现在对发生的事情保持空白。任何建议都有帮助!

【问题讨论】:

  • 欢迎来到 StackOverflow!问题:您提到了 2 个 hasura 实例——它们是用于不同的应用程序并连接到不同的数据库吗? Hasura 是:1.3.x、2.0、Hasura Cloud ?数据库是 postgresql 或 hasura 2.0 中的其他可能的东西?
  • 我没有在您的日志跟踪中发现错误...
  • 对不起@guillaumeblaquiere -- 已编辑。谢谢@AlexYu!!它们确实适用于不同的应用程序并连接到不同的数据库。我正在使用 Hasura v2.0.1,并使用 postgres
  • 您能先说明一下您的每项服务是做什么的吗?这两个服务中的哪一个会遇到随机尖峰请求?
  • 现在这两种服务似乎都在发生这种情况。定期收到一堆请求。 3.02/s ATM。

标签: google-cloud-platform google-cloud-run hasura


【解决方案1】:

知道了!原来是一些打开的 WebSocket 连接来自用户保持浏览器选项卡打开。

经验教训!

【讨论】:

  • 那么:websocket 连接来自订阅 - 对吧?这些活动高峰是由订阅产生的 - 是这样吗?
  • 是的,就是这样! @AlexYu
猜你喜欢
  • 2020-03-02
  • 2021-11-22
  • 2023-01-28
  • 2020-03-31
  • 2021-01-08
  • 1970-01-01
  • 2019-12-20
  • 2021-06-12
  • 2022-08-19
相关资源
最近更新 更多