【Redis】Why is an Event Library needed at all?
来源:互联网 发布:阿里云最便宜的主机 编辑:程序博客网 时间:2024/06/06 18:28
Let us figure it out through a series of Q&As.
Q: What do you expect a network server to be doing all the time?
A: Watch for inbound connections on the port its listening and accept them.
Q: Calling accept yields a descriptor. What do I do with it?
A: Save the descriptor and do a non-blocking read/write operation on it.
Q: Why does the read/write have to be non-blocking?
A: If the file operation ( even a socket in Unix is a file ) is blocking how could the server for example accept other connection requests when its blocked in a file I/O operation.
Q: I guess I have to do many such non-blocking operations on the socket to see when it's ready. Am I right?
A: Yes. That is what an event library does for you. Now you get it.
Q: How do Event Libraries do what they do?
A: They use the operating system's polling facility along with timers.
Q: So are there any open source event libraries that do what you just described?
A: Yes. libevent
and libev
are two such event libraries that I can recall off the top of my head.
Q: Does Redis use such open source event libraries for handling socket I/O?
A: No. For various reasons Redis uses its own event library.
- 【Redis】Why is an Event Library needed at all?
- why mutli volumes is needed
- Why is a different operating system needed?
- Why is volatile needed in c?
- SCSI:Why Auto contingent allegiance is needed?
- Why is XML such an important development?
- libevent – an event notification library
- What is the GlobalSuppressions.cs/GlobalSuppressions.vb file and why is it needed
- redis源代码分析 – event library
- why the redo log is not needed to backup in the RMAN backup?
- Why is XKeysymToKeycode() making all of my keys lowercase?
- Expat is an XML parser library
- Why is the size of an empty class not zero?
- Why is the size of an empty class not zero?
- Why do we say English is important for an DBA.
- Why is the size of an empty class not zero?
- why string is immutable and why all wrapper class are immutable?
- why request event is fired before data event in http modlues of node.js.
- 实验4-2 逻辑表达式
- 某个操作挂起-避免安装SQL,Server时出现的“某个操作挂起”需要重启的提示
- LINUX主要目录及内容
- 8款最新流行的jquery插件
- Android 开发指南 翻译3:User Interface: Input Events
- 【Redis】Why is an Event Library needed at all?
- 用命令行删除指定文件夹下面的所有文件(如果里面没有子文件夹)
- C++ Dll 导出函数头文件
- 实验4-3 if结构的初步
- android 判断有没有和服务器连接上
- 实验4-4 if结构的分析
- slab alloc内存分配机制
- Struts2为应用指定多个配置文件和动态方法调用以及通配符的使用方法
- eclipse.ini配置