Rest service at one instance of Cloud Foundry at one point of time.

huangapple go评论112阅读模式
英文:

Rest service at one instance of Cloud Foundry at one point of time

问题

我有一个在PCF上运行的Rest服务。它可能需要10-15分钟才能完成。PCF应用程序已配置为在多个实例上运行。

我想确保在任何时候,该Rest服务只在一个实例中运行。例如:如果Rest服务在一个实例中运行,我尝试多次调用相同的服务,那么它不应该被其他实例接管,而应等待直到完成,然后可以在任何其他或相同的实例中运行。

请提出一些最佳实践建议。提前感谢您。

英文:

I have one Rest service running in PCF.It might take 10-15mins to complete.PCF app is configured to run on multiple instances.

I want to make sure at a single point of time,that Rest service to run only in one instance. e.g: if the Rest service running in one instance and I try to call the same service multiple times then it should not be taken by any other instance, rather it should wait till it's completion and then it can run in any other or same instance.

Kindly suggest some best practices to this.Thanks in advance.

答案1

得分: 1

这是使用消息队列的一个典型案例。任何应用程序都可以接受请求并将其添加到队列中,然后任何应用中的空闲监听器都可以消费该消息。如果你需要进行大规模扩展,而且这是一个密集的任务,甚至可能建议将生产者和消费者拆分为单独的应用程序,这样一个密集的消费者就不会导致你的 API 无响应。

英文:

This is a prime use case for a message queue. Have any app accept the request and add it to the queue, then a free listener in any app can consume the message. If you are scaling a lot and it's a intensive task it might even be recommendable to split the produce and consumer into separate apps, so a intensive consumer doesn't make you api unresponsive

huangapple
  • 本文由 发表于 2020年7月22日 01:55:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/63020335.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定