Windows Azure 中同一实例上的多个角色

发布于 2025-01-07 02:14:58 字数 300 浏览 4 评论 0原文

是否可以在同一个实例中部署多个角色?

我有三个 Web 角色(asp.net mvc3 中的网站和两个 WCF 服务实例)和两个辅助角色(Windows 服务)。

该应用程序的负载非常小,因此我不想在 Windows Azure 中创建如此多的实例并为所有实例付费。相反,我想在同一个实例中部署所有应用程序,并在以后如果我能从应用程序中获得一些收入的话进行更改。

我用谷歌搜索,发现一些论坛帖子是可能的,有些帖子是不可能的......但我找不到如何做到这一点的信息......

所以有两个问题: 是否可以? 我该怎么做呢?

Is it possible to deploy multiple roles in the same instance?

I have three web roles (website in asp.net mvc3, and two WCF services instances) and two worker roles (windows services).

The load for this application is very small, so I don't want to create so many instances in Windows Azure and pay for all of the instances now. Instead I want to deploy all my application in the same instance and change it later if I will get some income from my applications.

I Googled and found some forum posts than it's possible and some than it's not possible... but I can't find information how to do it...

So two questions:
Is it possible?
How can I do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

千寻… 2025-01-14 02:14:59

不,角色是实例,每个角色占用一整个虚拟机。不过,您可以将多个网站部署到单个角色中,这样您就可以将所有 MVC 和 WCF 应用程序部署到单个 Web 角色中。您需要将网站添加到 ServiceDefinition 中的 sites 元素 。似乎有一些关于如何完成此操作的博客文章 - 此处这里

对于辅助角色,我建议您创建一个辅助角色并组合这些角色中完成的工作,例如为每个受监视的队列启动一个单独的线程。 Eugenio Pace 的 StackOverflow 答案

我不建议尝试将辅助角色功能合并到网络角色中。除了它没有架构意义、物理基础设施意义(IIS 与非 IIS)之外,还存在潜在的问题,例如当工作角色回收时终止正在运行的线程(不是由 IIS 启动的线程可能会突然终止)

No, roles are instances and each one takes up an entire VM. You can however deploy a number of websites into a single role, which will allow you to deploy all your MVC and WCF apps into a single web role. You need to add websites to the sites element in the ServiceDefinition. There seem to be a few blog posts on how this is done - here and here.

For worker roles, I suggest you create a single worker role and combine the work done in those roles, such as starting a separate thread for each queue being monitored. This StackOverflow answer by Eugenio Pace.

I wouldn't recommend trying to combine worker role functionality into the web role. Apart from it not making architectural sense, sense to the physical infrastructure (IIS vs not IIS), there are potential issues such as the with termination of running threads when worker roles recycle (a thread not started by IIS may terminate abruptly)

扬花落满肩 2025-01-14 02:14:59

检查这一集的云层覆盖情况。
您可以在同一个实例中放置几个​​网络角色。
辅助角色 您始终可以放置多个线程来处理数据。

http:// /channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-37-Multiple-Websites-in-a-Web-Role

请注意,每次将新版本上传到 azure 时,您都需要再次将所有 Web 角色/辅助角色上传到 azure

Check this episode of cloud cover.
you can put couple of web role in the same instance.
worker role you can always put multiple thread to work the data.

http://channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-37-Multiple-Websites-in-a-Web-Role.

Note that each time you upload a new version to azure you need to upload all the web roles/ worker roles to azure again

回眸一遍 2025-01-14 02:14:59

查看这篇博客文章“将多个 Azure 辅助角色组合成一个 Azure Web 角色”
http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2012/02/combining-multiple-azure-worker-roles.html

我认为这就是你需要的要做...

韦恩在他的博客上也有这样的变体:http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html

HTH

Check out this blog post 'Combining Multiple Azure Worker Roles into an Azure Web Role'
http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2012/02/combining-multiple-azure-worker-roles.html

I think this is what you need to do...

Also Wayne has variations of this on his blog: http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/how-to-combine-worker-and-web-role-in.html

HTH

往事风中埋 2025-01-14 02:14:58

与@Simon的答案略有不同...角色实际上是Windows Server 2008 VM的模板(请参阅我对这个SO问题的回答 以及)。每个角色都有一个或多个实例,您可以在任何角色上运行您想要的任何内容。

您绝对可以以单一角色运行您的网站和所有 WCF 服务。现在,您将作为单个缩放单元向上/向下(VM 大小)和向外/向下(实例数量)扩展应用程序。比如说,如果您的 WCF 服务是 CPU 密集型的,导致 VM 实例对于 Web 访问者来说速度变慢,那么您需要进行足够的扩展来处理这些访问者。

一旦达到显着的流量负载,就值得考虑单独的角色。这样,您就可以决定每个角色的虚拟机大小和数量。也许您有 2 或 3 个 Web 角色的小型实例来处理网站上的用户流量,并且可能有 2 个辅助角色的中型实例来处理 WCF 服务(仅作为示例)。您拥有的角色越多,扩展的粒度就越细,但您必须运行每个角色至少一个实例,这会提高您的“静态系统”基线成本。

A slightly different answer than @Simon's... A Role is actually a template for a Windows Server 2008 VM (see my answer on this SO question as well). Each role has one or more instances, and you can run whatever you want on any role.

You can absolutely run your website and all your WCF services in a single role. You'll now scale your application up/down (VM size) and out/in (# of instances) as a single scale unit. If, say, your WCF services are CPU-intensive, causing the VM instances to slow down for your web visitors, you'll need to scale out enough to handle those visitors.

Once you reach a significant traffic load, it's worth considering separate roles. That way, you can decide on VM size and quantity per role. Maybe you have 2 or 3 Small instances of a Web role to handle your user traffic on the website, and maybe 2 Medium instances of a Worker role to handle WCF services (just as an example). The more roles you have, the finer-grain scaling you have, but you must run at least one instance of each role, which elevates your "system at rest" baseline cost.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文