当前位置:网站首页>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),客户端要有你实现的代码去节码
边栏推荐
- 印象深刻的bug汇总(持续更新)
- Oracle和JSON的结合
- 提问:测试工程师应该具备哪些职业素养?
- Network security learning notes 01 network security foundation
- Can servers bundled with flask be safely used in production- Is the server bundled with Flask safe to use in production?
- Website source code whole site download website template source code download
- No statements may be issued when any streaming result sets are open and in use on a given connection
- 证券账户销户后果 开户安全吗
- MySQL in and not in() empty list error
- Face detection and recognition system based on mtcnn+facenet
猜你喜欢

妙啊!MarkBERT

Personal mall two open Xiaoyao B2C mall system source code - Commercial Version / group shopping discount seckill source code

Cvpr22 | CMT: efficient combination of CNN and transformer (open source)

Applymiddleware principle

Several cases of index failure

Matrix of numpy

"Target detection" + "visual understanding" to realize the understanding and translation of the input image (with source code)

y48.第三章 Kubernetes从入门到精通 -- Pod的状态和探针(二一)

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

索引失效的几种情况
随机推荐
Flip the array gracefully
Spam filtering challenges
[buuctf.reverse] 144_[XMAN2018排位赛]easyvm
[AI information monthly] 350 + resources! All the information and trends that can't be missed in June are here! < Download attached >
Can servers bundled with flask be safely used in production- Is the server bundled with Flask safe to use in production?
In June 2022, it was the first programming language?!
Win平台下influxDB导出、导入
No statements may be issued when any streaming result sets are open and in use on a given connection
How to make the development of liquidity pledge mining system, case analysis and source code of DAPP defi NFT LP liquidity pledge mining system development
Oracle和JSON的結合
No statements may be issued when any streaming result sets are open and in use on a given connection
LeetCode. 515. Find the maximum value in each tree row___ BFS + DFS + BFS by layer
Node version manager NVM installation and switching
Face detection and recognition system based on mtcnn+facenet
Unittest 框架介绍及第一个demo
Test case writing specification in unittest framework and how to run test cases
今天开户今天能买股票吗?在线开户是很安全么?
Google's new paper Minerva: solving quantitative reasoning problems with language models
Website source code whole site download website template source code download
How to realize the four isolation levels of MySQL (brief)