Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Redis

Redis 7.0 Release: ฟีเจอร์ใหม่และการปรับปรุง

การปล่อย Redis 7.0 อยู่บนราง และเราเพิ่งเผยแพร่ Second Release Candidate นี้เป็น Planned Milestone ที่ตั้งใจให้ Complete Version's Features แต่มันก็เป็น Opportunity ให้เรา Present Additional Content ใน New Version เช่น Redis Functions Evolved จาก Existing Support สำหรับ Scriptings ที่ Redis มีมาตั้งแต่ Version 2.6 เช่นเดียวกัน ฟีเจอร์ของ Redis อื่นๆ ก็ Evolved

ในธรรมชาติ Evolution เกิดขึ้นสุ่มและ Natural Selection ดูแล Sort Out Results โดยทั่วไปใน Software โดยเฉพาะ Redis กระบวนการนี้เกิดขึ้นย้อนกลับ: We Select Desired Path และ Evolve Project to Follow It Accordingly แทนที่จะปล่อยให้ Randomness Dictate Future Roadmap's Planning และ Execution ของเรา Guided Primarily by Users' Feedback และ New Use Cases ที่ Redis Is a Good Fit

ใน Redis 7.0 Access Control List (ACL) ก็ Stepped Up Evolutionary Ladder ด้วย Introduced in Redis 6.0 ACL Had Reversed Long-time View about Security as Being Out of Project's Scope by Adding Mechanisms to Manage Users and Their Permissions อย่างไรก็ตาม Community ของเรา Quickly Educated Us That While It Was a Step Taken in the Right Direction The Feature Still Lacked Necessary Capabilities

One of the Gaps in ACL Was Already Addressed by Redis 6.2 Namely Controlling the Allowed Patterns of Pub/Sub Channel Names But That Was Only a Partial Stop-gap And It Took Us Longer to Come Up with a Simple and Effective Approach to Address the Remaining Ones

ACL's Original Design Had Only Provisioned for Basic Permission-control Use Cases It Enabled Granting or Denying Access Only to a Single Set of Commands, Keys', and Channels' Names Patterns Per User It Was Impossible, for Example, to Restrict the `SET` Command to One Subset of Keys, and at the Same Time Allow `GET` to Another Subset of Keys for a Given User Effectively, ACL Wasn't an Effective Mechanism for Implementing Security Policies

Redis 7.0's Access Control List, or ACLv2 for Short, Is Compatible with the Original but Adds Two Important Improvements Firstly, ACLv2 Is All About Selectors Secondly, ACLv2 Allows Setting Access Type Permissions to Specific Keys This Capability Makes It Possible to Exclusively Limit the User to Read-only, Write-only, or Read-write Operations to a Subset of the Keys

The Original ACL Design Provided Only One Selector Per User – the Default Selector The Selector Describes the Keys and Channels that the User Can Access, Categories and Commands ACLv2 Allows Adding Any Number of Selectors on Top of the Default that Are Applied in Order This Approach Satisfies the Requirements of More Demanding Security Policies and Brings ACL Nearer to Completeness

The Server's Introspective Abilities Are Another Aspect of Redis that Have Significantly Advanced in Version 7.0 Redis Exposes an API, its Commands' Dictionary, Through Which It Interacts As the Project Evolved the Number of Different Commands (and Their Sub-commands) Grew, Reaching an Excess of 380 in Version 7.0 Because Every Redis Command Is Specialized for Given Tasks Documenting Each Command's Invocation Arguments and Behavior Is a Core Principle of the Project This Documentation Is the Only Contract Between the Server and Its Clients

Historically Commands Were Documented Externally to the Project Itself in a Separate Code Repository We Kept All Documentation in a (Mostly) Human-readable Format Because It Was Intended to Be Read by People This Presented a Challenge for the Machines (or Rather, the People Who Program Machines) Because Translating Prose to Code Is Messy and Brittle Specifically Authors of Clients for Redis Could Only Hope to Keep Their Project Up-to-date by Monitoring Changes to the Documentation and Reading the Release Notes

So, by Version 2.8, We Realized That We Also Needed a Programmatic Way that Allows the Server to Report Its Commands The Aptly-named (but also Tongue-twister) `COMMAND` Command Lists in Runtime the Commands that the Server Supports Furthermore, the `COMMAND GETKEYS` Subcommand Lets Clients Send a Verbatim Command and Its Arguments to Have the Server Extract Any Names of Keys from It Extracting Key Names from a Command Is Required So the Client Can Direct the Operation Correctly in a Clustered Deployment

Partly Driven by ACLv2-related Efforts but Also to Make the Runtime Commands List More Useful for Clients Version 7.0 Overhauls Much of the Internal Mechanisms of the Server's Command Management In Addition We've Enriched the Metadata that the Server Keeps about Each Command Making It Possible to Build Sophisticated Clients that Have (Almost) No A Prior Knowledge about the Server's Capabilities Lastly the Revamped Commands Table Is Built in Such a Way that Redis Modules Can Extend It with Their Respective Commands to Provide the Same Level of Introspection as Core Commands

The New Command Key Specifications Allow Clients to Locally Extract Keys from Verbatim Commands Without Involving the Cluster's Servers Thus Improving Latency and Reducing Network Bandwidth The Metadata about Command Arguments Lets Clients Discover and Adapt to Changes in Commands' Syntax Between Server Versions Clients Can Obtain Even More Information about Executing Commands Under Special Circumstances and Different Deployment Types from the Command Tips

This Effort Also Included the Promotion of Subcommands to First-class Citizens of the Server's Commands Table Originally Subcommands Were Introduced to Redis to Combat the Ever-growing Cardinality of the API The Reasoning Was That Instead of Adding a New Command for Every Task Related Tasks Are Invoked by Calling Just One "Parent" Command The "Parent" Command Accepts as Its First Argument the Name of the Subcommand Which in Turn Dictates the Action Performed From a Technical Standpoint Subcommands Inherited All of Their Parent Command's Traits (e.g., ACL Category, Read/Write Flags, Key Specification, and So Forth) Making It Impossible to Obtain a Fine-grained Distinction Between Their Different Behaviors

For Example the `CLIENT` Command Is a Catch-all Basket for Connection Management Tasks that Boasts No Less than 15 Different Subcommands Some of Its Subcommands, like `CLIENT SETNAME`, Are Routinely Called by Normal Client Connections Whereas Others such as `CLIENT KILL` Have the Potential for Misuse and Should Therefore Be Restricted to Admin Use Alone Earlier Versions of Redis Lacked the Internal Mechanisms that Support Making Such Distinctions Thereby Directing Developers to the Documentation and Creating Confusion In Redis 7.0 However Every Subcommand Has Its Own Set of Traits Regardless of Its Parents or Siblings Allowing for Its Accurate Description

This Post Had Turned Out to Be Quite the Wall of Text that Goes Perhaps into Too Much Technical Detail Towards Its End (If There's Even Such a Thing as Too Much Technical Detail) We Hope It Wasn't All Boring Though and That We've Shed Some Light on the New Version and Its Fit in the Project We're Working on the Final Release Candidate(s) Towards the Version's General Availability but Stay Tuned for Our Next Posts in the Series that Will Continue the New Version's Tour