大数据分析-常见分布式OLAP查询引擎研究

本文涉及的产品
云原生数据仓库AnalyticDB MySQL版,基础版 8ACU 100GB 1个月
云原生大数据计算服务MaxCompute,500CU*H 100GB 3个月
简介: 通用大数据分析OLAP引擎的粗浅研究学习-更新中

大数据查询分析-分布式OLAP查询引擎设计


Bigdata OLAP Product= Cube + OLAP(QueryParser+QueryOptimizer+QueryEngine) + FileSystem(HDFS/GFS/S3)

OLAP Type Link Desc
Mondrian ROLAP http://mondrian.pentaho.com/documentation/architecture.php 多维数据建模
Impala BQ-OLAP https://github.com/cloudera/Impala/wiki 交互式SQLonHadoop(容错性差)
PrestoDB BQ-OLAP https://prestodb.io/ 交互式SQLonHadoop
Dremel BQ-OLAP 交互式BigQuery
Kylin MOLAP http://kylin.apache.org/ 预处理&Cache
Druid RT-OLAP http://druid.io/ 增量计算&搜索引擎
Pinot RT-OLAP https://github.com/linkedin/pinot 增量计算
  • OLAP类型:ROLAP/BigQuery-OLAP/RT-OLAP/MOLAP,其中Kylin是一种针对大数据场景设计的特殊MOLAP
  • 当前OLAP技术领域有大数据量分析需求,不包含查询引擎与数据存储优化的轻量级方案(Mondrian)应用场景受限
  • 越来越多关注查询本身而不是过多关注Cube/Dimension/Measure等传统数据仓库所遵循的通用标准,这样才能更加适应当前大数据领域的现实需求
  • Tableau作为优秀可视化分析工具对大数据量分析能力有所欠缺

OLAP场景的关键特征

  • 大多数是读请求
  • 数据总是以相当大的批次(> 1000 rows)进行写入
  • 不修改已添加的数据
  • 每次查询都从数据库中读取大量的行,但是同时又仅需要少量的列 宽表,即每个表包含着大量的列
  • 较少的查询(通常每台服务器每秒数百个查询或更少)
  • 对于简单查询,允许延迟大约50毫秒
  • 列中的数据相对较小: 数字和短字符串(例如,每个URL 60个字节) 处理单个查询时需要高吞吐量(每个服务器每秒高达数十亿行)
  • 事务不是必须的
  • 对数据一致性要求低
  • 每一个查询除了一个大表外都很小 查询结果明显小于源数据,换句话说,数据被过滤或聚合后能够被盛放在单台服务器的内存中

1.ROLAP引擎 - Mondrian

特点:多维数据建模+无内置查询引擎

[Mondriad-ROLAP分析]

Comments:敏捷BI多是基于Mondrain框架搭建的OLAP查询引擎

2.SQLonHadoop查询引擎 - (Impala/Presto/Dremel/Redshift)

特点:DistrubutedSQLQueryEngine分布交互式查询

  • [SQLonHadoop技术分析]
  • [Impala]
  • [PrestoDB]
  • BigQuery&Dremel
  • Amazon Redshift

3.关于Kylin-MOLAP

特点:Cube预处理+多维数据查询(QueryEngine应弱于Impala/Presto)

3.1.Kylin架构

kylin_arch.png

  • DataSource:Hive
  • MapReduce聚合计算
  • Spark内存计算
  • AggregateTable:HBase
  • pre-aggregation预聚合
  • 增量CubeSegment/CubeSegmentMerge
  • Trie树维度值编码

3.2.TechnicalConcepts

  • Star Schema/Snowflake Schema
  • Cube
  • DIMENSION & MEASURE
  • CUBE ACTIONS

3.3 表描述

  • FactTable
  • LookupTable(事实描述表)
  • DimensionTable

3.4 Measure计算

  • Sum
  • Count
  • Max
  • Min
  • Average
  • Distinct Count(based on HyperLogLog近似值估值)

4.RT(Realtime类搜索)OLAP查询引擎 - Druid/Pinot

Druid是基于MOLAP模型的空间换时间方案。优点在于查询性能的整体提升,缺点在于数据多维分析的局限性

4.1.Druid特点

特点:类搜索引擎+增量计算+数据实时写入

  • 整个系统同时提供了对离线数据分析和在线实时数据分析的支持
  • 可插拔的查询系统,支持多种存储系统

    • 亚秒响应的交互式查询。支持较高并发,为面向用户的平台提供Olap查询(注意这是相比其他OLAP的强大优势)。
    • 支持实时导入,导入即可被查询。支持高并发导入。
    • 采用分布式shared-nothing的架构,可以扩展到PB级。
    • 支持聚合函数,count和sum,以及使用javascript实现自定义UDF。
    • 支持复杂的Aggregator,近似查询的Aggregator例如HyperLoglog以及Yahoo开源的DataSketches。
    • 支持Groupby,Select,Search查询。(Groupby性能较差,推荐timeseries/TopN)
    • 不支持大表之间的Join,但其lookup功能满足和维度表的Join
    • 列存储,倒排索引,RollUP(汇总/上卷),roaring或conciseBitmap位图索引+LZ4数据压缩

