Home Backend Development PHP Tutorial C/S和B/S两种架构区别与优缺点分析_PHP

C/S和B/S两种架构区别与优缺点分析_PHP

May 31, 2016 pm 07:29 PM
c/s Advantages and Disadvantages the difference

一、C/S 架构

1、 概念

C/S 架构是一种典型的两层架构,其全程是Client/Server,即客户端服务器端架构,其客户端包含一个或多个在用户的电脑上运行的程序,而服务器端有两种,一种是数据库服务器端,客户端通过数据库连接访问服务器端的数据;另一种是Socket服务器端,服务器端的程序通过Socket与客户端的程序通信。

C/S 架构也可以看做是胖客户端架构。因为客户端需要实现绝大多数的业务逻辑和界面展示。这种架构中,作为客户端的部分需要承受很大的压力,因为显示逻辑和事务处理都包含在其中,通过与数据库的交互(通常是SQL或存储过程的实现)来达到持久化数据,以此满足实际项目的需要。

2 、优点和缺点

优点:

2.1 C/S架构的界面和操作可以很丰富。
2.2 安全性能可以很容易保证,实现多层认证也不难。
2.3 由于只有一层交互,因此响应速度较快。

缺点:

2.4 适用面窄,通常用于局域网中。
2.5 用户群固定。由于程序需要安装才可使用,因此不适合面向一些不可知的用户。
2.6 维护成本高,发生一次升级,则所有客户端的程序都需要改变。

二、B/S架构

1、概念

B/S架构的全称为Browser/Server,即浏览器/服务器结构。Browser指的是Web浏览器,极少数事务逻辑在前端实现,但主要事务逻辑在服务器端实现,Browser客户端,WebApp服务器端和DB端构成所谓的三层架构。B/S架构的系统无须特别安装,只有Web浏览器即可。

B/S架构中,显示逻辑交给了Web浏览器,事务处理逻辑在放在了WebApp上,这样就避免了庞大的胖客户端,减少了客户端的压力。因为客户端包含的逻辑很少,因此也被成为瘦客户端。

2 、优点和缺点

优点:

1)客户端无需安装,有Web浏览器即可。
2)BS架构可以直接放在广域网上,通过一定的权限控制实现多客户访问的目的,交互性较强。
3)BS架构无需升级多个客户端,升级服务器即可。

缺点:

1)在跨浏览器上,BS架构不尽如人意。
2)表现要达到CS程序的程度需要花费不少精力。
3)在速度和安全性上需要花费巨大的设计成本,这是BS架构的最大问题。
4)客户端服务器端的交互是请求-响应模式,通常需要刷新页面,这并不是客户乐意看到的。(在Ajax风行后此问题得到了一定程度的缓解)

三、B/S对C/S的改进和扩展

正如前文所说,C/S和B/S都可以进行同样的业务处理,但是B/S随着Internet技术的兴起,是对C/S结构的一种改进或者扩展的结构。相对于C/S,B/S具有如下优势:

1、分布性:可以随时进行查询、浏览等业务

2、业务扩展方便:增加网页即可增加服务器功能

3、维护简单方便:改变网页,即可实现所有用户同步更新

4、开发简单,共享性强,成本低,数据可以持久存储在云端而不必担心数据的丢失。

四、主流的Web程序应用平台

一个动态网站服务器平台至少要包括:操作系统+Web服务器+应用程序服务+数据库。一个优秀的网站服务器是由多方面因素决定的,如个人喜好、部署费用、安全机制等。而现在主流的三种Web平台:ASP.NET、JavaEE和LAMP各有优缺点,以满足不同的需要和用户。三者比较如下:

三种平台的各部分组合:

ASP.NET:Windows Server+IIS+SQL Server+ASP

JavaEE:UNIX+Tomcat+Oracle+JSP

LAMP:Linux+Apache+MySQL+PHP

五、三张图告诉你Web工作原理

1、服务器不带应用程序和数据库,直接请求HTML文件

2、服务器带应用程序(如php)

3、服务器带应用程序和数据库

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Mar 04, 2025 pm 04:06 PM

Original title: Bittensor=AIBitcoin? Original author: S4mmyEth, Decentralized AI Research Original translation: zhouzhou, BlockBeats Editor's note: This article discusses Bittensor, a decentralized AI platform, hoping to break the monopoly of centralized AI companies through blockchain technology and promote an open and collaborative AI ecosystem. Bittensor adopts a subnet model that allows the emergence of different AI solutions and inspires innovation through TAO tokens. Although the AI ​​market is mature, Bittensor faces competitive risks and may be subject to other open source

Is there any difference between South Korean Bitcoin and domestic Bitcoin? Is there any difference between South Korean Bitcoin and domestic Bitcoin? Mar 05, 2025 pm 06:51 PM

