这种架构模式有名字吗?
假设您有一个网站,由以下部分组成:
- 一个为各种用户请求提供服务的 Web 服务器
- 一个用于持久性的数据库
- 一个异步执行后台操作的单独服务器 - 准备数据库上的数据,根据更改更新数据等 - 无论主服务器发生了什么。
您可以轻松地将其转换为另一个世界,并讨论线程,例如,让一个线程为正在运行的主线程异步准备数据。
如果这个模式确实是一种模式的话,它有一个名字吗?
这种处理数据的方法在性能方面有什么优点/缺点吗?
让我澄清一下,我具体询问的是第二个进行后台处理的 Web 服务器,而不是整个架构。
Suppose you have a web site consisting of:
- A web server serving your various users requests
- A DB for persistence
- A separate server asynchronously doing background stuff - preparing the data on the DB, updating it according to changes, etc. - regardless of what's going on in the main server.
You can easily translate this into another world and talk about threads for example - i.e. having one thread preparing the data asynchronously for a main thread which is running.
Is there a name for this pattern, if it is a pattern at all?
Are there any pros/cons for this method of processing data in terms of performance?
Let me just clarify that I'm asking specifically about the second web server doing background processing, and not the whole architecture.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一切都有模式。如果你已经看过两次以上,那就有一个模式。
您已经获得了三个客户端-服务器示例。
您已经有了浏览器-Web 服务器。
您已让 Web 服务器充当 DB 客户端 的角色,与 DB 服务器 进行通信。
您的 Web 服务器充当与应用服务器通信的应用服务器客户端角色。
有时人们喜欢称之为N 层,因为存在浏览器-Web 服务器-数据库服务器三层,外加一个附加的应用程序服务器层。
有些人将其扩展为服务总线概念。您的 Web 服务器使用数据库服务器和应用程序服务器。
我听说过“异步后端”和“后端服务器”这些名称来描述您的应用程序服务器体系结构。
Everything has patterns. If you've seen it more than twice, there's a pattern.
You've got three examples of Client-Server.
You've got Browser-Web Server.
You've got web server in the role of DB Client talking to DB Server.
You've got web server in the role of App server client talking to an App Server.
Sometimes folks like to call this N-Tier since there are at three tiers of Browser-Web Server-DB Server, plus an additional application server tier.
Some folks expand this into the Services Bus concept. Your web server uses DB server and application server.
The Asynchronous Back-End and Back-end Server are names I've heard to describe your application server architecture.
我没有为您提供模式名称(并不是说没有),但您这里拥有的是一种优化,可以防止主线程对请求响应缓慢。它不必计算数据,只需提供数据即可。
这与 UI 编码类似。您无需在 UI 线程上执行任何操作,只需进行绘制即可。其他线程应该负责解决所有其他问题,以便您的 UI 能够响应。
I don't have a pattern name for you (not to say there isn't one), but what you have here is an optimization to keep your main thread from responding slowly to requests. It doesn't have to calculate data, it just has to provide it.
This is similar to UI coding. You don't do any work on your UI thread, you just draw. Other threads should be responsible for figuring everything else out, so your UI is responsive.
我不知道它是否是正式的模式名称,但这看起来几乎就像大型机时代的批处理。
I don't know if it's officially a pattern name but this looks almost like batch processing from the mainframe days.