Hi everybody good last two chapters introduced the NAMESRV start and the registration process, has what is wrong place to welcome everybody to vomit the trough, then starts analyzes the broker bar
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6B/80/wKioL1UvaO-y9NPAAAHjYRrPpLA464.jpg "title=" 1.jpg " alt= "Wkiol1uvao-y9npaaahjyrrppla464.jpg"/>
There are some places that can't be painted. Look at the details by analysis.
1,Createbrokercontroller
System.setproperty (Remotingcommand.remotingversionkey, integer.tostring (mqversion.currentversion));
Socket send buffer size
if (null = = System.getproperty (nettysystemconfig.systempropertysocketsndbufsize)) {
Nettysystemconfig.socketsndbufsize = 131072;
}
Default Send buffer size 128M
Socket Receive Buffer size
if (null = = System.getproperty (nettysystemconfig.systempropertysocketrcvbufsize)) {
Nettysystemconfig.socketrcvbufsize = 131072;
}
Default Receive buffer size 128M
Packet Collision Detection
Packageconflictdetect.detectfastjson ();
Parsing the command line
Options options = serverutil.buildcommandlineoptions (new options ());
CommandLine = Serverutil.parsecmdline ("Mqbroker", args, buildcommandlineoptions (options),
New Posixparser ());
if (null = = CommandLine) {
System.exit (-1);
return null;
}
2,final brokerconfig brokerconfig = new Brokerconfig ();
Private String Rocketmqhome = System.getproperty (Mixall.rocketmq_home_property,
System.getenv (mixall.rocketmq_home_env));
Get ROCKETMQ Directory
@ImportantField
Private String namesrvaddr = System.getproperty (Mixall.namesrv_addr_property,
System.getenv (mixall.namesrv_addr_env));
Get NAMESRC Address
@ImportantField
Private String brokerIP1 = Remotingutil.getlocaladdress ();
Get Local Address
Private String brokerIP2 = Remotingutil.getlocaladdress ();
Get Local Address
@ImportantField
Private String Brokername = Localhostname ();
Get broker hostname
@ImportantField
Private String Brokerclustername = "Defaultcluster";
Default Cluster Name
@ImportantField
Private long Brokerid = mixall.master_id;
The master cluster ID must be 0
private int brokerpermission = Permname.perm_read | Permname.perm_write;
Broker permissions default Read and write
private int defaulttopicqueuenums = 8;
Default number of queues
Automatic creation of the topic feature is turned on (online recommended off)
@ImportantField
Private Boolean autocreatetopicenable = true;
Automatically create a topic feature named after the cluster is turned on
Private Boolean clustertopicenable = true;
Automatically create a topic feature named after the server is turned on
Private Boolean brokertopicenable = true;
Automatically create a subscription group feature is turned on (online suggestion off)
@ImportantField
Private Boolean autocreatesubscriptiongroup = true;
private int sendmessagethreadpoolnums = + runtime.getruntime (). Availableprocessors () * 4;
Number of message thread pools sent
private int pullmessagethreadpoolnums = + runtime.getruntime (). Availableprocessors () * 2;
Number of subscription message thread pools
private int adminbrokerthreadpoolnums = 16;
Adminbroker thread pool number separate thread pool for thread pool isolation
private int clientmanagethreadpoolnums = 16;
Number of Clientmanage thread pools
private int flushconsumeroffsetinterval = 1000 * 5;
Flush consumer file offset timestamp default 5 seconds
private int flushconsumeroffsethistoryinterval = 1000 * 60;
Flush Consumer History File offset timestamp default 1
Whether to refuse to receive transaction messages
@ImportantField
Private Boolean rejecttransactionmessage = false;
Whether to look for the name server address from the address server, the default value is false after the official publication
@ImportantField
Private Boolean fetchnamesrvaddrbyaddressserver = false;
Send message corresponding thread pool block queue Size
private int sendthreadpoolqueuecapacity = 100000;
The thread pool that the subscription message corresponds to blocks the queue size
private int pullthreadpoolqueuecapacity = 100000;
Number of filter servers
private int filterservernums = 0;
Consumer whether the broker turns on long polling when subscribing to a message
Private Boolean longpollingenable = true;
If it is a short poll, the server hangs the time
Private long shortpollingtimemills = 1000;
Notify Consumerid changed switch
Private Boolean notifyconsumeridschangedenable = true;
Slave if corrective sites are needed
Private Boolean offsetcheckinslave = false;
3,final nettyserverconfig nettyserverconfig = new Nettyserverconfig ();
Netty Service Configuration
private int listenport = 8888; Listening port
private int serverworkerthreads = 8; Netty Number of service worker threads
private int servercallbackexecutorthreads = 0; Netty Service Async callback thread pool threads number
private int serverselectorthreads = 3; Netty Selector Number of threads
private int serveronewaysemaphorevalue = 256; control one-way semaphore the request is not responding at one time
private int serverasyncsemaphorevalue = 64; control asynchronous semaphore
private int serverchannelmaxidletimeseconds = 120; service Idle heartbeat detection interval unit seconds
private int serversocketsndbufsize = Nettysystemconfig.socketsndbufsize;
Netty Send buffer size
private int serversocketrcvbufsize = Nettysystemconfig.socketrcvbufsize;
Netty Accept Buffer Size
Private Boolean serverpooledbytebufallocatorenable = false; use Netty memory pool
4,final nettyclientconfig nettyclientconfig = new Nettyclientconfig ();
private int clientworkerthreads = 4; Netty Client worker Threads
private int clientcallbackexecutorthreads = Runtime.getruntime (). Availableprocessors ();
Netty Service Async callback thread pool threads number
private int clientonewaysemaphorevalue = Nettysystemconfig.clientonewaysemaphorevalue;
Control one-way semaphore the request is not responding at one time
private int clientasyncsemaphorevalue = Nettysystemconfig.clientasyncsemaphorevalue;
Controlling the amount of asynchronous semaphores
Private long Connecttimeoutmillis = 3000;
Connection time-out period
Private Long Channelnotactiveinterval = 1000 * 60;
Scan Channel inactive timestamp
private int clientchannelmaxidletimeseconds = 120;
Client idle heartbeat detection interval unit seconds
private int clientsocketsndbufsize = Nettysystemconfig.socketsndbufsize;
Client Send buffer size
private int clientsocketrcvbufsize = Nettysystemconfig.socketrcvbufsize;
Client accepts buffer size
Private Boolean clientpooledbytebufallocatorenable = false;
Whether the client supports Netty memory pool
Nettyserverconfig.setlistenport (10911);
Listening port
5,final messagestoreconfig messagestoreconfig = new Messagestoreconfig ();
ROCKETMQ Broker Chapter III Registration process