Redis

Redis is an open-source, in-memory data structure store, often used as a database, cache, and message broker, distinguished by its support for diverse data type...

Redis (Remote Dictionary Server)는 데이터베이스, 캐시 및 메시지 브로커로 사용되는 오픈 소스 인메모리 데이터 구조 스토어입니다. 문자열, 해시, 리스트, 세트, 범위 쿼리가 있는 정렬된 세트, 비트맵, 하이퍼로그로그, 반경 쿼리가 있는 지리 공간 인덱스 및 스트림과 같은 다양한 데이터 구조를 지원합니다. Redis는 주로 메모리에서 작동하여 읽기 및 쓰기 작업에 밀리초 미만의 지연 시간을 허용하므로 속도로 유명합니다. 지속성은 스냅샷팅(RDB) (데이터셋의 시점 스냅샷 저장) 및 모든 쓰기 작업을 기록하는 Append Only File (AOF) (서버에서 수신)을 통해 구성할 수 있습니다. Redis는 모니터링, 알림 및 자동 장애 조치를 제공하는 Redis Sentinel과 데이터를 여러 노드에 샤딩하여 수평 확장성과 고가용성을 제공하는 Redis Cluster를 통해 고가용성 및 내결함성을 제공합니다. 게시/구독 기능은 실시간 메시징 시스템 및 이벤트 기반 아키텍처에 적합합니다. Redis는 세션 관리, 실시간 리더보드, 자주 액세스하는 데이터 캐싱 및 메시지 큐와 같은 사용 사례에 널리 채택되었습니다.

        graph LR
  Center["Redis"]:::main
  Pre_nosql["nosql"]:::pre --> Center
  click Pre_nosql "/terms/nosql"
  Rel_cache["cache"]:::related -.-> Center
  click Rel_cache "/terms/cache"
  Rel_nginx["nginx"]:::related -.-> Center
  click Rel_nginx "/terms/nginx"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧒 5살도 이해할 수 있게 설명

매우 빠른 디지털 포스트잇 보드와 같아서 정보를 빠르게 쓰고 찾을 수 있으며 가장 중요한 메모를 바로 앞에 보관할 수 있습니다.

🤓 Expert Deep Dive

Redis's performance is largely attributed to its single-threaded, event-driven architecture, which efficiently handles I/O multiplexing using mechanisms like epoll or kqueue. While the core operations are single-threaded to ensure atomicity and simplify development, background threads handle I/O and slow operations like disk persistence. Data structures are optimized for in-memory access; for example, hashes are implemented as hash tables, and sorted sets use a combination of hash tables and skip lists. The RDB persistence mechanism involves forking the main process, which can be I/O intensive but provides a compact snapshot. AOF persistence, while more durable, can lead to larger files and slower restarts. Redis Sentinel provides high availability by monitoring master and replica nodes and orchestrating failover. Redis Cluster shards data across multiple nodes, distributing keyspace and providing resilience against node failures, though it introduces complexity in managing distributed transactions and cross-slot operations. Security considerations include network access control (e.g., firewalls, ACLs) and authentication mechanisms.

🔗 관련 용어

선행 지식:

📚 출처