简体   繁体   English

IBM Cloud Code Engine:流量拆分时应用程序修订的不同响应时间

[英]IBM Cloud Code Engine: Different response times for app revisions when traffic is split

I am running different versions / revisions of an app on IBM Cloud Code Engine.我在 IBM Cloud Code Engine 上运行应用程序的不同版本/修订版。 I split traffic 80/20 between them.我将流量分成 80/20。 I noticed that sometimes the app is responsive as expected, sometimes not.我注意到有时该应用程序会按预期响应,有时则不会。

What could be the reason?可能是什么原因? How can I investigate?我该如何调查?

I worked with the IBM Cloud Code Engine CLI and Knative CLI to investigate it.我使用IBM Cloud Code Engine CLIKnative CLI对其进行了调查。

First, I retrieved information about the app:首先,我检索了有关该应用程序的信息:

ibmcloud ce app get --name myapp

It showed that two revisions were active (due to split traffic), but not showing details.它显示两个修订处于活动状态(由于流量分离),但未显示详细信息。 The YAML output had more information. YAML output 有更多信息。 It showed that one revision had "scale to zero", the other a minimum of one instance active.它表明一个修订版“规模为零”,另一个修订版至少有一个实例处于活动状态。

ibmcloud ce app get --name myapp --output yaml

I also checked if there was more information available using Knative.我还检查了是否有更多使用 Knative 的信息可用。 First, get the Kube.netes configuration for the project:首先,获取项目的 Kube.netes 配置:

ibmcloud ce project select --name myproject --kubecfg

Then, list the revisions, again as YAML output:然后,再次列出修订,如 YAML output:

kn revision list --output yaml

This part of the revision metadata shows the minScale as zero, causing a (cold) start and hence the delay.修订元数据的这一部分将 minScale 显示为零,导致(冷)启动并因此导致延迟。

  metadata:
    annotations:
      autoscaling.knative.dev/maxScale: "2"
      autoscaling.knative.dev/minScale: "0"

If you have access to application latency logs, they might include which revision returned the slow result, which could help explain why you sometimes get different latency results.如果您有权访问应用程序延迟日志,它们可能包括哪个版本返回了缓慢的结果,这可能有助于解释为什么您有时会得到不同的延迟结果。

There may also be a Knative header in the response which indicates which revision served a request, but there doesn't seem to be anything consistently documented on that front.响应中可能还有一个 Knative header,指示哪个修订服务于请求,但在这方面似乎没有任何一致的记录。

If you're willing to push new code to your application, you could implement your own application-level logging of latency and instance I'd, which might help pin down host level or startup behaviors.如果您愿意将新代码推送到您的应用程序,您可以实现自己的应用程序级延迟日志记录和实例 I,这可能有助于确定主机级别或启动行为。

If you are allowing minimum instances to be 0, then under zero load the apps will be shut down.如果您允许最小实例数为 0,则在零负载下应用程序将关闭。 When the next request comes in there will be startup / instantiation time.当下一个请求进来时会有启动/实例化时间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IBM Cloud Code Engine:当应用程序不活动时如何检查日志? - IBM Cloud Code Engine: How to check logs when app not active? IBM Cloud:如何将 Db2 Warehouse 绑定到 Code Engine 应用程序? - IBM Cloud: How to bind Db2 Warehouse to Code Engine app? IBM Cloud Code Engine:如何从环境中确定应用程序 URL? - IBM Cloud Code Engine: How to determine app URL from environment? IBM Cloud Code Engine:如何在没有 CLI 的情况下从 GitLab 源部署应用程序 - IBM Cloud Code Engine: How can I deploy an app from GitLab source without CLI IBM Cloud:需要更新代码引擎应用程序的服务 ID 的最低权限? - IBM Cloud: Least privileges for service ID that needs to update a Code Engine app? 使用端口 80 部署标准容器时,IBM Cloud Code Engine 修订失败 - IBM Cloud Code Engine revision fails when deploying standard container with port 80 IBM Cloud Code Engine:本地构建的容器镜像在部署时出现 exec 格式错误 - IBM Cloud Code Engine: Locally built container image gives exec format error when deployed 使用 Cloud Engine 时,在 IBM Cloud 中可访问作业的输出在哪里? - Where is the ouput of a Job accessible in IBM Cloud, when using Cloud Engine? IBM Cloud Code Engine 无法为私有存储库构建 - IBM Cloud Code Engine fails to build for private repo IBM Cloud Code Engine:有状态应用程序和粘性会话、扩展问题 - IBM Cloud Code Engine: Stateful Apps and Sticky Sessions, Scaling Issues
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM