In the two descriptions of fflib, fflib is a framework built based on the broker mode. The core component diagram is as follows:
Http://www.cnblogs.com/zhiranok/archive/2012/07/30/fflib_framework.html
Http://www.cnblogs.com/zhiranok/archive/2012/08/08/fflib_tutorial.html
In this case, the obvious bottleneck is that there is only one broker. When the number of client and service nodes increases, a single broker cannot be hosted. So this article will explore how to extend fflib.
In fact, the solution is very direct, that is, adding a broker. To add a broker node for fflib, refer to the master/slave structure in MySQL to design the multi-broker framework of fflib, for example:
When the service calls the Registration Service and interface, only the broker master node is used. The master node synchronizes the registered service and interface information to all slave nodes, all service interfaces and client nodes are connected to slave. Therefore, different services Implement Message forwarding through different slave and load balancing. In addition, the message forwarding overhead is identical to that of a single broker.
Shows the core communication logic of the master and slave nodes:
Summary:
- The Master/Slave Mode is optional, but the broker can still work.
- Source code SVN Co http://ffown.googlecode.com/svn/trunk/
- Build borker: CD example/broker & make
- Enable the broker master (the default is the master):./app_broker-l TCP: // 127.0.0.1: 10241
- Enable brokerslave:./app_broker-l TCP: // 127.0.0.1: 10242-node slave-master_host TCP: // 127.0.0.1: 10241
- Build echo Test Service: CD example/echo_server & make &./app_echo_server
- Construct echo test client: dd example/echo_client & make &./app_echo_client