You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/12/30 08:04:46 UTC

[GitHub] [rocketmq] Git-Yang opened a new issue #3680: [Client] Optimize client management to avoid client conflicts

Git-Yang opened a new issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680


   
   1. Please describe the feature you are requesting.
   The user does not need to care about the creation process of the instance, when multiple instances be created in a process.
   
   2. Provide any additional detail on your proposed use case for this feature.
   Such as: 
   - InstanceName conflict causes instance creation failure.
   - Multiple instances use the same instanceName to connect to multiple clusters abnormal.
   - Multiple instances created in the same process cannot fully reuse the underlying client problem.
   
   2. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue?
   - nice-to-have
   
   4. If there are some sub-tasks using -[] for each subtask and create a corresponding issue to map to the sub task:
   
   - When multiplexing MQClientInstance, namesrv can be distinguished.
   - Producer, consumer, and admin with the same instanceName can reuse MQClientInstance.
   - When multiple instances of the same type are created, check for conflicts.
   


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] areyouok commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
areyouok commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010714540


   does this PR resolve your problem?
   
   https://github.com/apache/rocketmq/pull/2731


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] areyouok commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
areyouok commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010778509


   we can modify changeInstanceNameToPID() method and cache ```UtilAll.getPid()+ "#" + System.nanoTime();```


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] Git-Yang commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010790083


   > we can modify changeInstanceNameToPID() method and cache `UtilAll.getPid()+ "#" + System.nanoTime();`
   
   I don't understand why it is need to cache UtilAll.getPid() + "#" + System.nanoTime()?


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] Git-Yang commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010868042


   > > > we can modify changeInstanceNameToPID() method and cache `UtilAll.getPid()+ "#" + System.nanoTime();`
   > > 
   > > 
   > > I don't understand why it is need to cache UtilAll.getPid() + "#" + System.nanoTime()?
   > 
   > what about this?
   > 
   > ![image](https://user-images.githubusercontent.com/3192556/149109565-445f35ec-4ced-4ea3-b399-94af861576f1.png)
   
   In this way, the problem of conflicts in the container can indeed be solved, and I think it is also an optimization way.
   The only question at the moment is whether it is necessary to resolve conflicts caused by users using custom instanceName.
   At present, our business students have reported that have encountered such problems many times. Since we expose the use of instanceName to the user in the document, but the user does not know the underlying implementation logic, they will often encounter conflicts.


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] areyouok commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
areyouok commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010839867


   > > we can modify changeInstanceNameToPID() method and cache `UtilAll.getPid()+ "#" + System.nanoTime();`
   > 
   > I don't understand why it is need to cache UtilAll.getPid() + "#" + System.nanoTime()?
   
   what about this?
   
   ![image](https://user-images.githubusercontent.com/3192556/149109565-445f35ec-4ced-4ea3-b399-94af861576f1.png)


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] Git-Yang commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1010733312


   > #2731
   
   We currently use #2731 to temporarily resolve most user issues. The following problems still existed:
   - Using System.nanoTime() causes MQClientInstance not to be reused.
   - When users customize instanceName, if they do not understand the underlying logic, they will often encounter the same problem of using the default instanceName.


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] Aaron-TangCode commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
Aaron-TangCode commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1007953680


   ```java
   public MQClientInstance getOrCreateMQClientInstance(final ClientConfig clientConfig, RPCHook rpcHook) {
           this.markIndex(clientConfig);
   
           String clientId = clientConfig.buildMQClientId();//这里已经构建了一次ClientId
       
           if (instance == null) {
               instance = createInstance(clientConfig, rpcHook);//这里面又再次构建ClientId,这里是否还有更优雅的实现方式
           }
   ```
   
   
   
   ```java
    private MQClientInstance createInstance(final ClientConfig clientConfig, RPCHook rpcHook) {
           String clientId = clientConfig.buildMQClientId();//再次构建ClientId
           ...
   ```
   
   不清楚,这里再次构建ClientId的目的是啥,感觉还可以有更好的实现方式,你觉得呢?
   


-- 
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@rocketmq.apache.org

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



[GitHub] [rocketmq] Aaron-TangCode commented on issue #3680: [Client] Optimize client management to avoid client conflicts

Posted by GitBox <gi...@apache.org>.
Aaron-TangCode commented on issue #3680:
URL: https://github.com/apache/rocketmq/issues/3680#issuecomment-1007953040


   你的代码,应该是为了解决ClientId重复问题。因而增加了如下字段: namesrvIndex,groupIndex,clientIndex。
   我想问问,你是如何考虑使用这三个字段的?换种问法:就是为什么这样设计?


-- 
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@rocketmq.apache.org

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