Decorative image frame

Linux I/O模型与Java NIO

I/O 即Input与Output,包含了文件的读写或者是网络的I/O。在Linux/Unix中有五种I/O模型:

  • blocking I/O
  • nonblocking I/O
  • I/O multiplexing (select and poll)
  • signal driven I/O (SIGIO)
  • asynchronous I/O (the POSIX aio_functions)

Java 从Java SE 1.4开始引入NIO,在Java 7推出了NIO 2。那么,不同的IO模型之间具体有什么差异,又该如何使用呢? Read More...

Redis实现分布式锁

Redis一个比较重要的应用场景就是分布式锁DLM (Distributed Lock Manager)。实际上已经有很多现成的redis库来完成这个功能了,但是可能实现途径有所差别,那么,正确的做法是什么呢?Redis官方建议了一个算法叫做Redlock,可以将其作为起点去实现更复杂的方案,来研究一下它的思路。

Read More...

A brief introduction to MySQL binary log

Accroding to the mysql manual, the binary log( also known as binlog) is a very powerful feature that enables the recording of "events" that describe database changes. Those changes could be table modification or data change, and may also contain some statements which may potentially made changes such as DELETE which no matched items.

This kind of feature enables mysql in replication from master to slave servers by sending events contained in binlogs, and also data recovery. Except for that, it could also be used in CDC(change-data-capture) since it's event based, an example usage could be found in the cdc-component in Eventuate™.

Read More...