High-performance cache service - HANBO (1)

Most of the popular open source caching services are from the hands of old Maozi, and they are closed source at every turn, and they may not be taken back one day.

Chinese people should be self-improvement, if I don't go to hell, who will go to hell. About two years ago, I started the road of no return to invent the wheel. From the first line of code to the present, I iterated countless times, and continued to optimize and refactor, and successfully transformed from toy code to enterprise software.

I remember that every time I had an inspiration, I continued coding until late at night, and was forced to sleep by my wife. It was worth thinking about it.

Closer to home, let's spy on Hanbo's truth together.

Communication layers

Netty started quickly, shielded non-core development, and only optimized some network parameters.

Protocol layer

Fully compatible with redis protocol, can switch to hanbo quickly and smoothly

logic processing layer

Lock-free design, single-threaded processing request instructions, no thread switching

storage layer

Memory file mapping, IO zero delay, theoretically the upper limit of single-machine concurrency is subject to the configuration of the kernel

File system

Binary format, divided into index files and data files, the logical storage unit follows the serialization and deserialization of the TLV method

Persistence strategy

Data is placed on the disk synchronously to ensure that data is not lost

High availability

Supports a master-multiple-slave architecture, supports full and incremental synchronization

Cache capacity

The default is 1GB, if it exceeds, it will automatically expand to twice the original size

data structure

string/list/hash/set, based on fastUtil library to provide high-performance set read and write

Advanced Features

Support transactions, blocking queues, publish-subscribe, multiple db partitions

key hit rule

Pure memory operation, hash table retrieval (actually search binary tree) to get the index object, and then get the value value (essentially based on subscript reading directbuffer)

Time is limited. In the next article, I will focus on dismantling the internal implementation and core code.

{{o.name}}
{{m.name}}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324129383&siteId=291194637