一、 Redis简单介绍

REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统。
Redis是一个开源的使用ANSI C语言编写、遵守BSD协议、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。
它通常被称为数据结构服务器,因为值(value)可以是 字符串(String), 哈希(Hash), 列表(list), 集合(sets) 和 有序集合(sorted sets)等类型。

https://redis.io/

二、 Redis的安装

https://www.cnblogs.com/it-cen/p/4295984.html

https://www.cnblogs.com/peteremperor/p/6635767.html

三、 Redis的简单入门

https://www.cnblogs.com/wxd0108/p/5729739.html

https://blog.csdn.net/u011277123/article/details/78692603/

https://blog.csdn.net/zlc3323/article/details/80836881

https://www.cnblogs.com/mengqingjian/archive/2018/03/02/8491710.html

MSOpenTech Redis 3.2 Release Notes

Welcome to the binary release of Redis from Microsoft Open Technologies, Inc.

- Redis on UNIX release notes: https://raw.githubusercontent.com/antirez/redis/3.2/00-RELEASENOTES

- Redis on Windows release notes: https://raw.githubusercontent.com/MSOpenTech/redis/3.2/Redis%20on%20Windows%20Release%20Notes.md

MSOpenTech’s Redis on Windows

We strive to have a stable, functionally equivalent and comparably performing version of Redis on Windows. We have achieved performance nearly identical to the POSIX version running head-to-head on identical hardware across the network. Aside from feature differences that help Redis take advantage of the Windows infrastructure, our version of Redis should work in most situations with the identical setup and configuration that one would use on a POSIX operating system.

How is Redis on Windows implemented?

Redis is a C code base that compiles under Visual Studio. Most of the code compiles with only minor changes (due to syntactical differences between compilers and low-level API differences on Windows). There are a few areas where there are significant differences in how efficient Windows programs operate relative to POSIX programs. We have encapsulated most these differences in a platform specific library. The areas where there are significant differences are:

  • Networking APIs
  • POSIX File Descriptors
  • POSIX fork()
  • Logging
  • Windows Services API

Networking Differences

The Windows networking stack is split between user mode code and kernel mode code. Transitions between user and kernel mode are expensive operations. The POSIX networking APIs on Windows utilize a programming model that incurs significant performance loss due to the kernel/user mode transitions. Efficient Windows networking code instead uses the IO Completion Port model to reduce the impact of this behavior. The APIs used and the programming model for IO Completion is different enough that we were forced to implement a new networking layer in Redis.

File Descriptors

In a POSIX operating system, all data sources (files, pipes, sockets, mail slots, etc.) are referenced in code with a handle called a file descriptor. These are low value integers that increment by one with each successive file descriptor creation. All POSIX APIs that work with file descriptors will function without the programmer having to know what kind of data source a file descriptor represents. On Windows, each kind of data source has a separate kind of HANDLE. APIs that work with one HANDLE type will not work with another kind of HANDLE. In order to make Redis operate with its assumptions about file descriptor values and data source agnosticism, we implemented a Redis File Descriptor API layer.

fork()

The POSIX version of Redis uses the fork() API. There is no equivalent in Windows, and it is an exceedingly difficult API to completely simulate. For most of the uses of fork() we have used Windows specific programming idioms to bypass the need to use a fork()-like API. The one case where we could not do so was with the point-in-time heap snapshot behavior that the Redis persistence model is based on. We tried several different approaches to work around the need for a fork()-like API, but always ran into significant performance penalties and stability issues.

Our current approach is to simulate the point-in-time snapshot behavior aspect of fork() without doing a complete simulation of fork(). We do this with the system-paging file that contains the Redis heap. When a fork() operation is required we do the following:

  • Mark every page in the heap with the Copy on Write page protection
  • Start a child process and pass it the handle to the heap mapped to the system-paging file
  • Signal the child to start the AOF or RDB persistence process on the memory shared via the system-paging file
  • Wait (asynchronously) for the child process to finish
  • Map the changes in the Redis heap that occurred during the fork() operation back into the parent process heap.

The upside with this implementation is that our performance and stability is now on par with the POSIX version of Redis. The down side is that we have a runtime system-paging file space requirement for Redis. A system-paging file at least of the size of physical memory is suggested.

The default configuration of Windows allows the page file to grow to 3.5 times the size of physical memory.  There are scenarios where 3rd party programs also compete for system paging file space at runtime.

Logging

In addition to file-based logging, the POSIX version of Redis supports logging via the syslog facility. The equivalent in Windows is the Event Log. With the addition of the Windows Service code we have added support for logging to the Event Log. We have mapped the –syslogxxxx flags for this purpose.

Windows Service

In version 2.8.9 we added support to make Redis operate as a service. See the “Windows Service Documentation.docx” file included with the GitHub binary distribution for a description of the service commands available.

Redis on Windows Best Practices

Binary Distributions

The GitHub repository should be considered a work in progress until we release the NuGet and Chocolatey packages and tag the repository at that released version.

For instance, the Windows Service feature has taken many iterations with community input to get right. Since the initial Windows service code was checked we have added the following to the service based on community input:

  • Self-elevation of the Redis executable so that service commands would work from a non-elevated command prompt.
  • Service naming so that multiple instances of the Redis service could be installed on one machine.
  • Automatically adjusting folder permissions so that when Redis is run under the NETWORK SERVICE account it could modify the files in the installation directory.
  • Moved all of the pre-main() error reporting code (service and quasi-fork code) that could write errors to stdout to use the Redis logging code. This allows service initialization errors to reach the Event Log. This required intercepting all of the command line and conf file arguments before main() in order to properly initialize the logging engine. There were several fixes related to the intricacies of how to interpret the arguments passed to Redis.