4.2.Druid架构分析

Druid架构.png

Druid ingestion specs define this granularity as the queryGranularity of the data. The lowest supported queryGranularity is millisecond.
Druid shards are called segments and Druid always first shards data by time.

Segments contain data stored in compressed column orientations, along with the indexes for those columns. Druid queries only understand how to scan segments.
Following search infrastructure, Druid creates immutable snapshots of data, stored in data structures highly optimized for analytic queries.
Druid is a column store, which means each individual column is stored separately. Druid indexes data on a per-shard (segment) level.
Druid has two means of ingestion, real-time and batch. Real-time ingestion in Druid is best effort.
One common approach to operating Druid is to have a real-time pipeline for recent insights, and a batch pipeline for the accurate copy of the data.
Druid's native query language is JSON over HTTP. Apache Calcite - SQL parser, planner and query engine whose Druid adapter can query data residing in Druid.
Druid is designed to perform single table operations and does not currently support joins. Many production setups do joins at ETL because data must be denormalized before loading into Druid.
Druid is designed to have no single point of failure. Different node types are able to fail without impacting the services of the other node types.

A.Storage

  • Segment:Druid倒排索引+时间分片

    Segments contain the various dimensions and metrics in a data set, stored in a column orientation, as well as the indexes for those columns.
    Segments are stored in a "deep storage" LOB store/file system.
    Druid stores its index in segment files, which are partitioned by time(按时间分片).
    Segment core data structure: three basic column types: the timestamp column, dimension columns, and metric columns.

Sharding Data to Create Segments

  • Dimensions:Bitmap Index 维度:Bitmap索引

    Dimensions columns are different because they support filter and group-by operations, so each dimension requires the following three data structures:
    1.A dictionary that maps values (which are always treated as strings) to integer IDs,
    2.A list of the column’s values, encoded using the dictionary in 1
    3.For each distinct value in the column, a bitmap that indicates which rows contain that value.

The bitmaps in 3 -- also known as inverted indexes allow for quick filtering operations(specifically, bitmaps are convenient for quickly applying AND and OR operators).
The list of values in 2 is needed for group by and TopN queries.

  • Multi-value columns

B.核心模块

  • Broker模块:

route queries to if you want to run a distributed cluster. This node also merges the result sets from all of the individual nodes together.
Broker nodes employ a cache with a LRU cache invalidation strategy.
类似分布式搜索引擎中的meta元搜索引擎,他不负责任何Segment的查询,他只是一个代理,从Zookeeper中获取TimeLine,这个 TimeLine记录了intervals->List(Server)的mapping关系,接收到Client的请求以后,按照时间段在TimeLine查找Segment分布在那些 Server上。

  • Coordinator模块:

responsible for loading new segments, dropping outdated segments, managing segment replication, and balancing segment load.
负责协调Segment的均衡分发加载,Coordinator从meta数据存储mysql/postgreSQL中获取那些还未被加载的Segment,根据当前所有Historical的负载能力均衡地分配到其LoadQueue。

  • Historical模块:

从Deep Storage中下载Segment,采用mmap(内存映射)的方式加载Segment,并负责来自broker对这些Segment的查询.
Historical nodes do not communicate directly with each other or with the coordinator nodes but instead rely on Zookeeper for coordination.

  • Indexing Service模块:

The indexing service is a highly-available, distributed service that runs indexing related tasks.Indexing service tasks create (and sometimes destroy) Druid segments.
The indexing service is composed of three main components: a peon component that can run a single task, a Middle Manager component that manages peons, and an overlord component that manages task distribution to middle managers.
Druid的索引结构布局由字典,正排(列存储)以及倒排索引组成,其中倒排的PostingList采用压缩LZ4的BitMap位图索引。支持Consice和Roaring两种BitMap方式

  • Realtime process模块:

Realtime nodes will periodically build segments representing the data they’ve collected over some span of time and transfer these segments off to Historical nodes.

Realtime Node负责提供实时数据索引,生成realtime Index(Segment),并定期推送到Historical Node。在Realtime中采用LSM-Tree的模型

4.3.Druid Adapter & SQL Parser

Full SQL is currently not supported with Druid. (当前SQL支持无法与Druid原生查询语言一样灵活)
Calcite’s Druid adapter allows you to query the data using SQL, combining it with data in other Calcite schemas.

4.4.Multitenancy Consideration

