client-server model peer-to-peer architecture 主从式架构

w

https://zh.wikipedia.org/wiki/主从式架构

主从式架构 (Client–server model) 或客户端-服务器(Client/Server)结构简称C/S结构,是一种网络架构,它把客户端 (Client) (通常是一个采用图形用户界面的程序)与服务器 (Server) 区分开来。每一个客户端软件的实例都可以向一个服务器或应用程序服务器发出请求。有很多不同类型的服务器,例如文件服务器游戏服务器等。

主从式架构通过不同的途径应用于很多不同类型的应用程序,最常见就是目前在因特网上用的网页。例如,当你在维基百科阅读文章时,你的电脑和网页浏览器就被当做一个客户端,同时,组成维基百科的电脑、数据库和应用程序就被当做服务器。当你的网页浏览器向维基百科请求一个指定的文章时,维基百科服务器从维基百科的数据库中找出所有该文章需要的信息,结合成一个网页,再发送回你的浏览器。

主从式架构意图提供一个可伸缩 (scalable)的架构,借此网上的计算机或者处理过程是一个客户端或者服务器。服务器软件一般,但不总是,运行在强大的专用商业计算机上。另一方面,客户端一般运行在普通个人电脑或者工作站上。

服务端的特征:

  • 被动的角色(从)。
  • 等待来自用户端的请求。
  • 处理请求并传回结果。

用户端的特征:

  • 主动的角色(主)。
  • 发送请求。
  • 等待直到收到响应。

服务器可以是有状态或者无状态的。无状态的服务器不会保留任何两个请求之间的信息,有状态服务器会记住请求之间的信息。这些信息的作用域可以是全局的或者某个事务 (session)的。静态 HTML 页面服务器是一个无状态服务器的例子,Apache Tomcat 是一个有状态服务器。

伺服端与用户端的互动经常使用循序图描述,循序图是 UML 中的一个标准。

https://en.wikipedia.org/wiki/Client-server_model

Comparison with peer-to-peer architecture

In addition to the client–server model, distributed computing applications often use the peer-to-peer (P2P) application architecture.

In the client–server model, the server is often designed to be a centralized system that serves many clients. The computing power, memory and storage requirements of a server must be scaled appropriately to the expected work load (i.e., the number of clients connecting simultaneously). Load balancing and failover systems are often employed to scale the server implementation.

In a peer-to-peer network, two or more computers (peers) pool their resources and communicate in a decentralized system. Peers are coequal, or equipotent nodes in a non-hierarchical network. Unlike clients in a client–server or client–queue–client network, peers communicate with each other directly.[15] In peer-to-peer networking, an algorithm in the peer-to-peer communications protocol balances load, and even peers with modest resources can help to share the load.[15] If a node becomes unavailable, its shared resources remain available as long as other peers offer it. Ideally, a peer does not need to achieve high availability because other, redundant peers make up for any resource downtime; as the availability and load capacity of peers change, the protocol reroutes requests.

原文地址:https://www.cnblogs.com/rsapaper/p/6729423.html