Categories


Loading feed
Loading feed
Loading feed

Rob Young: Non-blocking I/O With PHP-MIO


Rob Young recently posted on his blog an interesting article on non-blocking I/O in PHP. He gives a pretty good explanation of what multiplexed I/O is and why you may or may not want to use it.

Before I go any further I suppose I should explain exactly what multiplexed (or non-blocking) I/O actually is. When reading from or writing to a stream PHP usually blocks until the operation is complete, however, a stream’s blocking mode can be set such that operations on streams don’t block and instead return immediately. Used correctly this technique can vastly improve performance in networked applications. This comes at the price of increased complexity and some would argue a more confusing program flow. For this reason I wouldn’t suggest it for trivial applications.

Rob goes on to give a very nice tutorial on how to use his new package, phpmio.

This isn’t really a beginner’s guide. If you are not familiar with sockets, streams and all the terminology he uses, you may want to just keep moving. However, for those working in this area, this is a great article and interesting project.

Comments


Monday, April 23, 2007
LINK TO THE ARTICLE?
7:51PM PDT · borfast
FIXED
8:45PM PDT · Cal Evans (editor)