Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Redis

RediSearch 2.0: Tìm kiếm Real-Time Next-Gen cho Redis

RediSearch, real-time secondary index với full-text search capability cho Redis, là một trong những Redis module mature và feature-rich nhất. Cũng ngày càng popular — vài tháng qua RediSearch Docker pulls tăng 500%! Sự phổ biến đó dẫn đến customer提出 nhiều use case thú vị từ real-time inventory management đến ephemeral search.

Để extend momentum, giới thiệu public preview RediSearch 2.0, thiết kế cải thiện developer experience và là phiên bản RediSearch scalable nhất. RediSearch 2.0 hỗ trợ Redis Active-Active geo-distribution technology, scalable không downtime, bao gồm Redis on Flash support (private preview). Để đạt mục tiêu không ảnh hưởng performance, tạo kiến trúc mới hoàn toàn cho RediSearch 2.0 — và nó worked: RediSearch 2.0 nhanh 2.4x so với RediSearch 1.6.

Bên trong kiến trúc mới RediSearch 2.0

Có rich query-and-aggregation engine trong Redis database cho phép nhiều use case mới vượt caching. RediSearch cho phép dùng Redis làm primary database khi cần truy cập dữ liệu bằng complex query. Tốt hơn, bảo toàn speed, reliability, scalability world-class của Redis, không yêu cầu thêm complexity vào code để update và index dữ liệu.

Cho RediSearch 2.0, re-architect cách index sync với data. Thay vì write data through index (dùng FT.ADD), RediSearch giờ follow data viết trong hash và synchronously index nó. Re-architecture này đi kèm vài thay đổi API, thảo luận bài trước khi RediSearch 2.0 Hit Its First Milestone.

RediSearch 2.0: Tìm kiếm Real-Time Next-Gen cho Redis

Kiến trúc mới mang 2 lợi ích chính. Thứ nhất, dễ dàng hơn bao giờ tạo secondary index trên existing data. Chỉ thêm RediSearch vào Redis database hiện có, tạo index, và bắt đầu query, không cần migrate data hoặc dùng lệnh mới thêm data vào index. Giảm drastically learning curve cho user RediSearch mới và cho phép tạo index trên Redis database hiện có — không cần restart.

Thứ hai, lấy index ra khỏi keyspace. Cho phép Redis Enterprise Active-Active technology dựa trên CRDTs. Merge hai inverted index conflict-free khó, nhưng Redis đã có proven CRDTs implementation của Hashes. Vì vậy lợi ích lớn thứ hai: kiến trúc mới làm RediSearch 2.0 scalable hơn. Vì RediSearch follow Hashes và index moved out of keyspace, giờ chạy RediSearch trong Active-Active geo-distributed database.

RediSearch 2.0: Tìm kiếm Real-Time Next-Gen cho Redis

Document replicate đến all database trong replication set theo strongly eventual consistent manner. Trong mỗi replica, RediSearch follow tất cả update trên Hashes, nghĩa là tất cả index cũng strongly eventual consistent.

OSS cluster support cho open source Redis

Không muốn giới hạn scalability chỉ cho Redis Enterprise user, thêm support scale single index qua multiple shards với open source Redis cluster API. Trước đây, single RediSearch index và documents phải ở single shard. Nghĩa là dataset size và throughput OSS Redis bound bởi single Redis process. Redis Enterprise phân phối document trong clustered database và aggregate kết quả query time. Fan-out và aggregation handled bởi component "coordinator" giờ cũng publicly available dưới Redis Source Available License để work với open source Redis cluster cũng như Redis Enterprise. Kết quả: phiên bản RediSearch scalable nhất.

Cho thấy con số!

Đánh giá ingestion performance RediSearch 2.0, extend full-text search benchmark (FTSB) suite với NYC Taxi dataset public. Dataset này dùng across industry nhờ rich data types (text, tag, geographic, numeric), và large number of documents.

Benchmark focus write performance, dùng trip-record data yellow cab NYC. Cụ thể benchmark dùng dataset tháng 1/2015, load >12 triệu document, average size 500 bytes/document. Full benchmark spec tham khảo FTSB trên GitHub.

Tất cả benchmark variations chạy trên AWS instances, provisioned qua benchmark-testing infrastructure. Test executed trên 3-node cluster 15 shards, RediSearch Enterprise 1.6 và 2.0. Cả benchmark client và 3 node database RediSearch enabled chạy trên c5.9xlarge instances riêng.

Vì RediSearch 2.0 có ability follow changes in Hashes và auto-index, thêm variants cho FT.ADD và HSET. Để upgrade dễ dàng, remap deprecated FT.ADD command sang HSET commands trong RediSearch 2.0. Hai chart dưới hiển thị overall ingestion rate và latency cho cả RediSearch 1.6 và 2.0, giữ sub-millisecond latencies.

RediSearch 2.0: Tìm kiếm Real-Time Next-Gen cho Redis

RediSearch 2.0: Tìm kiếm Real-Time Next-Gen cho Redis

RediSearch luôn nhanh, nhưng với architectural change, từ indexing 96K docs/sec lên 132K docs/sec ở overall p50 ingestion latency 0.4ms, cải thiện drastically write scaling.

Không chỉ benefit từ throughput boost, mà mỗi ingestion cũng nhanh hơn. Bên cạnh overall ingestion improvement do architecture change, giờ cũng rely OSS Redis Cluster API capabilities để linearly scale ingestion search database.

Kết hợp throughput và latency improvement, RediSearch 2.0 deliver up to 2.4X speedup so với RediSearch 1.6.

Tiếp theo cho RediSearch 2.0

Tóm lại, RediSearch 2.0 là phiên bản nhanh nhất và scalable nhất cho tất cả Redis user chúng tôi từng phát hành. Thêm vào đó, kiến trúc mới RediSearch 2.0 cải thiện developer experience tạo index cho existing data trong Redis seamless và loại bỏ migrate Redis data sang database RediSearch-enabled khác. Kiến trúc mới cho phép RediSearch follow và auto-index cấu trúc dữ liệu khác như Streams hoặc Strings. Trong releases sắp tới, cho phép làm việc với additional data structures như nested data structure trong RedisJSON.

Kế hoạch thêm feature hơn nữa enhance developer experience. Tiếp theo, look for command mới cho phép profile search queries để hiểu performance bottlenecks trong query execution.

Sẵn sàng bắt đầu? Check out Tug Grall blog … Getting Started with RediSearch 2.0! Làm theo steps tutorial GitHub hoặc tạo free database Redis Enterprise Cloud Essentials. (Lưu ý public preview RediSearch 2.0 available ở 2 region Redis Enterprise Cloud Essentials: Mumbai và Oregon.)