Home Database Mysql Tutorial 大型互联网站解决海量数据的常见策略

大型互联网站解决海量数据的常见策略

Jun 07, 2016 pm 04:26 PM
internet Large common data Massive Strategy solve

大型互联网站的数据存储与传统存储环境相比不仅是一个服务器、一个数据库那么简单,而是由网络设备、存储设备、应用服务器、公用访问接口、应用程序 等多个部分组成的复杂系统。分为 业务数据层、计算层、数据仓储、数据备份,通过应用服务器软件提供数据存

   大型互联网站的数据存储与传统存储环境相比不仅是一个服务器、一个数据库那么简单,而是由网络设备、存储设备、应用服务器、公用访问接口、应用程序 等多个部分组成的复杂系统。分为 业务数据层、计算层、数据仓储、数据备份,通过应用服务器软件提供数据存储服务,并且通过监控工具对存储单元监控。

    随着系统中用户数据量的线性增长,数据量将会越来越多。在这样一个数据不断膨胀的环境中,数据已经如洪水般汹涌泛滥。数据查找和调用困难,在海量数据中一些用户提交的请求往往要等到第二天才能得知结果,直接影响到了用户满意度的提升和新业务的布局。在技术上而言,这一特点使得RDBMS在大型应用场景被大幅限制,唯一的可选方案是Scale Out,通过增加多个逻辑单元的资源,并使它们如同一个集中的资源那样提供服务来实现系统的扩展性。

   系统中的数据就好比我们家里的物品,衣服放在衣柜里,碟子放在碗橱里,数据库、存储系统就好比你的衣柜和碗橱是一个存放的容器,衣服和碟子就好比不同的数据,将不同类型的东西放入合适的存储空间里面,这样系统的效率和利用率将会更高,所以我们将会做出如下设计,如图所示:

查看大图请点击这里

对于大型系统存储单元的结构模型我们分为6个部分组成,清单如下:

1.业务数据层
各类业务所产生的各种文件类型的数据,其中包含 用户信息、用户操作记录、实时业务数据、手机客户端升级应用程序、图片,等。

2.计算层
针对不同的数据格式、不同类型的数据文件,通过不同的工具、计算方法进行操作,针对大量的数据计算采用一些分布式、并行计算的算法,例如:MapReduce,BSP。并且对一部分的数据进行缓存,缓解对存储应用服务器的压力。

3.数据存储层
对于海量数据的查询与存储,特别是针对用户行为日志操作,需要使用到一些列式数据库服务器,对于处理业务和一些业务规则的数据依然存放在关系型数据库中,将采用MySQL来存储。

4.数据仓储
数据存储主要是针对于用户行为日志和用户行为分析,也是系统中数据量产生较大的一个环节,将会采用Apache Hive、Pig、Mathout 对数据仓储进行构建。

5.数据备份
分为在线数据备份和离线数据备份,数据备份环节需要经过运维经验的积累,根据业务和用户访问量进行定制合理的备份规律。

6.硬件
硬件环境是存储单元最基础的部分,分为磁盘、内存、网络设备存储,将不同的业务数据、文件存储在不同的硬件设备上。

技术实现
对于系统不同的业务数据和应用服务器的架构需要采用不同的读写方式,以及数据存储类型存放,数据仓储构建,数据冷热分离、数据索引多个部分组成。例如:业务应用程序、日志采集代理、用户空间文件系统(Filesystem in Userspace)。Data Access Proxy Layer(DDAL/Cache Handler)、OLAP、日志服务器、Oracle(暂定)、MySQL、Redis、Hive、HDFS、Moosefs。

如图所示:

查看大图请点击这里

针对以上设计架构,描述清单如下:

1.Data Access Proxy Layer
统称数据访问代理层(简称 DAPL),封装了DDAL和Cache Handler层,抽象的对编写的应用程序进行了划分,便于扩展和维护,例如:需要对HDFS或者图形数据库操作,上层不需要知道HDFS具体操作,只需要关注提供的接口。DAPL封装了很多访问各种数据源的读写策略。因此,可以保证对不同数据库、数据源操作的事务完整性。

2.DDAL
统称分布式数据访问层(简称 DDAL)主要针对关系数据库的读写分离操作,需要做到读写分离,首先需要对传入的SQL语句进行解析,并且采用Round-Robin算法负载分载对数据大量读取的操作,在代码实现中将使用MySQL-JDBC中的参数配置实现对MySQL-Slave的读取压力分载。

3.Cache Handler
与DDAL的相似,具体区别在于自己实现了Round-Robin算法负载分载对数据大量读取的操作,并且能在Redis Master当机的状态下重新指派新的Master进行写的操作。

4.Redis一主多从
对缓存数据进行读写分离,减少单台机器的I/O瓶颈,值得一提的是Cache不是可靠的存储,所以在设计时,需要容许Cache的数据丢失,因此,Cache的数据全部失效时,会从数据库里重新装载。

