简体   繁体   English

IBM Cloud Code Engine:有状态应用程序和粘性会话、扩展问题

[英]IBM Cloud Code Engine: Stateful Apps and Sticky Sessions, Scaling Issues

My first post on stackoverflow;我在 stackoverflow 上的第一篇文章; here goes!开始!

I just discovered IBM Code Engine and am excited to try it out, I tried deploying a docker image of mine this weekend.我刚刚发现了 IBM Code Engine,很高兴尝试一下,我在这个周末尝试部署了我的 docker 映像。 though I'm having some issues with scaling, Before getting to the scaling issues I have some questions about IBM Cloud Code Engine in general: with my interactive application in mind:虽然我在扩展方面遇到了一些问题,但在解决扩展问题之前,我一般对 IBM Cloud Code Engine 有一些疑问:考虑到我的交互式应用程序:

  1. Stateful Applications: The application I'd like to deploy is stateful.有状态的应用程序:我要部署的应用程序是有状态的。 Does IBM Cloud Code Engine support stateful apps out of the box? IBM Cloud Code Engine 是否支持开箱即用的有状态应用程序?
  2. Sticky Sessions: Since my application is stateful, the goal is to have a user and all their associated actions stay within the same container.粘性会话:由于我的应用程序是有状态的,因此目标是让用户及其所有相关操作保持在同一个容器中。 Eg, if a user is in container 1 and clicks a button that executes server-side code I would not want that code executed in container 2 ;例如,如果用户在container 1中并单击执行服务器端代码的按钮,我不希望container 2中执行该代码; it should be in container 1 .它应该在container 1中。 Does IBM Cloud Code Engine support this out of the box? IBM Cloud Code Engine 是否支持开箱即用?
  3. Ephemeral Storage: I see in the documentation that ephemeral storage (ie, disk space) can be set, though I do not see the ability to modify this in the console.临时存储我在文档中看到可以设置临时存储(即磁盘空间),但我看不到在控制台中修改它的能力。 Am I missing something?我错过了什么吗? Alternatively, does more vCPU & memory imply more disk?或者,更多的 vCPU 和 memory 是否意味着更多的磁盘? I personally prefer the CLI for the container registry, and the console for code engine itself.我个人更喜欢容器注册表的 CLI,以及代码引擎本身的控制台。

Note that I have these questions whether concurrency per instance is 1 or more users.请注意,无论每个实例的并发是 1 个还是多个用户,我都有这些问题。

Notes on scaling: I successfully deployed my application and it looked as expected.关于扩展的注意事项:我成功部署了我的应用程序,它看起来符合预期。 However, as the only user I saw multiple instances running rather than one (2, sometimes 3 instances).但是,作为唯一的用户,我看到运行多个实例而不是一个(2 个,有时是 3 个实例)。 When I opened another browser and logged in as another user the same thing happened.当我打开另一个浏览器并以另一个用户身份登录时,同样的事情发生了。 Double or triple the instances needed were running.运行所需实例的两倍或三倍。 Can someone advise?有人可以建议吗? Going back to my questions above, my hope is that interacting with the app does not trigger additional instances.回到我上面的问题,我希望与应用程序的交互不会触发额外的实例。

I can provide a simple Dockerfile and app code if helpful.如果有帮助,我可以提供一个简单的 Dockerfile 和应用程序代码。

  1. Generally speaking the answer is yes, although it depends how you define stateful and where you store the state.一般来说,答案是肯定的,尽管这取决于您如何定义有状态以及您存储 state 的位置。 Example: storing the state in an COS/S3 bucket is possible, storing it in an NFS mount not at the moment示例:可以将 state 存储在 COS/S3 存储桶中,暂时不将其存储在 NFS 挂载中
  2. Unfortunately no.抱歉不行。 The underlying Knative OSS technology does not support sticky sessions yet, although the open source community is working on it, so it might be coming.底层的 Knative OSS 技术还不支持粘性会话,虽然开源社区正在开发它,所以它可能会到来。
  3. This is not currently supported in the UI, but in the CLI you can specify ibmcloud ce app create --ephemeral-storage as a param UI 目前不支持此功能,但在 CLI 中,您可以将ibmcloud ce app create --ephemeral-storage指定为参数
  4. Scaling: That depends on how you have defined your scaling criteria.缩放:这取决于您如何定义缩放标准。 When you create your app, in the Runtime settings section you can specify a concurrency value.创建应用程序时,您可以在Runtime settings部分指定并发值。 That determines the value how many threads/requests one instance will process in parallel.这决定了一个实例将并行处理多少线程/请求的值。 If the value is set to 1, and you have three browser tabs open sending requests, Code engine will scale up to (at least) three instances (eg when the scale target is 70% of compute capacity, we'd spin up to 4).如果该值设置为 1,并且您有三个浏览器选项卡打开发送请求,代码引擎将扩展到(至少)三个实例(例如,当扩展目标是计算容量的 70% 时,我们将旋转到 4 )。 If the value is set to 100, one instance will handle 100 parallel requests and the scale out will only occur if you get 101 requests.如果该值设置为 100,则一个实例将处理 100 个并行请求,并且只有在收到 101 个请求时才会发生横向扩展。 It is independent of how many users send these requests.它与发送这些请求的用户数量无关。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM