当前位置:网站首页>redis常识
redis常识
2022-07-01 11:19:00 【每日一悟】
磁盘:
(1)寻址 ms (2)带宽(单位时间多大数据流过去)ns
内存:
(1)寻址 ns 磁盘比内存在寻址上慢了10w倍
I/O buffer:成本问题
磁盘有磁道和扇区:一扇区512Byte带来索引成本变大
格式化磁盘时有一个4K对齐:读小于4K的,返回4K
无论你从磁盘读多少,都是最少4K
文件里数据,随着文件变大,速度变慢(文件变大,硬盘(i/o)成为瓶颈)
data page (大小4K)
建索引,提升速度
关系型数据库建表,必须给出schema(表的列,每一个列的类型),每一行数据宽度就固定了,更倾向于行级存储。
内存中准备了一个B+树,叶子(data page),树干也在内存中
SQL的where条件里,只要命中索引,查询B+树会走树干,找到叶子,从磁盘读到内存。
(索引放在内存中,会引起内存不够,所以索引和数据都放在磁盘)
数据库的表很大,性能就会变低?
如果表有索引,增删改就会变慢。
查询速度变慢?
(1)1个或少量查询依然很快
(2)并发大的时候会受硬盘带宽影响速度
数据量大,如何快速查询数据库
(磁盘、内存折中)缓存:memcached、redis
计算机系统2个基础设备:冯诺依曼体系的硬件、以太网和TCP/IP的网络
磁盘和内存体积不一样:磁盘中没有指针概念
Redis 是一个开源(BSD许可)的,内存中的数据结构存储系统,它可以用作数据库、缓存和消息中间件。
它支持多种类型的数据结构,如 字符串(strings), 散列(hashes), 列表(lists), 集合(sets), 有序集合(sorted sets) 与范围查询, bitmaps,hyperloglogs 和 地理空间(geospatial) 索引半径查询。
Redis 内置了 复制(replication),LUA脚本(Lua scripting), LRU驱动事件(LRU eviction),事务(transactions) 和不同级别的 磁盘持久化(persistence), 并通过 Redis哨兵(Sentinel)和自动 分区(Cluster)提供高可用性(high availability)。
Redis:
key:
value:String(字符类型、数值类型)、hashes、lists、sets、sorted sets、bitmaps
客户端取回v中的某一个元素,redis的server中对每种类型都有自己的方法(index()、lpop)
memcached(key,value):value没有类型的概念
客户端取回v中的某一个元素,返回value所有的数据到client(通过server 网卡IO),客户端要有你实现的代码去节码
边栏推荐
猜你喜欢

LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer

编译调试Net6源码

索引失效的几种情况

Wonderful! MarkBERT

Huawei equipment is configured with large network WLAN basic services

YoDA统一数据应用——融合计算在蚂蚁风险场景下的探索与实践

Harbor webhook从原理到构建

Website source code whole site download website template source code download

Value 1000 graduation project campus information publishing platform website source code

Global filter (processing time format)
随机推荐
CVPR 2022 | self enhanced unpaired image defogging based on density and depth decomposition
全局过滤器(处理时间格式)
【MAUI】为 Label、Image 等控件添加点击事件
CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry
Development overview of fund internationalization
Shangtang entered the lifting period: the core management voluntarily banned and strengthened the company's long-term value confidence
The idea runs with an error command line is too long Shorten command line for...
Activity workflow engine
8 best practices to protect your IAC security!
Skip the test cases to be executed in the unittest framework
kubernetes之ingress探索实践
超详细黑苹果安装图文教程送EFI配置合集及系统
Applymiddleware principle
[AI information monthly] 350 + resources! All the information and trends that can't be missed in June are here! < Download attached >
CVPR 2022 | 基于密度与深度分解的自增强非成对图像去雾
Mingchuang plans to be listed on July 13: the highest issue price is HK $22.1, and the net profit in a single quarter decreases by 19%
Unittest框架中测试用例编写规范以及如何运行测试用例
Export and import of incluxdb on WIN platform
树莓派4B安装tensorflow2.0[通俗易懂]
Oneconnect plans to be listed in Hong Kong on July 4: a loss of nearly 3 billion in two years, with a market capitalization evaporation of more than 90%