You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "funky-eyes (via GitHub)" <gi...@apache.org> on 2024/12/23 05:43:23 UTC

Re: [PR] feature: add single server rate limit [incubator-seata]

funky-eyes commented on code in PR #6756:
URL: https://github.com/apache/incubator-seata/pull/6756#discussion_r1895149384


##########
compatible/src/main/java/io/seata/tm/api/DefaultFailureHandlerImpl.java:
##########
@@ -28,6 +26,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.concurrent.TimeUnit;

Review Comment:
   ```suggestion
   ```



##########
compatible/src/main/java/io/seata/tm/api/DefaultFailureHandlerImpl.java:
##########
@@ -16,8 +16,6 @@
  */
 package io.seata.tm.api;
 
-import java.util.concurrent.TimeUnit;
-
 import io.netty.util.HashedWheelTimer;

Review Comment:
   ```suggestion
   import java.util.concurrent.TimeUnit;
   
   import io.netty.util.HashedWheelTimer;
   ```



##########
server/src/main/java/org/apache/seata/server/coordinator/DefaultCoordinator.java:
##########
@@ -76,6 +66,17 @@
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;

Review Comment:
   ```suggestion
   ```



##########
metrics/seata-metrics-api/src/main/java/org/apache/seata/metrics/IdConstants.java:
##########
@@ -79,4 +81,9 @@ public interface IdConstants {
 
     String STATUS_VALUE_AFTER_ROLLBACKED_KEY = "AfterRollbacked";
 
+    String LIMIT_TYPE_KEY = "limitType";
+
+    String CLIENT_ID_KEY = "clientId";
+
+    String SERVER_IP_ADDRESS_AND_PORT_KEY = "serverIpAddressAndPort";

Review Comment:
   Isn't 'hostAndPort' more concise?



##########
script/config-center/config.txt:
##########
@@ -162,7 +162,10 @@ server.raft.serialization=jackson
 server.raft.compressor=none
 server.raft.sync=true
 
-
+server.ratelimit.enable=false
+server.ratelimit.bucketTokenNumPerSecond = 1
+server.ratelimit.bucketTokenMaxNum = 1
+server.ratelimit.bucketTokenInitialNum = 1
 

Review Comment:
   Some users may blindly copy this configuration, so it's better to set the threshold to a larger value



##########
server/src/main/java/org/apache/seata/server/coordinator/DefaultCoordinator.java:
##########
@@ -16,17 +16,6 @@
  */
 package org.apache.seata.server.coordinator;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
 import io.netty.channel.Channel;

Review Comment:
   ```suggestion
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Comparator;
   import java.util.List;
   import java.util.Map;
   import java.util.Objects;
   import java.util.concurrent.ArrayBlockingQueue;
   import java.util.concurrent.ScheduledThreadPoolExecutor;
   import java.util.concurrent.ThreadPoolExecutor;
   import java.util.concurrent.TimeUnit;
   
   import io.netty.channel.Channel;
   ```



##########
integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/handler/GlobalTransactionalInterceptorHandler.java:
##########
@@ -59,6 +52,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.lang.reflect.Method;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+

Review Comment:
   ```suggestion
   
   ```



##########
integration-tx-api/src/main/java/org/apache/seata/integration/tx/api/interceptor/handler/GlobalTransactionalInterceptorHandler.java:
##########
@@ -16,13 +16,6 @@
  */
 package org.apache.seata.integration.tx.api.interceptor.handler;
 
-import java.lang.reflect.Method;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 import com.google.common.eventbus.Subscribe;

Review Comment:
   ```suggestion
   import java.lang.reflect.Method;
   import java.util.LinkedHashSet;
   import java.util.Set;
   import java.util.concurrent.ScheduledThreadPoolExecutor;
   import java.util.concurrent.TimeUnit;
   import java.util.concurrent.atomic.AtomicBoolean;
   
   import com.google.common.eventbus.Subscribe;
   ```



-- 
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: notifications-unsubscribe@seata.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org