5.MySQL双主多从
这种方式是MySQL架构设计中最折中的方案,对数据的访问压力分载和数据的可靠性都有了相应的保障。前端2台Master MySQL相互进行数据备份,后端大量的Slave MySQL对Master写入的数据进行同步,所以每台机器节点上的MySQL数据库中的数据都是一致的,并且DDAL应用程序将数据轮询写入Master MySQL数据库中。

6.数据库读写分离
主要采用mysql的策略,学习MySQL-Prxoy的策略,自己开发对MySQL书籍节点进行读写分离的方法,MySQL驱动支持读写分离的数据完整性,当数据量超大规模的时候将会采用Sharding策略。

7.缓存读写分离
缓存Redis的策略,采用自己开发的应用程序需要实现Round Robin算法,对Redis Master和Slave缓存集群进行读写分离操作。

8.ETL Tools
采用Apache Hadoop项目中的Pig对海量的行为数据进行清洗,Pig可以针对有规律的半结构化数据执行类似SQL的脚本,并且可以将计算压力分载到每台服务器上进行分布式、并行处理。

9.Hive集群
针对数据仓库的建设由Apache Hive进行构建,是一个建立在Hadoop上的数据仓库框架,它提供了一个方便的数据集成方法和类似SQL的Hive QL查询语言,实现了Map/Reduce算法支持在Hadoop框架上进行大规模数据分析。

10.HDFS分布式文件系统
Hive中的数据全部存储在Hadoop分布式文件系统中,所有被存储的数据都会有数据的存储副本,这样对数据的可靠性有了保障。

11.Moosefs分布式文件系统
与上面提到的HDFS一个文件系统是有区别的,Moosefs不需要任何客户端程序对分布式文件进行操作的服务器,可以直接与任何运行环境进行对接,而且服务端也有副本复制的功能。

12.冷热数据分离
将系统中产生的进行归类存放,将用户更多关心、热门话题等内容 抽象为“最近几天”的“热数据”,而越早的数据我们在设计中抽象的分为“冷数据”。由此可见,“热节点”存放最新的、被访问频率较高的数据。对于这部分数据,我们希望能给用户提供尽可能快的查询速度,因此无论在硬件还是软件的选择上都会有了明显的区分,例如:最近常访问频率高的数据将会存储在系统缓存中,需要经常性被的业务数据将会存储在MySQL或者Oracle数据库系统中,

相关文章
大型互联网站解决高并发的常见策略

–end–

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 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 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)

Five tips to teach you how to solve the problem of Black Shark phone not turning on! Five tips to teach you how to solve the problem of Black Shark phone not turning on! Mar 24, 2024 pm 12:27 PM

As smartphone technology continues to develop, mobile phones play an increasingly important role in our daily lives. As a flagship phone focusing on gaming performance, the Black Shark phone is highly favored by players. However, sometimes we also face the situation that the Black Shark phone cannot be turned on. At this time, we need to take some measures to solve this problem. Next, let us share five tips to teach you how to solve the problem of Black Shark phone not turning on: Step 1: Check the battery power. First, make sure your Black Shark phone has enough power. It may be because the phone battery is exhausted

How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? Where is the automatically saved image when posting? How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? Where is the automatically saved image when posting? Mar 22, 2024 am 08:06 AM

With the continuous development of social media, Xiaohongshu has become a platform for more and more young people to share their lives and discover beautiful things. Many users are troubled by auto-save issues when posting images. So, how to solve this problem? 1. How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? 1. Clear the cache First, we can try to clear the cache data of Xiaohongshu. The steps are as follows: (1) Open Xiaohongshu and click the "My" button in the lower right corner; (2) On the personal center page, find "Settings" and click it; (3) Scroll down and find the "Clear Cache" option. Click OK. After clearing the cache, re-enter Xiaohongshu and try to post pictures to see if the automatic saving problem is solved. 2. Update the Xiaohongshu version to ensure that your Xiaohongshu

The driver cannot be loaded on this device. How to solve it? (Personally tested and valid) The driver cannot be loaded on this device. How to solve it? (Personally tested and valid) Mar 14, 2024 pm 09:00 PM

Everyone knows that if the computer cannot load the driver, the device may not work properly or interact with the computer correctly. So how do we solve the problem when a prompt box pops up on the computer that the driver cannot be loaded on this device? The editor below will teach you two ways to easily solve the problem. Unable to load the driver on this device Solution 1. Search for "Kernel Isolation" in the Start menu. 2. Turn off Memory Integrity, and it will prompt "Memory Integrity has been turned off. Your device may be vulnerable." Click behind to ignore it, and it will not affect the use. 3. The problem can be solved after restarting the machine.

Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Apr 03, 2024 pm 12:04 PM

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

Use ddrescue to recover data on Linux Use ddrescue to recover data on Linux Mar 20, 2024 pm 01:37 PM

DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other key features of DDREASE are as follows: It does not overwrite recovered data but fills the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly. Recover data from multiple files or blocks to a single

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks Apr 29, 2024 pm 06:55 PM

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

See all articles