我可以在应用程序运行时更改辅助角色的实例计数吗?
我创建了一个应用程序,它根据用户的查询多次并行执行代码序列。比如说,如果用户要求结果非常准确,那么我将不得不在不同的数据集上并行运行代码 1000 次或更多次。如果用户不要求结果准确,那么我将并行运行代码 5 次。 该代码序列由辅助角色执行。我将启动我的应用程序,辅助角色的实例计数为 5。如果用户请求结果非常准确,那么我可以将辅助角色的实例计数增加到 20。请求完成后,我会将实例计数设置回 5。
我可以这样做吗?我怎样才能做到这一点。如果我这样做,应用程序会重新启动吗?
最佳答案
是的,你可以做到这一点。 Windows Azure 公开管理 API 来执行配置和取消配置其他辅助角色等任务。
您可以查看Lokad.Cloud项目的自动缩放接口(interface):http://code.google.com/p/lokad-cloud/wiki/AutoScaling
Within a QueueService or a ScheduledService, you can access the property CloudService.Providers.Provisioning which will grant you a programmatic access to cloud fabric in order to adjust the number of workers running for your application.
关于azure - Windows Azure : Can I change the instances count of worker role while the application is running on the cloud,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3173109/