当前位置:网站首页>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),客户端要有你实现的代码去节码
边栏推荐
- escape sequence
- ES6 Promise用法小结
- When is testing not unit testing- When is a Test not a Unit-test?
- Flip the array gracefully
- 全局过滤器(处理时间格式)
- 京东与腾讯续签合作:向腾讯发行A类股 价值最高达2.2亿美元
- Combinaison Oracle et json
- 金鱼哥RHCA回忆录:DO447使用Ansible与API通信--使用Ansible Tower API启动作业
- Personal mall two open Xiaoyao B2C mall system source code - Commercial Version / group shopping discount seckill source code
- Oracle和JSON的结合
猜你喜欢
CVPR22 |CMT:CNN和Transformer的高效结合(开源)
Spam filtering challenges
applyMiddleware 原理
“目标检测”+“视觉理解”实现对输入图像的理解及翻译(附源代码)
Combination of Oracle and JSON
2022年6月编程语言排行,第一名居然是它?!
Ten years of sharpening a sword: unveiling the secrets of ant group's observability platform antmonitor
Numpy的矩阵
Google's new paper Minerva: solving quantitative reasoning problems with language models
Database experiment report (I)
随机推荐
关于Keil编译程序出现“File has been changed outside the editor,reload?”的解决方法
CVPR 2022 | 基于密度与深度分解的自增强非成对图像去雾
MySQL IN 和 NOT IN () 空列表报错
持续交付-Pipeline入门
When is testing not unit testing- When is a Test not a Unit-test?
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%
Web foundation of network security note 02
China's cellular Internet of things users have reached 1.59 billion, and are expected to surpass mobile phone users within this year
Yoda unified data application -- Exploration and practice of fusion computing in ant risk scenarios
证券账户销户后果 开户安全吗
Exposure:A White-Box Photo Post-Processing Framework阅读札记
Shangtang entered the lifting period: the core management voluntarily banned and strengthened the company's long-term value confidence
How to realize the four isolation levels of MySQL (brief)
今天开户今天能买股票吗?在线开户是很安全么?
Intel Labs annonce de nouveaux progrès en photonique intégrée
为什么一定要从DevOps走向BizDevOps?
8 best practices to protect your IAC security!
Matrix of numpy
Can servers bundled with flask be safely used in production- Is the server bundled with Flask safe to use in production?
CVPR 2022 | Virtual Correspondence: Humans as a Cue for Extreme-View Geometry