The Bitcoin investment boom continues to heat up. As the world's first decentralized digital asset, Bitcoin has attracted much attention on its decentralization and global liquidity. Although China was once the largest market for Bitcoin, policy impacts have led to transaction restrictions. Today, South Korea has become one of the major Bitcoin markets in the world, causing investors to question the differences between it and its domestic Bitcoin. This article will conduct in-depth analysis of the differences between the Bitcoin markets of the two countries. Analysis of the differences between South Korea and China Bitcoin markets. The main differences between South Korea and China’s Bitcoin markets are reflected in prices, market supply and demand, exchange rates, regulatory supervision, market liquidity and trading platforms. Price difference: South Korea’s Bitcoin price is usually higher than China, and this phenomenon is called “Kimchi Premium.” For example, in late October 2024, the price of Bitcoin in South Korea was once

What is the difference between the old version of Sesame Open Door Gate and the new version? What is the difference between the old version of Sesame Open Door Gate and the new version? Mar 04, 2025 pm 01:33 PM

The article introduces the difference between the old version of the Sesame Open Door gate.io trading platform and the new version. In terms of interface design, the new version has optimized layout and more modern and simple visual style; in terms of functional experience, transaction functions are upgraded, user experience is optimized, and new functions are added; in terms of security performance, the new version of security mechanism is upgraded, and compliance is improved. However, the actual differences need to be determined by the specific update content of the platform.

What exchange is Nexo? Is Nexo exchange safe? What exchange is Nexo? Is Nexo exchange safe? Mar 05, 2025 pm 07:39 PM

Nexo: Not only is it a cryptocurrency exchange, but also your digital financial manager. Nexo is not a traditional cryptocurrency exchange, but a financial platform that focuses more on cryptocurrency lending. It allows users to obtain loans in cryptocurrency as collateral and provides services to earn interest. While Nexo also offers cryptocurrency buying, selling and redemption capabilities, its core business is crypto lending. This article will explore the operating model and security of Nexo in depth to provide investors with a more comprehensive understanding. Nexo's operating model was founded in 2018 and is headquartered in Zug, Switzerland, and is a pioneer in the field of digital finance. It is different from other centralized exchanges and focuses more on providing comprehensive financial services. Users can buy, sell, trade cryptocurrencies without selling assets and

The difference between Ether and Bitcoin What is the difference between Ether and Bitcoin The difference between Ether and Bitcoin What is the difference between Ether and Bitcoin Mar 19, 2025 pm 04:54 PM

The difference between Ethereum and Bitcoin is significant. Technically, Bitcoin uses PoW, and Ether has shifted from PoW to PoS. Trading speed is slow for Bitcoin and Ethereum is fast. In application scenarios, Bitcoin focuses on payment storage, while Ether supports smart contracts and DApps. In terms of issuance, the total amount of Bitcoin is 21 million, and there is no fixed total amount of Ether coins. Each security challenge is available. In terms of market value, Bitcoin ranks first, and the price fluctuations of both are large, but due to different characteristics, the price trend of Ethereum is unique.

Is Bitcoin speculation a stock speculation? Why? What are the differences between the two? Is Bitcoin speculation a stock speculation? Why? What are the differences between the two? Mar 05, 2025 pm 02:24 PM

Bitcoin: Digital gold or stock trading derivatives? In-depth analysis of the nature of its investment. Bitcoin, as an emerging investment method, has drastically fluctuated prices and has similarities with the stock market trading rules, which has triggered people's questions about its investment nature: Is Bitcoin speculation equivalent to stock speculation? This article will discuss in-depth from the aspects of definition, nature, issuance mechanism, etc., and unveil the mystery of Bitcoin investment. Bitcoin and Stocks: The essential difference between Bitcoin and Stocks is: Investing in Bitcoin is not the same as investing in stocks. Bitcoin is a decentralized digital currency that belongs to the category of digital assets or virtual assets. Its transactions are completely controlled by users and adopts a point-to-point (P2P) transmission model to form a decentralized payment system. This concept was proposed by Satoshi Nakamoto in 2009. Unlike traditional currencies,

What is the difference between bean bread and deepseek What is the difference between bean bread and deepseek Mar 12, 2025 pm 01:24 PM

The core difference between bean bun and DeepSeek is retrieval accuracy and complexity. 1. Doubao is based on keyword matching, simple and direct, with low cost, but low accuracy, and is only suitable for structured data; 2. DeepSeek is based on deep learning, can understand semantics, has high accuracy, but high cost, and is suitable for unstructured data. The final choice depends on the application scenario and resource limitations. If the accuracy requirements are not high, choose bean bags, and if you pursue high precision, choose DeepSeek.

Crypto investment mentality is very important! How to avoid unnecessary worries and make correct decisions? Crypto investment mentality is very important! How to avoid unnecessary worries and make correct decisions? Mar 05, 2025 pm 07:24 PM

Fear, uncertainty and doubt of crypto investment: How to make informed decisions? Many crypto investors face fears of “this is the last cycle”, as well as concerns about the duration of the bull market, coupled with pressure from others, which together lead to poor investment decisions. This article will explore how to overcome these challenges and make smarter investment choices. Potential risk: Distraction: Blindly chase hot spots and ignore the value of core assets. Pessimism and hesitation: Uncertainty leads to lack of confidence, inability to hold for a long time, and even exit from the market. Lack of belief: Lack of in-depth research on projects and cannot cope with market volatility. Lack of profit-making strategies: clearing positions early due to fear of pullbacks, missing potential returns. Coping strategies: 1. Focus on core areas:

See all articles