编程知识 cdmana.com

As a java programmer, not even redis? Ali architect takes you to "dissect" redis

Preface

As Java Developers 【Redis】 It's the knowledge you have to master

Redis It is the most widely used storage Middleware in the field of Internet technology , It is 「Remote Dictionary Service」 An acronym for , That is to say 「 Remote Dictionary Service 」.Redis With its ultra-high performance 、 Perfect documentation 、 The simple and easy to understand source code and rich client library support are widely praised in the field of open source middleware .

Many large Internet companies at home and abroad are using Redis, such as Twitter、YouPorn、 Blizzard Entertainment 、Github、StackOverflow、 tencent 、 Ali 、 JD.COM 、 Huawei 、 Sina Weibo and so on , Many small and medium-sized companies also have applications . It can also be said that , Yes Redis At present, the understanding and application practice of middle and advanced back-end developers have become indispensable skills .

This paper is divided into 3 Parts right Redis Conduct “ The anatomy of the ”:

The first part is right Redis A basic introduction is given , And showed some Redis Use example of ;

The second part is right Redis A number of commands of the are described in detail , After that, I also introduced Redis Management operation and use of Redis The way to build more complex applications ;

The third part introduces how to optimize memory 、 Horizontal sectioning and Lua Script this 3 Technology to expand Redis.

If you need to get this 【Redis file 】 Please forward the document and then pay attention to my private reply “666” Get access to it !( More details , So give a rough introduction of the knowledge Redis)

One 、Redis introduction

Introduction : about Redis The description of the database tells only part of the truth ,Redis yes - A very fast non relational database ( non-relational database), It can store keys (key) And 5 Different types of values ( value) Mapping between (mapping), You can persist key value pairs stored in memory to the hard disk , You can use the replication feature to extend read performance , You can also use client slicing to extend write performance , The following sections will introduce Redis These characteristics of .

Redis The table of contents is as follows

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

About Redis Comparison with other databases and software

The following figure shows some of the functions of Redis There are overlapping database servers and cache servers , It can be seen from this table that Redis And the difference between these databases and software .

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

The first part is about the detailed introduction. Because the length of the copy is too long, it is not shown in detail

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

Two 、Redis Core concept of

The previous chapters of this section will delve into the standard Redis command , These include Data operation command and configuration command , And the next few chapters will show how to use Redis Building more complex tools and Applications , And at the end of the day Redis To build a simple social networking site .

Redis The table of contents is as follows

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

2.1.Redis command

  1. String command 、 List commands and set commands
  2. Hash commands and ordered set commands
  3. Publish and subscribe commands
  4. Other commands

2.2. Data security and performance assurance

  1. Persist data to hard disk
  2. Copy data to other machines
  3. Handling system faults
  4. Redis Business
  5. Non transactional pipeline ( non-transactional pipeline )
  6. Diagnose performance problems

2.3. Use Redis Build support

  1. Use Redis Log
  2. Use Redis Implement the counter and make statistics
  3. Inquire about IP The city and country of the address
  4. Service discovery and configuration

2.4. Use Redis Build application components

  1. Build two prefix matching auto completion programs
  2. Improve performance by building distributed locks
  3. Control concurrency by developing counting semaphores
  4. Build two task queues for different purposes
  5. Delay message delivery through message pull system
  6. Learn how to distribute documents

2.5. Search based applications

  1. Use Redis To search
  2. Sort the search results
  3. Achieve advertising orientation
  4. Realize position search

2.6. Build a simple social network

  1. Users and status
  2. Home timeline
  3. List of followers and being followed
  4. Publishing and deleting status messages
  5. flow API

3、 ... and 、Redis Advanced content

The last few chapters will focus on Redis Users often encounter - Some questions to introduce ( Reduce memory usage 、 Expansion performance 、 Use Lua Language for script programming ), And explain how to use conventional technology to solve these problems .

The table of contents is as follows :

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

3.1. Reduce memory usage

Short structure ( short structure )、 Slice structure ( shared structure )、 Package and store binary bits and bytes

This article will introduce 3 A very valuable reduction Redis How to use memory . Reduce Redis Can help reduce the time required to create and load snapshots 、 Lift people AOF File and rewrite AOF Efficiency of documentation 、 Reduce the time required to synchronize from the server ”, And can make Redis Store more data without adding extra hardware .

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

3.2. Expand Redis

Extended read performance 、 Expand write performance and memory capacity 、 Expand complex queries

With Redis More and more , Use only one Redis Sooner or later, the problem that the server can't store all the data or process all the read and write requests will appear , At this point, we need to use some methods to deal with Redis Expand , Let it meet our needs .

The extended performance diagram is as follows :

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

3.3.Redis Of Lua scripting

Don't write C Add new features in case of code 、 Use Lua Override locks and semaphores 、 remove WATCH/MULTI/EXEC Business 、 Use Lua Fragment the list

The previous section describes how to build - Some tools and apply them to existing programs , At the same time, it also introduces - Technologies that can be used to solve all kinds of problems . this - - What Zhang wants to do is similar , And the effect will be better than you think .Redis from 2.6 The version began to attract people Lua Programming language for server-side script programming function , This feature allows users to directly Redis Internal execution of various operations , So as to simplify the code and improve performance .

Redis Of Lua The script is as follows :

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

Redis Practical books

 As Java Programmer company Redis Not at all ? Ali architects take you deep into “ The anatomy of the ”Redis

 

If you need to get this 【Redis file 】 Please forward the document and then pay attention to my private reply “666” Get access to it !( More details , So the knowledge points are roughly introduced )

版权声明
本文为[Java architecture Club]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224231217873s.html

Scroll to Top