当前位置:网站首页>B站用户视频观看记录的存储方案
B站用户视频观看记录的存储方案
2022-04-23 06:03:00 【若小鱼】
中午上B站看视频的时候,突然好奇B站的视频观看记录是怎么存的。
首先,因为多端观看的视频记录都是同步的,即不管是在手机观看,还是网页观看,还是新设备观看,视频都是可以直接跳转到上次的观看位置的,所以这个记录应该不是存储在本地的。
其次,B站的用户截至2020年底,MAU(月活)达2.02亿,视频总量2020年看有人统计约为7千万条,假设按1亿条计,即使按人均每日观看100个视频,那10年到用户的话每个用户也有36.5万条记录。这样一个超大的稀疏矩阵该怎么存?传统数据库显然不合适。
我自己首先想到的应该是HBase,单实例支持十亿行百万列。因为视频内容是无限增长的,而用户是有限的,所以可以以用户id作为rowkey,视频内容id作为column来记录该用户每个视频的观看位置。
但是视频的数量现在就已经达到亿级别,而且还会继续增长,百万列明显不够。这可能就需要考虑多实例,即把视频内容id按一定的hash规则(或者直接按照顺序,方便扩展)分别存储在不同的实例里,比如1亿条条视频就每个实例存100万条,分100个实例,查询用户视频观看位置时,就根据视频id先到指定的实例去,然后再通过用户id主键+视频内容id列查询位置记录。
不过,想了想又让我感觉这是个比较笨拙的方案。
以上纯属脑子里突然冒出的一个问题,暂且记录一下,具体B站或者其他视频网站(比如腾优爱)是采用的什么技术方案,我会再继续查找和思考。
版权声明
本文为[若小鱼]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44162809/article/details/120434449
边栏推荐
- 异常记录-20
- OSS云存储管理实践(体验有礼)
- Comparison between Prometheus thanos and cortex components
- qs. In the stringify interface, the input parameter is converted into a & connected string (with the application / x-www-form-urlencoded request header)
- Introduction to RDMA network
- 异常记录-14
- MySQL server standalone deployment manual
- RAC环境集群组件gipc无法正确识别心跳网络状态问题分析
- Error alarm of Postgres master-slave replication delay monitoring
- Oracle RAC数据库实例启动异常问题分析IPC Send timeout
猜你喜欢
冬季实战营动手实战-上云必备环境准备,动手实操快速搭建LAMP环境 领鼠标 云小宝 背包 无影
Introduction to DDoS attack / defense
ACFS文件系统创建扩大缩小等配置步骤
Ali vector library Icon tutorial (online, download)
volatile 关键字的三大特点【数据可见性、指令禁止重排性、不保证操作原子性】
Passerelle haute performance pour l'interconnexion entre VPC et IDC basée sur dpdk
Problems related to Prometheus cortex using block storage
Prometheus Cortex架构概述(水平可扩展、高可用、多租户、长期存储)
Prometheus的relabel_configs和metric_relabel_configs解释及用法示例
Prometheus thanos Quick Guide
随机推荐
timestamp隐式转换问题导致索引列未使用问题分析
异常记录-10
Chaos带你快速上手混沌工程
异常记录-21
Prometheus Thanos快速指南
qs. In the stringify interface, the input parameter is converted into a & connected string (with the application / x-www-form-urlencoded request header)
Practice of openvswitch VLAN network
prometheus告警记录持久化(历史告警保存与统计)
异常记录-22
Thanos如何为不同租户配置不同的数据保留时长
MySQL【ACID+隔离级别+ redo log + undo log】
RAC环境集群组件gpnp未启动成功问题分析
Alertmanager重复/缺失告警现象探究及两个关键参数group_wait和group_interval的释义
js 函数包裹forEach中使用return跳不出外层函数
Thanos Compactor组件使用
Dolphinscheduler源码包src.tar.gz解压问题
[step by step, even thousands of miles] MySQL reports a large number of unauthenticated user connection errors
Introduction to RDMA
Try catch cannot catch asynchronous errors
How does VirtualBox modify the IP network segment assigned to the virtual machine in the "network address translation (NAT)" network mode