BUILDING NOTIFICATION, FEEDINGSYSTEM USE NODE.JS + REDIS                        Lê Việt Đức                        19/04/2...
Content•   Intro•   Design Systems•   Redis Replication•   Demo•   Discussion
Solution 1                                 1 node.js thread: ~ 1000 CCU    Client 1                                       ...
Node.js Scriptclient1 = redis.createClient(6379,117.103.196.26); client1.subscribe("notify"); client1.on("message", functi...
Server Script (PHP) $notify_server = array(    host=>117.103.196.20,      port => 6381,     database => 3 ); $Redis_notify...
Solution 2                                             Re                                                dis              ...
Solution 3                                             Redis->subcribe  Client 1                                          ...
Redis ReplicationRedis replication is a very simple to use and configure master-slave replicationthat allows slave Redis s...
Redis Replication•A master can have multiple slaves.•Slaves are able to accept other slaves connections.•Redis replication...
Configuration   slaveof 192.168.1.1 6379   masterauth <password>
Solution 4                                              Redis->subcribe  Client 1                           Node.js Server...
Discussion
QUESTIONS?
Upcoming SlideShare
Loading in...5
×

Building notification system in NodeJS + Redis

4,789

Published on

Published in: Technology
0 Comments
12 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,789
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
12
Embeds 0
No embeds

No notes for slide
  • This template can be used as a starter file for presenting training materials in a group setting. Sections Right-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors. Notes Use the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production) Coordinated colors Pay particular attention to the graphs, charts, and text boxes. Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale. Graphics, tables, and graphs Keep it simple: If possible, use consistent, non-distracting styles and colors. Label all graphs and tables.
  • Give a brief overview of the presentation. Describe the major focus of the presentation and why it is important. Introduce each of the major topics. To provide a road map for the audience, you can repeat this Overview slide throughout the presentation, highlighting the particular topic you will discuss next.
  • This is another option for an Overview slides using transitions.
  • Add slides to each topic section as necessary, including slides with tables, graphs, and images. See next section for sample table, graph, image, and video layouts.
  • This is another option for an Overview slide.
  • What will the audience be able to do after this training is complete? Briefly describe each objective how the audience will benefit from this presentation.
  • Microsoft Engineering Excellence Microsoft Confidential
  • Use a section header for each of the topics, so there is a clear transition to the audience.
  • Microsoft Engineering Excellence Microsoft Confidential
  • Building notification system in NodeJS + Redis

    1. 1. BUILDING NOTIFICATION, FEEDINGSYSTEM USE NODE.JS + REDIS Lê Việt Đức 19/04/2012
    2. 2. Content• Intro• Design Systems• Redis Replication• Demo• Discussion
    3. 3. Solution 1 1 node.js thread: ~ 1000 CCU Client 1 Redis->subcribe Play.go.vn Client 2 Redis Server Application Server Node.js Server Client n
    4. 4. Node.js Scriptclient1 = redis.createClient(6379,117.103.196.26); client1.subscribe("notify"); client1.on("message", function (channel, message) { var objmsg = eval(message); nowjs.getGroup(channel).now.receiveNotifyPlaying(objmsg.clientId,ob jmsg.userid,objmsg.name,objmsg.room_notify,objmsg.app_title,objms g.app_url,objmsg.action_title); });
    5. 5. Server Script (PHP) $notify_server = array( host=>117.103.196.20, port => 6381, database => 3 ); $Redis_notify = new Predis_Client($notify_server); $msg = ({"clientId":".time().","userid":".$userid.","name":". $displayname.","room_notify":"notify","app_title":". $title.","app_url":".$link.","action_title":".$action_title."}); $rt = $Redis_notify->publish(array(notify,$msg));
    6. 6. Solution 2 Re dis ->s ub cri be Client 1 Node.js Server Redis->publish() Play.go.vn Client 2 Node.js Server Redis Server Application Server Client n Node.js Server
    7. 7. Solution 3 Redis->subcribe Client 1 Redis Server Node.js Server Redis->subcribe Redis->publish() Play.go.vn Client 2 Node.js Server Redis Server Application Server Client n Node.js Server Redis Server
    8. 8. Redis ReplicationRedis replication is a very simple to use and configure master-slave replicationthat allows slave Redis servers to be exact copies of master servers
    9. 9. Redis Replication•A master can have multiple slaves.•Slaves are able to accept other slaves connections.•Redis replication is non-blocking on the master side, this means that the master willcontinue to serve queries when one or more slaves perform the first synchronization.•Replication is non blocking on the slave side: while the slave is performing the firstsynchronization it can reply to queries using the old version of the data set, assuming youconfigured Redis to do so in redis.conf.•Replications can be used both for scalability, in order to have multiple slaves for read-onlyqueries.
    10. 10. Configuration slaveof 192.168.1.1 6379 masterauth <password>
    11. 11. Solution 4 Redis->subcribe Client 1 Node.js Server Redis Slave Server Redis->subcribe Play.go.vn Redis->publish() Client 2 Node.js Server Redis Slave Server Redis Master Server Application Server Redis Slave Server Client n Node.js Server
    12. 12. Discussion
    13. 13. QUESTIONS?

    ×