[node.js] Redis의 Event-Driven Programming / Web Socket 관련

Hyo Kyun Lee·2021년 8월 11일
0

node.js

목록 보기
34/34

1. Redis 개념 / Event-Driven Programming

비관계형으로 데이터베이스를 관리하는 시스템

Redis는 javascript와 같은 Event Driven 형식의 실행구조로 되어 있다.

즉 Redis server는 Cache memory를 이용하여 데이터를 잠시 저장하고,
특정 API 및 Pub/Sub 등 Event 및 특정 logic을 통해 data를 활용한다.

위와 같은 구조로 되어있어 Event-Driven Programming이라 하며,
javscript 동작과 같이 싱글스레드로 해당 Event를 처리하는 구조이다.

2. Socket

OSI 7 Layer 중 Application layer에서 전송되는 데이터를 Socket이라 하며,
Clinet와 Server 간 서로 의사소통을 위한 하나의 통신체계이다.

redis에서 활용하는 Socket은, redis가 하나의 server가 되어 client의 요청에 대해 응답하고
data를 전달해주는 체계로 생각하면 된다.

redis를 node.js에서 프로그래밍할 때 data를 socket.io라는 객체를 통해 전달하며, 기본적으로 in memory 구조이기 때문에 data를 저장할 수 있다(단, 휘발성임).

3. 참조링크

Redis Event driven
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=tmondev&logNo=220549729962
https://dev.to/felixvo/event-sourcing-with-go-and-redis-56ba

Redis and Websocket
https://github.com/PradeepJaiswar/event-based-service-example

Redis ruuning based on events
https://docs.servicestack.net/redis-server-events
https://joeywhelan.blogspot.com/2019/03/event-sourcing-with-redis-streams.html

Socket
https://sysgongbu.tistory.com/111

0개의 댓글