Skip to content

Commit

Permalink
[KYUUBI #1868] Upgrate netty from 4.1.68 to 4.1.73
Browse files Browse the repository at this point in the history
<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
close #1868

### _How was this patch tested?_
Pass CI

Closes #1869 from ulysses-you/netty.

Closes #1868

c197d0e [ulysses-you] Upgrate netty from 4.1.68 to 4.1.73

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: ulysses-you <ulyssesyou@apache.org>
  • Loading branch information
ulysses-you committed Feb 9, 2022
1 parent c8c1d74 commit 73c84d4
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 31 deletions.
16 changes: 15 additions & 1 deletion dev/dependencyList
Expand Up @@ -79,7 +79,21 @@ metrics-core/4.2.8//metrics-core-4.2.8.jar
metrics-jmx/4.2.8//metrics-jmx-4.2.8.jar
metrics-json/4.2.8//metrics-json-4.2.8.jar
metrics-jvm/4.2.8//metrics-jvm-4.2.8.jar
netty-all/4.1.68.Final//netty-all-4.1.68.Final.jar
netty-all/4.1.73.Final//netty-all-4.1.73.Final.jar
netty-buffer/4.1.73.Final//netty-buffer-4.1.73.Final.jar
netty-codec/4.1.73.Final//netty-codec-4.1.73.Final.jar
netty-common/4.1.73.Final//netty-common-4.1.73.Final.jar
netty-handler/4.1.73.Final//netty-handler-4.1.73.Final.jar
netty-resolver/4.1.73.Final//netty-resolver-4.1.73.Final.jar
netty-tcnative-classes/2.0.46.Final//netty-tcnative-classes-2.0.46.Final.jar
netty-transport-classes-epoll/4.1.73.Final//netty-transport-classes-epoll-4.1.73.Final.jar
netty-transport-classes-kqueue/4.1.73.Final//netty-transport-classes-kqueue-4.1.73.Final.jar
netty-transport-native-epoll/4.1.73.Final/linux-aarch_64/netty-transport-native-epoll-4.1.73.Final-linux-aarch_64.jar
netty-transport-native-epoll/4.1.73.Final/linux-x86_64/netty-transport-native-epoll-4.1.73.Final-linux-x86_64.jar
netty-transport-native-kqueue/4.1.73.Final/osx-aarch_64/netty-transport-native-kqueue-4.1.73.Final-osx-aarch_64.jar
netty-transport-native-kqueue/4.1.73.Final/osx-x86_64/netty-transport-native-kqueue-4.1.73.Final-osx-x86_64.jar
netty-transport-native-unix-common/4.1.73.Final//netty-transport-native-unix-common-4.1.73.Final.jar
netty-transport/4.1.73.Final//netty-transport-4.1.73.Final.jar
osgi-resource-locator/1.0.3//osgi-resource-locator-1.0.3.jar
paranamer/2.8//paranamer-2.8.jar
scala-library/2.12.15//scala-library-2.12.15.jar
Expand Down
8 changes: 0 additions & 8 deletions externals/kyuubi-flink-sql-engine/pom.xml
Expand Up @@ -165,7 +165,6 @@
<include>com.google.guava:failureaccess</include>
<include>com.google.guava:guava</include>
<include>commons-codec:commons-codec</include>
<include>io.netty:netty-all</include>
<include>org.apache.commons:commons-lang3</include>
<include>org.apache.curator:curator-client</include>
<include>org.apache.curator:curator-framework</include>
Expand Down Expand Up @@ -205,13 +204,6 @@
<pattern>org.apache.commons.lang</pattern>
<shadedPattern>${kyuubi.shade.packageName}.org.apache.commons.lang</shadedPattern>
</relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>${kyuubi.shade.packageName}.io.netty</shadedPattern>
<includes>
<include>io.netty.**</include>
</includes>
</relocation>
<relocation>
<pattern>org.apache.hive.service.rpc.thrift</pattern>
<shadedPattern>${kyuubi.shade.packageName}.org.apache.hive.service.rpc.thrift</shadedPattern>
Expand Down
5 changes: 0 additions & 5 deletions kyuubi-common/pom.xml
Expand Up @@ -113,11 +113,6 @@
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minikdc</artifactId>
Expand Down
Expand Up @@ -27,7 +27,6 @@ import scala.collection.JavaConverters._
import org.apache.kyuubi.{Logging, Utils}
import org.apache.kyuubi.engine.{EngineType, ShareLevel}
import org.apache.kyuubi.service.authentication.{AuthTypes, SaslQOP}
import org.apache.kyuubi.util.NettyUtils.MAX_NETTY_THREADS

case class KyuubiConf(loadSysDefault: Boolean = true) extends Logging {
import KyuubiConf._
Expand Down Expand Up @@ -516,6 +515,16 @@ object KyuubiConf {
.checkValue(p => p == 0 || (p > 1024 && p < 65535), "Invalid Port number")
.createWithDefault(3309)

/**
* Specifies an upper bound on the number of Netty threads that Kyuubi requires by default.
* In practice, only 2-4 cores should be required to transfer roughly 10 Gb/s, and each core
* that we use will have an initial overhead of roughly 32 MB of off-heap memory, which comes
* at a premium.
*
* Thus, this value should still retain maximum throughput and reduce wasted off-heap memory
* allocation.
*/
val MAX_NETTY_THREADS: Int = 8
val FRONTEND_MYSQL_NETTY_WORKER_THREADS: OptionalConfigEntry[Int] =
buildConf("frontend.mysql.netty.worker.threads")
.doc("Number of thread in the netty worker event loop of MySQL frontend service. " +
Expand Down
5 changes: 5 additions & 0 deletions kyuubi-server/pom.xml
Expand Up @@ -130,6 +130,11 @@
<artifactId>commons-lang</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>

<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
Expand Down
Expand Up @@ -30,10 +30,10 @@ import org.apache.kyuubi._
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiConf._
import org.apache.kyuubi.server.mysql._
import org.apache.kyuubi.server.mysql.NettyUtils._
import org.apache.kyuubi.server.mysql.authentication.MySQLAuthHandler
import org.apache.kyuubi.service.{AbstractFrontendService, Serverable, Service}
import org.apache.kyuubi.util.NamedThreadFactory
import org.apache.kyuubi.util.NettyUtils._

/**
* A frontend service implement MySQL protocol.
Expand Down
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.kyuubi.util
package org.apache.kyuubi.server.mysql

import java.util.concurrent.ThreadFactory

Expand All @@ -27,18 +27,9 @@ import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.nio.{NioServerSocketChannel, NioSocketChannel}
import io.netty.util.concurrent.DefaultThreadFactory

object NettyUtils {
import org.apache.kyuubi.config.KyuubiConf

/**
* Specifies an upper bound on the number of Netty threads that Kyuubi requires by default.
* In practice, only 2-4 cores should be required to transfer roughly 10 Gb/s, and each core
* that we use will have an initial overhead of roughly 32 MB of off-heap memory, which comes
* at a premium.
*
* Thus, this value should still retain maximum throughput and reduce wasted off-heap memory
* allocation.
*/
val MAX_NETTY_THREADS: Int = 8
object NettyUtils {

val EPOLL_MODE: Boolean = Epoll.isAvailable

Expand All @@ -65,7 +56,7 @@ object NettyUtils {
* we will use Runtime get an approximate number of available cores.
*/
def defaultNumThreads(numUsableCores: Option[Int]): Int = numUsableCores match {
case Some(num) => min(num, MAX_NETTY_THREADS)
case None => min(sys.runtime.availableProcessors, MAX_NETTY_THREADS)
case Some(num) => min(num, KyuubiConf.MAX_NETTY_THREADS)
case None => min(sys.runtime.availableProcessors, KyuubiConf.MAX_NETTY_THREADS)
}
}
76 changes: 75 additions & 1 deletion pom.xml
Expand Up @@ -124,7 +124,7 @@
<kubernetes-client.version>5.12.1</kubernetes-client.version>
<ldapsdk.version>5.1.4</ldapsdk.version>
<mysql.jdbc.version>8.0.27</mysql.jdbc.version>
<netty.version>4.1.68.Final</netty.version>
<netty.version>4.1.73.Final</netty.version>
<parquet.version>1.10.1</parquet.version>
<prometheus.version>0.14.1</prometheus.version>
<scalacheck.version>3.2.9.0</scalacheck.version>
Expand Down Expand Up @@ -745,6 +745,80 @@
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-dns</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-haproxy</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-memcache</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-mqtt</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-redis</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-smtp</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-socks</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-stomp</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-xml</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-classes-macos</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-rxtx</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-sctp</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-udt</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down

0 comments on commit 73c84d4

Please sign in to comment.