Multitenant workloads can either use a separate datasource for each tenant, or can share one or more datasources between tenants using a "tenant_id" dimension. When deciding which path to go down, consider that each path has pros and cons.
Shared datasources or datasource-per-tenant
Druid offical compromise is to use more than one datasource, but a smaller number than tenants.
Partitioning shared datasources
Customizing data distribution
Supporting high query concurrency
Druid's fundamental unit of computation is a segment. Nodes scan segments in parallel and a given node can scan druid.processing.numThreads concurrently.
Druid internally stores requests to scan segments in a priority queue.

4.5.Query Caching

Druid supports query result caching through an LRU cache. Results are stored on a per segment basis, along with the parameters of a given query.

4.6.Sorting Order

These sorting orders are used by the TopNMetricSpec, SearchQuery, GroupByQuery's LimitSpec, and BoundFilter.

  • Lexicographic
  • Alphanumeric
  • Numeric
  • Strlen
  • 不支持具体维度按度量排序功能
相关实践学习
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
2月前
|
存储 分布式计算 大数据
基于Python大数据的的电商用户行为分析系统
本系统基于Django、Scrapy与Hadoop技术,构建电商用户行为分析平台。通过爬取与处理海量用户数据,实现行为追踪、偏好分析与个性化推荐,助力企业提升营销精准度与用户体验,推动电商智能化发展。
|
3月前
|
数据可视化 搜索推荐 大数据
基于python大数据的北京旅游可视化及分析系统
本文深入探讨智慧旅游系统的背景、意义及研究现状,分析其在旅游业中的作用与发展潜力,介绍平台架构、技术创新、数据挖掘与服务优化等核心内容,并展示系统实现界面。
|
3月前
|
存储 SQL 分布式计算
终于!大数据分析不用再“又要快又要省钱”二选一了!Dataphin新功能太香了!
Dataphin推出查询加速新功能,支持用StarRocks等引擎直连MaxCompute或Hadoop查原始数据,无需同步、秒级响应。数据只存一份,省成本、提效率,权限统一管理,打破“又要快又要省”的不可能三角,助力企业实现分析自由。
227 49
|
2月前
|
机器学习/深度学习 大数据 关系型数据库
基于python大数据的台风灾害分析及预测系统
针对台风灾害预警滞后、精度不足等问题,本研究基于Python与大数据技术,构建多源数据融合的台风预测系统。利用机器学习提升路径与强度预测准确率,结合Django框架实现动态可视化与实时预警,为防灾决策提供科学支持,显著提高应急响应效率,具有重要社会经济价值。
|
2月前
|
机器学习/深度学习 大数据 关系型数据库
基于python大数据的青少年网络使用情况分析及预测系统
本研究基于Python大数据技术,构建青少年网络行为分析系统,旨在破解现有防沉迷模式下用户画像模糊、预警滞后等难题。通过整合多平台亿级数据,运用机器学习实现精准行为预测与实时干预,推动数字治理向“数据驱动”转型,为家庭、学校及政府提供科学决策支持,助力青少年健康上网。
|
3月前
|
存储 自然语言处理 分布式计算
Apache Doris 3.1 正式发布:半结构化分析全面升级,湖仓一体能力再跃新高
Apache Doris 3.1 正式发布!全面升级半结构化分析,支持 VARIANT 稀疏列与模板化 Schema,提升湖仓一体能力,增强 Iceberg/Paimon 集成,优化存储引擎与查询性能,助力高效数据分析。
520 4
Apache Doris 3.1 正式发布:半结构化分析全面升级,湖仓一体能力再跃新高
|
3月前
|
数据采集 数据可视化 关系型数据库
基于python大数据的电影数据可视化分析系统
电影分析与可视化平台顺应电影产业数字化趋势,整合大数据处理、人工智能与Web技术,实现电影数据的采集、分析与可视化展示。平台支持票房、评分、观众行为等多维度分析,助力行业洞察与决策,同时提供互动界面,增强观众对电影文化的理解。技术上依托Python、MySQL、Flask、HTML等构建,融合数据采集与AI分析,提升电影行业的数据应用能力。
|
2月前
|
传感器 人工智能 监控
拔俗多模态跨尺度大数据AI分析平台:让复杂数据“开口说话”的智能引擎
在数字化时代,多模态跨尺度大数据AI分析平台应运而生,打破数据孤岛,融合图像、文本、视频等多源信息,贯通微观与宏观尺度,实现智能诊断、预测与决策,广泛应用于医疗、制造、金融等领域,推动AI从“看懂”到“会思考”的跃迁。
|
3月前
|
数据可视化 大数据 数据挖掘
基于python大数据的招聘数据可视化分析系统
本系统基于Python开发,整合多渠道招聘数据,利用数据分析与可视化技术,助力企业高效决策。核心功能包括数据采集、智能分析、可视化展示及权限管理,提升招聘效率与人才管理水平,推动人力资源管理数字化转型。

热门文章

最新文章