大型网站技术架构(七)网站的可扩展性架构

news/2024/5/19 4:23:03/文章来源:https://blog.csdn.net/weixin_34376986/article/details/92650944

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

 扩展性是指对现有系统影响最小的情况下,系统功能可持续扩展或提升的能力。

        设计网站可扩展架构的核心思想是模块化,并在此基础上,降低模块间的耦合性,提供模块的复用性。模块通过分布式部署,独立的模块部署在独立的服务器上(集群)从物理上分离模块之间的耦合关系。

        模块分布式部署以后具体聚合方式主要有分布式消息队列和分布式服务

1、利用分布式消息队列降低系统耦合性

        如果模块之间不存在直接调用,那么新增模块或者修改模块对其他模块影响最小,这样系统的可扩展性无疑更好一些。

        事件驱动框架:通过在低耦合的模块之间传输事件消息,以保持模块的松散耦合,并借助事件消息的通信完成模块间合作,典型的架构就是生产者消费者模式。在大型网站架构中,具体实现手段很多,最常用的就是分布式消息队列,如下图所示:

 

 

 

       消息队列利用发布-订阅模式工作,消息发送者发布消息,一个或者多个消息接收者订阅消息。

       由于消息发送者不需要等待消息接受者处理数据就可以返回,系统具有更好的响应延迟;同时,在网站访问高峰,消息可以暂时存储在消息队列中等待处理,减轻数据库等后端存储的负载压力。

       目前开源的和商业的分布式消息队列产品有很多,比较著名的有Apache ActiveMQ等,如下是分布式消息队列的架构原理:

 

 

 

 

 2、利用分布式服务打造可复用的业务平台

        使用分布式服务是降低系统耦合性的另一个重要手段。如果说分布式消息队列通过消息对象分解系统耦合性,不同子系统处理同一个消息;那么分布式服务则通过接口分解系统耦合性,不同子系统通过相同的接口描述进行服务调用。

        大型网站分布式服务的需求与特点:

  1. 负载均衡
  2. 失效转移
  3. 高效的远程通信
  4. 整合异构系统
  5. 对应用最小入侵
  6. 版本管理
  7. 实时监控

 目前国内有较多成功实施案例的开源分布式服务框架是阿里巴巴的Dubbo,下图是Dubbo的架构原理:

 

 

        服务消费程序通过服务接口使用服务,而服务接口通过代理加载具体服务,具体服务可以是本地的代码模块,也可以是远程的服务,因此对应用较小入侵;应用程序需要调用服务接口,服务框架根据配置自动调用本地或远程实现。

        服务框架客户端模块通过服务注册中心加载服务提供者列表(服务提供者启动后主动向服务注册中心注册自己可提供的服务接口列表),查找需要的服务接口,并根据配置的负载均衡策略将服务调用请求发送到某台服务提供者服务器。如果服务调用失败,客户端模块会自动从服务提供者列表选择一个可提供同样服务的另一台服务器重新请求服务,实现服务的自动失效转移,保证高可用服务。

3、利用开放平台建设网站生态圈

        大型网站为了更好的服务自己的用户,开放更多的增值服务,会把网站内部的服务封装成一些调用接口开放出去,共外部的第三方开发者使用,这个提供开放接口的平台被称作开放平台。

        开放平台是网站内部和外部交互的接口,外部需要面对众多的第三方开发者,内部需要面对网站内诸多的业务服务。虽然每个网站的业务场景和需求都不相同,但开发平台的架构设计却大同小异,如下图所示:

API接口:是开发平台暴露给开发者使用的一组API,其形式可以是RESTfull,WebService,RPC等各种形式。

协议转换:将各种API输入转换成内部服务可以识别的形式,并将内部服务的返回封装成API格式。

安全:除了一般应用需要的身份识别、权限控制等安全手段,开放平台还需要分级的访问带宽限制,以保证资源被公平合理的使用。

审计:记录第三方应用的访问情况并进行监控、计费等。

路由:将开放平台的各种访问路由映射到具体的内部的服务。

流程:将一组离散的服务组织成一个上下文相关的新服务,隐藏服务细节,提供统一接口供开发者调用。

转载于:https://my.oschina.net/zhanghaiyang/blog/595687

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_743244.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

idx1_如何使用WordPress创建IDX房地产网站

idx1Do you want to create an IDX real estate website using WordPress? A real estate website requires specific features that are not normally available in ready-made websites, but don’t worry we got you covered. In this article, we will show you how to ea…

wordpress创建_建立一个WordPress网站实际需要多少费用?

wordpress创建One of the questions we often get asked is: how much does it cost to build a WordPress website? While the core WordPress software is free, the cost of a website depends entirely on your budget and goals. 我们经常被问到的问题之一是&#xff1a…

wordpress用户注册_如何在WordPress网站上允许用户注册

wordpress用户注册Do you want to allow users to register on your site? You can enable user registration in WordPress to allow users to add posts, or comment, or perform other actions on your website. In this article, we will show you how to allow user regi…

