xinyiZzz commented on code in PR #50939:
URL: https://github.com/apache/doris/pull/50939#discussion_r2094397461


##########
fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlService.java:
##########
@@ -46,22 +46,19 @@ public class DorisFlightSqlService {
 
     public DorisFlightSqlService(int port) {
         BufferAllocator allocator = new RootAllocator();
-        // arrow_flight_token_cache_size less than qe_max_connection to avoid 
`Reach limit of connections`.
         // arrow flight sql is a stateless protocol, connection is usually not 
actively disconnected.
         // bearer token is evict from the cache will unregister ConnectContext.
         this.flightTokenManager = new FlightTokenManagerImpl(
-                Math.min(Config.arrow_flight_token_cache_size, 
Config.qe_max_connection / 2),
-                Config.arrow_flight_token_alive_time);
+                Math.min(Config.arrow_flight_max_connections, 
Config.arrow_flight_token_cache_size),

Review Comment:
   二者没有关联,arrow_flight_max_connections 实际用在两处
   1. arrow flight connection 池的大小
   2. arrow flight token cache 的大小
   
   目前每个token都对应唯一一个connection,
   - 如果 connections 数量上限 大于 token cache size,最多也只能创建 token cache size 个 
connection,因为当 connections 数超过 token cache size 后,token cache 依据 LRU 淘汰最早 token 
的同时也会删除对应的 connection。
   - 如果 connections 数量上限 小于 token cache size。当 connection 数量超限后,最初的 token 对应的 
connection 会被删除,当这个 token 被访问时会报错会报错(提示 connection 超限被删除或长时间未使用断开)
   
   所以一般来说保持二者相同即可,只需调整 arrow_flight_max_connections,后续除非可以支持 connection 
重连,否则可以考虑删除arrow_flight_token_cache_size。
   
![image](https://github.com/user-attachments/assets/161ec28e-3e59-4b29-a870-ce1afd230e09)
   
   关于 connection 和 token 超时和重连:
   token 默认的淘汰时间是 1 天,不管1天到期后是否仍在使用,类似很多网站的定期重新登录。
   connection 如果长时间未使用会淘汰删除(处于 COM_SLEEP 状态超过 8 小时)。
   所以通常 connection 会先于 token 被淘汰,目前 connection 被淘汰后对应 token 
再次访问时会报错,不会自动重连,因为重连后session信息将丢失,无法通知客户端已重连。



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to