Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
caopu16
whatsmars
提交
2ec8edf8
W
whatsmars
项目概览
caopu16
/
whatsmars
与 Fork 源项目一致
Fork自
武汉红喜 / whatsmars
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ec8edf8
编写于
9月 19, 2018
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
..
上级
291edfbd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
13 deletion
+14
-13
whatsmars-redis/README.md
whatsmars-redis/README.md
+14
-13
未找到文件。
whatsmars-redis/README.md
浏览文件 @
2ec8edf8
...
...
@@ -3,28 +3,29 @@ Redis is an in-memory database that persists on disk. The data model is key-valu
but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets,
Hashes, HyperLogLogs, Bitmaps. https://redis.io http://redis.net.cn
### Jedis连接方式
![
jedis
](
jedis.png
)
### 基于M-S模式下读写分离
通常情况下,Slave只是作为数据备份,不提供read操作,这种考虑是为了避免slave提供stale数据而导致一些问题。
不过在很多场景下,即使slave数据有一定的延迟,我们仍然可以兼容或者正常处理,此时我们可以将slave提供read
服务,并在M-S集群中将read操作分流,此时我们的Redis集群将可以支撑更高的QPS。本实例中,仅仅提供了“读写分
离”的样板,尚未对所有的redis方法进行重写和封装,请开发者后续继续补充即可。此外,slave节点如果异常,我们
应该支持failover,这一部分特性后续再扩展。
### Spring Data Redis & Redis集群方案
### Spring Data Redis & Jedis/Lettuce
-
Spring Data’s mission is to provide a familiar and consistent, Spring-based programming model
for data access while still retaining the special traits of the underlying data store.
-
SDR对Redis的标准模式和Cluster模式进行了充分封装,但并未对客户端sharding进行良好封装,需要开发者自己实现,
这也是SDR和
[
Jedis
](
https://github.com/xetorthio/jedis
)
相比,唯一缺少的特性。另外,Redis官网给出了一个
Redis的Java客户端列表,SDR支持Jedis,
[
Lettuce
](
https://github.com/lettuce-io/lettuce-core
)
[
'lɛtɪs
]
,
Spring Boot 2.x默认使用Lettuce。
-
早期Redis还没有Cluster特性,实践中广泛采用的集群方案是客户端分片与
[
Twemproxy
](
https://github.com/twitter/twemproxy
)
/
[
Codis
](
https://github.com/CodisLabs/codis
)
代理,事实上目前官方Cluster方案还有一些未解决或无法避免的问题。
-
Jedis实例是线程不安全的,在多线程的环境下,需要使用连接池,每个线程都使用自己的Jedis实例,当连接数增多时,
会消耗较多的物理资源。而Lettuce基于Netty,是一个可伸缩的线程安全的Redis客户端,支持同步、异步和响应式模式。
-
Jedis相比Lettuce和
[
Redission
](
https://github.com/redisson/redisson
)
,最大的特点是简单易集成,这从源代码量就可感受到。
-
Jedis连接方式如图 !
[
jedis
](
jedis.png
)
### Redis集群方案
-
早期Redis还没有Cluster特性,而目前官方Cluster方案还有一些未解决或无法避免的问题,实践中广泛采用的集群方案仍然是客户端分片与
[
Twemproxy
](
https://github.com/twitter/twemproxy
)
/
[
Codis
](
https://github.com/CodisLabs/codis
)
代理,少数公司还有一些
自研内存存储方案,如京东的JIMDB。
### 基于M-S模式下读写分离
通常情况下,Slave只是作为数据备份,不提供read操作,这种考虑是为了避免slave提供stale数据而导致一些问题。
不过在很多场景下,即使slave数据有一定的延迟,我们仍然可以兼容或者正常处理,此时我们可以将slave提供read
服务,并在M-S集群中将read操作分流,此时我们的Redis集群将可以支撑更高的QPS。本实例中,仅仅提供了“读写分
离”的样板,尚未对所有的redis方法进行重写和封装,请开发者后续继续补充即可。此外,slave节点如果异常,我们
应该支持failover,这一部分特性后续再扩展。
### Thread or epoll
MySQL为什么使用线程的模型而不是epoll之类的技术?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录