You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2021/07/23 07:56:26 UTC

[GitHub] [incubator-eventmesh] lrhkobe opened a new issue #461: Global flow control is not work in MessageTransferTask

lrhkobe opened a new issue #461:
URL: https://github.com/apache/incubator-eventmesh/issues/461


   ## Bug Report
   
   ### Describe the bug
   The global flow control is not work,because the current logic exist problem.
   
   **The wrong way:**
   ```
   public void run() {
   	...
   	if (!rateLimiter.tryAcquire(TRY_PERMIT_TIME_OUT, TimeUnit.MILLISECONDS)) {
   		doFlowControlHandle();
   		return;
   	}
   
   	doSend();
   	...
   }
   
   ```
   In this way, the send thread releases the token immediately after obtaining it.
   
   **The right way:** 
   ```
   public void run() {
   	...
   	if (rateLimiter.tryAcquire(TRY_PERMIT_TIME_OUT, TimeUnit.MILLISECONDS)) {
   		doSend();
   	}else{
   		doFlowControlHandle();
   		return;
   	}
   
   	...
   }
   ```
   
   **Current in `MessageTransferTask.java`:** 
   ```
   public void run() {
   	...
   	if (!cmd.equals(RESPONSE_TO_SERVER) && !eventMeshTCPServer.getRateLimiter().tryAcquire(TRY_PERMIT_TIME_OUT, TimeUnit.MILLISECONDS)) {
   		msg.setHeader(new Header(replyCmd, OPStatus.FAIL.getCode(), "Tps overload, global flow control", pkg.getHeader().getSeq()));
   		ctx.writeAndFlush(msg).addListener(
   				new ChannelFutureListener() {
   					@Override
   					public void operationComplete(ChannelFuture future) throws Exception {
   						Utils.logSucceedMessageFlow(msg, session.getClient(), startTime, taskExecuteTime);
   					}
   				}
   		);
   		logger.warn("======Tps overload, global flow control, rate:{}! PLEASE CHECK!========", eventMeshTCPServer.getRateLimiter().getRate());
   		return;
   	}
   
   	doSend();
   	...
   }
   ```
   Current code in EventMesh is same with the wrong way.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on issue #461: Global flow control is not work in MessageTransferTask

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on issue #461:
URL: https://github.com/apache/incubator-eventmesh/issues/461#issuecomment-886025784


   @lrhkobe This two ways may be the same.  It seems that the `RateLimiter` will release tokens at a rate of a given number. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 closed issue #461: Global flow control is not work in MessageTransferTask

Posted by GitBox <gi...@apache.org>.
xwm1992 closed issue #461:
URL: https://github.com/apache/incubator-eventmesh/issues/461


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org