Heap Sizing

Native heaps are prone to fragmentation. If we are not able to allocate more heap space due to fragmentation, Redis will flag the problem and exit. Unlike the POSIX version of Redis, our heap size is constrained by the system-paging file space. It is important to consider how much data you are expecting to put into Redis, and how much fragmentation you are likely to see in the Redis heap. High levels of fragmentation of the heap may cause to run into an out of heap space. In this case, an increase of the size of the system-paging file may solve the problem.

Installation and Maintenance

Since Redis uses the system-paging file, the most stable configurations will only have Redis running on essentially a virgin operating system install.

Redis is xcopy deployable. There should be no problem upgrading versions by simply copying new binaries over old ones (assuming they are not currently in use).

Service Account

When using Redis as a Windows service, the default installation configures Redis to run under the system’s NETWORK SERVICE account. There are some environments where another account must be used (perhaps a domain service account). Configuration of this account needs to be done manually at this point with the service control manager. If this is done, it is also important to give read/write/create permission to the folder that the Redis executable is in to this user identity.

Redis notes的更多相关文章

  1. django celery redis 定时任务

    0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择.   cele ...

  2. django+celery+redis实现运行定时任务

    0.目的 在开发项目中,经常有一些操作时间比较长(生产环境中超过了nginx的timeout时间),或者是间隔一段时间就要执行的任务. 在这种情况下,使用celery就是一个很好的选择.   cele ...

  3. 从零搭建springboot服务03-redis消息订阅

    愿历尽千帆,归来仍是少年 1.所需依赖 <!-- Redis依赖 --> <dependency> <groupId>org.springframework.boo ...

  4. Redis 5.0.0 releases notes

    Redis 5.0 release notes ======================= ---------------------------------------------------- ...

  5. Redis Cluster Notes

    Redis Cluster Goal:     1. 最大支持1000个节点的高性能.可线性扩展集群:集群架构中无Proxy层,主从间采用异步同步机制(replication),无merge层(不支持 ...

  6. Day12-mysql&&redis

    1. 数据库介绍 什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库,每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据.我们也可以将数 ...

  7. 转载----How fast is Redis?

    How fast is Redis? Redis includes the redis-benchmark utility that simulates running commands done b ...

  8. Redis安装配置与Jedis访问数据库

    一.NOSQL概要 NoSQL(NoSQL = Not Only SQL ),意即“不仅仅是SQL”,泛指非关系型的数据库.NoSQL数据库的四大分类 键值(Key-Value)存储数据库 这一类数据 ...

  9. Redis/SSDB+Twemproxy的配置与使用(Mac/Linux平台)

    对于redis而已,相信不少的后台开发人员一直都在使用,相比memcache而已,redis不仅可以作为key-value缓存使用,而且提供了丰富的数据结构如set.list.map等,能够实现很多复 ...

随机推荐

  1. P1192 台阶问题

    递推问题,要用到递推式: 设f(n)为n个台阶的走法总数,把n个台阶的走法分成k类:第1类:第1步走1阶,剩下还有n-1阶要走,有f(n-1)种方法: 第2类:第1步走2阶,剩下还有n-2阶要走,有f ...

  2. VMWare常用快捷键

    VMWare常用快捷键 Ctrl-Alt-Enter    进入全屏模式 ctrl+alt+insert      退出全屏 Ctrl-Alt            返回正常(窗口)模式 Ctrl-A ...

  3. ACM总结——2017湖南省省赛总结

    2017省赛已经结束了2天了,今天终于有时间,也有勇气来写下这一篇总结.的确,这是我第一次正式的ACM线下赛,我本以为再不济,也可以拿个三等奖,没想到,实力打铁.确实对我打击比较大,以前的确是知道自己 ...

  4. RTP协议全解析(H264码流和PS流)(转)

    源: RTP协议全解析(H264码流和PS流)

  5. No module named scrapy 成功安装scrapy,却无法import的解决方法

    今天本来准备写一个Python的爬虫,然而使用pip安装了Scrapy之后,却无论如何也无法import,显示的结果总是ImportError: No module named Scrapy.网上查阅 ...

  6. Yii1使用Gii生成模块实现CURD

    Yii里Gii的强大就不用说了,可以快速生成模块的Model.Controller来开发.要使用Gii,首先你需要创建好操作的数据表. 第一步:创建数据表 CREATE TABLE `t_knowle ...

  7. 简单了解一下php的迭代生成器yield

    yield是从PHP5.5开始有的,关于yidle的说明鸟哥的博客做了详细说明,我觉得是有点复杂,在看了几篇其他的帖子还有案例,我大概知道yield的作用就是在做大量数据循环处理的时候,能节省很大一部 ...

  8. oracle 18c的版本号规则

    18C之后的版本标识 从2017年7月开始,Oracle改变了以往的数据库软件发布流程,采用年度Release和季度更新的策略. Yearly Release 将之前的N年一发布更改为每年一发布.每年 ...

  9. Android之扫描文件或文件夹

    我们或许经常会遇到这种情况,明明保存了图片,但是当你打开图片时,却没有找到这张图片,手机重启之后才能看到.这是因为SD卡并没有重新挂载,图库也无法把这张图片加载进去,解决这个问题非常简单,只需要我们重 ...

  10. MS08_067漏洞渗透攻击实践

    MS08_067漏洞渗透攻击实践 实验前准备 1.两台虚拟机,其中一台为kali,一台为windows xp sp3(英文版). 2.在VMware中设置两台虚拟机网络为NAT模式,自动分配IP地址, ...