Spring Cloud Gateway:RHEL上的CPU使用率高:可能从epoll切换到NIO

问题描述

如以下问题所述,在RHEL上部署的Spring Cloud Gateway应用程序中,我们发现cpu利用率很高。以下链接中提供了详细信息

https://github.com/spring-cloud/spring-cloud-gateway/issues/1908

根据@spencergibb的建议,已经尝试使用最新版本的网关和引导,但是在PST期间仍然看到较高的cpu使用率。似乎大部分利用率是由反应堆“ epoll”线程完成的。

是否可以尝试进行任何反应堆/网络优化以提高性能?似乎除了“ epoll”外,还有使用NIO的选项-此开关是否可能?

我可以在日志中看到以下警告。这与cpu利用率高有关吗?

[2020-08-21 13:45:38,537] [] [15854] [main] [DEBUG] [i.n.u.internal.NativeLibraryLoader] - Unable to load the library 'netty_transport_native_epoll_x86_64',trying other loading mechanism.
java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll_x86_64 in java.library.path

[2020-08-21 13:45:38,567] [] [15884] [main] [DEBUG] [i.n.u.internal.NativeLibraryLoader] - Successfully loaded the library /tmp/libnetty_transport_native_epoll_x86_6488
16793540849624173.so
[2020-08-21 13:45:38,568] [] [15885] [main] [DEBUG] [r.netty.resources.DefaultLoopEpoll] - Default Epoll support : true
[2020-08-21 13:45:38,569] [] [15886] [main] [DEBUG] [r.netty.resources.DefaultLoopKQueue] - Default KQueue support : false
[2020-08-21 13:45:38,581] [] [15898] [main] [DEBUG] [i.n.c.MultithreadEventLoopGroup] - -dio.netty.eventLoopThreads: 12

解决方法

您可以通过系统属性或服务器/客户端级别上的配置来控制使用哪种传输方式。正如您在Spring Gateway中一样,最好通过系统属性对其进行控制。使用-Dreactor.netty.native=falseHere您可以找到有关配置线程等的更多信息。

对于Spring Gateway的链接问题,请尝试将JMeter与Spring Gateway分开,不能在同一台计算机上运行它们。