How socket.io-redis adapter works? 레디스 어댑터 동작원리

보통 실시간 메시징 처리에 socket.io와 redis를 많이 사용하는데, 그 동작 메커니즘이 자세히 소개된 글을 찾기 어려웠다. 이유는 간단한데, 소스코드가 그냥 간단해서 글로 쓰고 자시고 건더기도 없어 그런듯. 

기본적으로 socket.io는 Server, Namespace, Room, 그리고 Socket으로 구성되어있고 멀티 노드를 위해 pluggable 디자인 방식으로 Adapter라는 것이 존재한다. 

Default In-Memory 방식은 배열에 socket과 room 정보를 저장하기 때문에 웹 서버에 붙어있는 clients 외 에는 알 길이 없다. 이때 redis adapter를 사용하면 다음과 같이 동작하는데, sender가 원격에서 넘어왔다면 그냥 내 로컬 clients에게 deliver하는 것으로 종료하고 그렇지 않으면, 다른 노드에게 publish하여 메시지를 전달한다. 


분산 인프라 치고는 놀랍게도 Javascript 몇 줄 안되는 소스코드로 node, socket.io, 그리고 redis가 동작한다. 좀 이해하기 쉽게 도식화하면 다음과 같다:


24 comments:


  1. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
    iot course training in Hyderabad

    ReplyDelete
  2. I feel extremely glad to have seen your site page and anticipate such a large number of additionally engaging occasions perusing here. Much obliged again for all the subtleties.
    https://360digitmg.com/course/certification-program-in-iot

    ReplyDelete
  3. Your music is amazing. You have some very talented artists. I wish you the best of success.
    Best Data Science Courses in Hyderabad

    ReplyDelete
  4. Your work is very good and I appreciate you and hopping for one of the finest sites on the internet. I will recommend this web site 토토사이트

    ReplyDelete
  5. You obviously know what youre talking about Guess I will just bookmark this site. 토토

    ReplyDelete
  6. my own blog and would like to find out where u got this from. Your post has really helped me a lot. 안전놀이터

    ReplyDelete
  7. A good blog always comes-up with new and exciting information and while reading I have felt that this blog really has all those qualities that qualify a blog to be a one.

    Best Data Science courses in Hyderabad

    ReplyDelete
  8. if you are the registered employee or an authorized associate working for one of the largest nba중계

    ReplyDelete
  9. employee or an authorized associate working for one of the largest 먹튀검증

    ReplyDelete
  10. back every day. It’s great to have a place like this. I’ll come often. Great work! 경마사이트

    ReplyDelete
  11. You made some good points there. I did a Google search about the topic and found most people will believe your blog. 메이저사이트


    ReplyDelete
  12. That's a great article! The neatly organized content is good to see. Can I quote a blog and write it on my blog? My blog has a variety of communities including these articles. Would you like to visit me later? 토토사이트추천


    ReplyDelete
  13. What a nice post! I'm so happy to read this. 안전놀이터모음 What you wrote was very helpful to me. Thank you. Actually, I run a site similar to you. If you have time, could you visit my site? Please leave your comments after reading what I wrote. If you do so, I will actively reflect your opinion. I think it will be a great help to run my site. Have a good day.


    ReplyDelete
  14. This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Best Impact Socket Adapters

    ReplyDelete
  15. Oh, the data you've shared in this incredible article is just magnificent. I am definitely going to make more use of this data in my future projects. You must continue sharing more data like this with us. 메이저놀이터


    ReplyDelete
  16. Your skill is great. I am so grateful that I am able to do a lot of work thanks to your technology.메이저사이트 I hope you keep improving this technology.


    ReplyDelete
  17. 메이저사이트14/11/21 00:42

    is one very interesting post. 메이저사이트I like the way you write and I will bookmark your blog to my favorites.


    ReplyDelete
  18. 안전놀이터17/11/21 23:38

    Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked. Please also seek advice from my site =). We could have a hyperlink change contract between us 안전놀이터


    ReplyDelete
  19. 안전놀이터24/11/21 23:18

    Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. 안전놀이터


    ReplyDelete
  20. 오공슬롯9/12/21 00:12

    I was looking for another article by chance and found your article오공슬롯 I am writing on this topic, so I think it will help a lot. I leave my blog address below. Please visit once.


    ReplyDelete
  21. 먹튀검증27/5/22 01:39

    I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article :D 먹튀검증


    ReplyDelete