You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/04/02 05:57:52 UTC

[GitHub] [incubator-shenyu] ppj19891020 opened a new issue #3177: [Question] http globalplugin Large performance loss

ppj19891020 opened a new issue #3177:
URL: https://github.com/apache/incubator-shenyu/issues/3177


   ### Question
   
   随着元数据的数据量越来越大,http转发需要遍历所有的元数据和正则匹配相关,造成性能开销大。
   元数据只有一条的压测情况:
   ![1](https://user-images.githubusercontent.com/4514718/161368664-acde2d94-2360-4e4e-9c63-63d8805599ba.png)
   
   元数据差不多1000条压测情况:
   ![2](https://user-images.githubusercontent.com/4514718/161368674-6975cf02-7fb9-4343-9768-03d3a2738cd3.png)
   
   压测的火焰图:
   ![3](https://user-images.githubusercontent.com/4514718/161368687-95192f62-8aa2-404e-8378-a339a6ce2d3c.png)
   
   
   
   查看代码发现http转发的请求都需要走到这个元数据遍历,如果元数据越来约定,性能开销会越来越大,目前这个代码是soul 2.2.4,看了新版本也有一样的问题!!!
   ```java
   public MetaData obtain(final String path) {
           MetaData metaData = META_DATA_MAP.get(path);
           if (Objects.isNull(metaData)) {
               String key = META_DATA_MAP.keySet().stream().filter(k -> PathMatchUtils.match(k, path)).findFirst().orElse("");
               return META_DATA_MAP.get(key);
           }
           return metaData;
       }
   ```


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

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