A Small Victory — Acceleration of BITFIELD Commands for ApsaraDB for Redis

1) Problems

1.1) Principles of Read/Write Splitting

Figure 1: Example of forwarding read and write commands for ApsaraDB for Redis read/write splitting

1.2) BITFIELD Commands

Figure 2: A live Q&A system designed by using Redis bitmaps
BITFIELD key 
[GET type offset] // Obtain the value of the specified bit
[SET type offset value] // Set the value for the specified bit
[INCRBY type offset increment] // Increase the value of the specified bit
[OVERFLOW WRAP|SAT|FAIL] // Control the INCR threshold

1.3) BITFIELD Problems in Read/Write Splitting Instances

2) Ideas and Problem Resolution

2.1) Solutions

2.2) Adding BITFIELD_RO

{"bitfield_ro",bitfieldroCommand,-2,
"read-only fast @bitmap",
0,NULL,1,1,1,0,0,0},
tair-redis > SLAVEOF 127.0.0.1 6379
OK
tair-redis > set k v
(error) READONLY You can't write against a read only replica.
tair-redis > BITFIELD mykey GET u4 0
(error) READONLY You can't write against a read only replica.
tair-redis > BITFIELD_RO mykey GET u4 0
1) (integer) 0

2.3) Forwarding the Proxy

Figure 4: BITFIELD processing logic after the BITFIELD_RO command is added

2.4) Contribution to the Community

Figure 5: Contribution Rankings for Redis 6.0 RC

3) Extension and Discussion

3.1) Summary

3.2) Discussion Questions

Original Source:

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Concept of Feature “Streakes”

How to Obtain Higher Performance from Amazon EBS “gp2” Volumes for SAP HANA

What’s New in MaxCompute 2.0?

API Testing: The Definitive Guide in 2020

Symfony, a Lifelong Friend

Η επένδυσή μας στο Factor[e] Ventures — Autodesk Foundation

AMP for E-Commerce Part 2: Creating Backend with Alibaba Cloud ApsaraDB for MongoDB

3 Key Products That Powered Dongqiudi during the 2018 FIFA World Cup

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Websocket Connection Using Shared Worker

Hands-On with REDIS | Part 2

How to make AssumeRolewithSAML calls with AWS CLI

Architecture Cassandra,Best Practices, Installation Cluster Multi DC With Ansible