wordpress 黑客_WordPress网站遭到黑客入侵的11个主要原因(以及如何预防)

wordpress 黑客Recently, one of our readers asked us why do WordPress sites get hacked? It is frustrating to find out that your WordPress site has been hacked. In this article, we will share the top reasons why WordPress site gets hacked, so you can avoid …

slack通知本地服务器_如何从您的WordPress网站获取Slack通知

slack通知本地服务器Do you want to get Slack notifications based on certain activity on your WordPress site? 您是否要根据WordPress网站上的某些活动获得Slack通知? Slack has become a central communication platform for many online businesses. Havi…

如何验证测试工具的正确_如何正确运行网站速度测试(8种最佳工具)

如何验证测试工具的正确Do you want to run a website speed test? Most beginners don’t know where to begin and what to look for in their website speed test. 您要运行网站速度测试吗? 大多数初学者不知道从哪里开始以及在网站速度测试中要寻找什么。 Th…

2020年必须为企业网站提供24个WordPress插件

Looking for the best WordPress plugins to take your business to the next level in 2020? 寻找最佳的WordPress插件以在2020年将您的业务提升到一个新水平吗? There are over 55,000 WordPress plugins that you can choose from. This makes it extremely ov…

wordpress搜索插件_12个WordPress搜索插件可改善您的网站搜索

wordpress搜索插件Do you want to improve your WordPress site search? We all know that the default WordPress search feature is fairly limiting. However, there are several WordPress search plugins that can help you improve the default search experience. In t…

9个适用于多语言网站的最佳WordPress翻译插件

WordPress is used by millions of non-English websites around the world. You can use WordPress to create a website in any language that you want. WordPress已被全球数百万个非英语网站使用。 您可以使用WordPress以所需的任何语言创建网站。 However, WordPress do…

WooCommerce SEO轻松实现-Google排名第一的分步指南

Do you want to improve your WooCommerce SEO, but not sure how to get started? Search engine optimization (SEO) for your eCommerce store is an equivalent of having someone standing on every street corner in the real world, spinning signs with your store’s…

万圣节 数据_将万圣节特效带入WordPress网站的7种方法

万圣节 数据Do you want to add Halloween effects to your WordPress site? Holidays are the perfect time to boost sales, increase conversions, and build brand recognition. Halloween is a particularly fun holiday bringing you more opportunities to grow your b…

wordpress 内网安装插件_Wordpress网站安装插件出现500错误Internal Server Error

今天看中一个项目,想用我的wordpress先实现一下,安装Woocommerce插件后,点击启用,整个网站就出现了:Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete…

WWW与非WWW –哪个更适合WordPress SEO?

Every now and again, we get asked by users what’s the difference between www vs non-www in site URLs? People often want to know which one is better for SEO, and whether they should change their site URL. In this article, we will help you understand the d…

wordpress插件_4个将WordPress网站转换为移动应用程序的最佳插件

wordpress插件Are you looking for a solution to convert your WordPress site into a mobile app? More and more people prefer to browse the internet and shop online using their mobile devices. Apps are a convenient way to deliver your content and offer better…

url wordpress_如何更改您的WordPress网站URL(逐步)

url wordpressDo you need to change your WordPress URL? Whether you’re moving from HTTP to HTTPs, changing your domain name, migrating from local server to live site, or transferring to a subdomain, you will need to know how to change your WordPress site …

阿里云服务器从购买到网站上线全记录

阿里云服务器应该算是国内云服务器中的NO.1,很多新手站长最初都是从虚拟主机开始搭建网站的,刚刚接触云服务器的站长要自己搭建Web环境有些乱,其实我们使用阿里云服务器结合目前国内的主机面板即可轻松应对。新手站长网整理了一下从阿里云服务…

9个最佳新闻聚合器网站(+如何构建自己的网站)

Do you want to read the latest news and updates from your favorite blogs all at one place? 您是否想一站式阅读自己喜欢的博客中的最​​新新闻和更新? If so, then news aggregator websites are the best option for you. These websites automatically …

错误 出主意_拥有“免费网站”是个坏主意的36个理由

错误 出主意The thought of getting free website is tempting. The internet is full of companies offering free website hosting even for self-hosted WordPress. You’re probably wondering what’s the catch? Why isn’t everyone else using a free WordPress websi…

wordpress标题设置_如何将WordPress小部件添加到您的网站标题

wordpress标题设置Do you want to add a WordPress widget to your website’s header area? Widgets allow you to easily add content blocks into designated sections of your theme. In this article, we will show you how to easily add a WordPress widget to your si…

url wordpress_什么是WordPress中的SEO友好URL结构

url wordpressHave you ever wondered what’s the most SEO friendly permalink structure in WordPress? We’re often asked this question by new users. That’s because in the past, the default WordPress URL structure was not SEO friendly at all. However that’…