Azure上的多个应用程序-每个服务一个应用程序还是多合一?

Multiple apps on Azure - one app-per-service or all-in-one?
2021-06-10
  •  译文(汉语)
  •  原文(英语)

我们正在开发一个大型应用程序,该应用程序由几个Web应用程序(在不同的域下)以及一个后台调度程序(使用Quartz.net)组成,该后台调度程序将在Worker角色上运行(当前是Windows Service,但没有意义)在Azure上).我正在尝试找出最适合我们的方法:为每个应用程序提供单独的托管服务,或在单个托管服务/角色下运行所有​​应用程序.我猜还有第三种选择,可以在单个托管服务下运行多个Web角色,但是我需要利用ARR(应用程序请求路由),但我不确定它会给我带来什么好处(如果有的话).在我看来,这需要更多的开销,但我很可能会错吗?

我的项目是:

  • 面向公众的网站-低负载
  • 专用仪表板-中等负载
  • 跟踪展示次数,点击次数等的跟踪(分析)应用程序-高负载-每月5+百万次点击
  • API-跟踪应用程序也依赖它,因此负载也很高
  • Quartz.net调度程序(工作者角色)

公共网站和仪表板可能应该在单个Web角色上,但是我不确定跟踪和API项目是否应该使用自己的云服务,以便它们可以独立扩展,或者我是否应该使用主机头在单个Web角色上运行所有内容(当然,除了调度程序外),还可以立即扩展所有内容.所有托管服务都将运行多个实例,因此我不担心部署期间发生故障(因为Azure一次转换一个实例).

另外,在单个角色上运行是否会给我带来更好的客户端应用程序(Web,仪表板,跟踪)与API之间的延迟,或者亲缘关系组和虚拟网络是否使这一点无关紧要?

一段时间以来,我一直在寻找最佳答案,但是还没有确定的结论.

我主要关心的是原始性能和可伸缩性.价格不是我们的决定因素.

谢谢

速聊1:
对于SO来说,这可能太宽泛了.请注意,Azure不是免费服务,因此可能需要考虑多种服务的价格.
解决过程1

这取决于...

您需要考虑几个方面的问题.

  • 部署和版本控制-您是否希望能够分别对系统的各个部分进行版本控制和部署?维护单独的部署会增加成本,但好处是可以提高灵活性,并能够独立部署更改.这是您决定中最重要的方面.
  • 团队结构-您是否有多个团队在系统上工作?我强烈建议按照团队划分部署和版本控制.
  • 可伸缩性-从性能的角度来看,这两个选项均具有同等的可伸缩性.
  • UI性能-这不应该是您的部署设计的主要关注点.

我们如何解决这个问题:

  • 每个系统/子系统都有自己的部署和自己的存储帐户.这样可以轻松实现版本控制和运营管理.
  • 我们的系统/子系统旨在履行许多高度凝聚的职责.
  • 系统间的通信是基于消息的(例如,Azure队列).
  • 每个后端工作人员角色的职责(我们称为"角色服务")可以通过配置轻松地在不同的Azure部署角色之间转移,具体取决于所需的性能特征.
  • 所有后端工作都应该是在工作者角色上的表现.IIS是后台进程的糟糕宿主.
  • 通过实现所有视图(到Blob存储或内存中)来实现UI性能.也可以使用缓存.
解决过程2

您的问题永远不可能有一个答案.

由于您的跟踪应用程序基本上基于您的API,因此我假设没有直接的外部流量进入您的API,并且仅由您的跟踪应用程序使用.因此,在这种情况下,我将把他们两个都放在一个Web角色中.

但是,如果除了跟踪之外,您还期望API上有巨大的负担,请考虑到您的API可能有一些外部客户端,那么最好将其放在单独的Web角色上.

关于其他2个Web应用程序,由于它们的负载不大,因此您实际上可以将它们与您的跟踪或API角色结合使用.否则,如果您真的不在乎定价,则可以扮演第三角色来托管您的公共站点和仪表板.

We are developing a large application that consists of several web apps (under separate domains) as well as a background scheduler (using Quartz.net) which would run on a Worker Role (currently it is a Windows Service but that doesn't make sense on Azure). I am trying to figure out what is the best approach for us: separate hosted service for each app or running all apps under a single hosted service/role. I guess there's a third option of running multiple web roles under a single hosted service but then I need to utilize ARR (app. request routing) which I'm not sure what benefit (if any) it will give me. Sounds to me like even more overhead but I could very well be wrong?

My projects are:

  • Public facing website - low load
  • Private dashboard - moderate load
  • Tracking (analytics) app that tracks impressions, clicks, etc. - high load - 5+ million clicks/month
  • API - also high load as the Tracking app relies on it
  • Quartz.net scheduler (worker role)

The public website and dashboard probably should be on a single web role but I am unsure whether the tracking and API projects should be using their own cloud services so they can scale independently or whether I should run everything on a single web role using host headers (except the scheduler of course) and scale everything at once. All hosted services will be running multiple instances so I'm not worried about things going down during deployment (as Azure transitions one instance at a time).

Also, is running on a single role going to give me better latency between the client apps (web, dashboard, tracking) and the API or do affinity groups and virtual networks make that point irrelevant?

I have been searching for the best answer for a while but haven't found anything conclusive enough.

My primary concern is raw performance and scalability. Price is not a deciding factor for us.

Thank you

Talk1:
This is likely too broad for SO... Note that Azure is not free service, so price of multiple services may need to be taken into account.
Solutions1

It depends...

There are a couple of dimensions to your question that you need to consider.

  • Deployment and versioning - Do you wish to be able to version and deploy parts of the system separately? There is an added cost to maintaining separate deployments, but the benefits are increased flexibility and ability to deploy changes in isolation. This is the most important aspect of your decision.
  • Team structure - Do you have multiple teams working on the system? I would highly recommend separating deployment and versioning along team lines.
  • Scalability - Both options are equally scalable from a performance perspective.
  • UI performance - This shouldn't be a primary concern of your deployment design.

How we have approached this problem:

  • Each system/sub-system has its own deployment and its own storage account. This allows for easy versioning and operational management.
  • Our systems/sub-systems are designed to perform a number of highly cohesive responsibilities.
  • Inter-systems communication is message based (Azure queues for example).
  • Each backend worker role's responsibilities (what we call "Role Services") can be easily moved between different Azure deployment roles via configuration depending upon the required performance characteristics.
  • All backend work should be performance on a worker role. IIS is a terrible host for background processes.
  • UI performance is achieved by materializing all views (either into blob storage or memory). A cache could be used as well.
Solutions2

There can not be one single answer to your question ever.

As your tracking app is basically based on your API, so i am assuming that there is no direct outside traffic coming to your API and its only used by your tracking app. So in this case i will have both of them in a single web role.

However, if you are expecting huge load on your API other than from you tracking, considering that there may be some external clients of your API, then better to have it on a separate web role.

Regarding you other 2 web apps, as they don't have much load, you can actually combine them with either of your tracking or api roles. Else, if you really dont care about pricing have a third role to host you public site and dashboard.

转载于:https://stackoverflow.com/questions/19062677/multiple-apps-on-azure-one-app-per-service-or-all-in-one

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入