Skip to content
Permalink
Browse files
[FLINK-11580][netty] add statically linked netty-tcnative
With one of the artifacts of netty-tcnative [1], this enables support for using
the OpenSSL engine instead of the one from the JDK. [2] claims significant
improvements (3x) over the JDK and we may just also save some resources.

From the available artifacts, this commits selects the one which is statically
linked against Google's BoringSSL. Please refer to [1] for further details.

Due to possible licensing issues with the openSSL license BoringSSL is based on,
we only build this module if the build profile
'include-netty-tcnative-static-Pinclude-netty-tcnative-static' is activated.

[1] http://netty.io/wiki/forked-tomcat-native.html
[2] https://netty.io/wiki/requirements-for-4.x.html#wiki-h4-4
  • Loading branch information
Nico Kruber authored and zentol committed May 15, 2019
1 parent 651ecb5 commit 4875bdc24d7d8a0076b65a11762fd49e536faaff
Showing 3 changed files with 136 additions and 0 deletions.
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded</artifactId>
<version>7.0</version>
<relativePath>..</relativePath>
</parent>

<artifactId>flink-shaded-netty-tcnative-static</artifactId>
<name>flink-shaded-netty-tcnative-static</name>
<version>${netty.tcnative.version}-7.0</version>

<properties>
<netty.tcnative.version>2.0.25.Final</netty.tcnative.version>
</properties>

<dependencies>
<!-- Netty's native openSSL support -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty.tcnative.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade-flink</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<dependencyReducedPomLocation>${project.basedir}/target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<artifactSet>
<includes>
<include>io.netty:netty-tcnative-boringssl-static</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>org.apache.flink.shaded.netty4.io.netty</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>rename-native-library</id>
<phase>package</phase>
<configuration>
<target>
<echo message="unpacking netty jar" />
<unzip src="${project.build.directory}/${artifactId}-${version}.jar" dest="${project.build.directory}/unpacked/" />
<echo message="renaming netty_tcnative library" />
<move todir="${project.build.directory}/unpacked/META-INF/native" includeemptydirs="false">
<fileset dir="${project.build.directory}/unpacked/META-INF/native"/>
<mapper type="regexp" from="(lib)?netty_tcnative_(linux_x86_64.so|osx_x86_64.jnilib|windows_x86_64.dll)" to="\1org_apache_flink_shaded_netty4_netty_tcnative_\2"/>
</move>
<echo message="repackaging netty jar" />
<jar destfile="${project.build.directory}/${artifactId}-${version}.jar" basedir="${project.build.directory}/unpacked" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
@@ -0,0 +1,14 @@
flink-shaded-netty-openssl-static
Copyright 2014-2019 The Apache Software Foundation

This project includes software developed at
The Apache Software Foundation (http://www.apache.org/).

This project bundles the following dependencies under the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)

- io.netty:netty-tcnative-boringssl-static:2.0.25.Final

This project bundles the following dependencies under the OpenSSL license.
See bundled license files for details.

- BoringSSL (statically linked native libraries)
12 pom.xml
@@ -62,6 +62,18 @@ under the License.
</modules>

<profiles>
<profile>
<id>include-netty-tcnative-static</id>
<activation>
<property>
<name>include-netty-tcnative-static</name>
</property>
</activation>
<modules>
<module>flink-shaded-netty-tcnative-static</module>
</modules>
</profile>

<profile>
<id>release</id>
<build>

0 comments on commit 4875bdc

Please sign in to comment.