You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Andor Molnar <an...@apache.org> on 2023/06/15 10:50:25 UTC
Netty native libraries in ZooKeeper
Hi,
I've come across the following when working on the support of native
SSL libraries. Currently ZooKeeper supports loading the native epoll-
based event loop of Netty, but a build profile which would download the
required dependencies is not shipped with our product.
This is perfectly okay since the feature of using native libraries is
not a build-time requirement, but in this case the user has to download
the required and appropriate versions of Netty jars and put them on the
classpath.
Shall we add a Maven build profile to ease this process?
<profile>
<id>netty-native</id>
<properties>
<os.detection.classifierWithLikes>fedora</os.detection.classifierWi
thLikes>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty-tcnative.version}</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${netty.version}</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
What do you think?
Andor
Re: Netty native libraries in ZooKeeper
Posted by Andor Molnar <an...@apache.org>.
Yeah, it works fine with the hardcoded classifier.
I'll make this Pulsar approach in the patch.
Andor
On Thu, 2023-06-15 at 19:50 +0200, Enrico Olivelli wrote:
> I may be wrong but Epoll is only a Linux thing probably.
>
> You don't have it on Mac or Windows
>
> Enrico
>
> Il Gio 15 Giu 2023, 19:49 Andor Molnar <an...@apache.org> ha scritto:
>
> > Interesting that with only the BOM included and the dependencies
> > without the classifier, Netty doesn't load the native epoll
> > selector,
> > but loads the native SSL library.
> >
> > I'm confused.
> >
> > In the Pulsar example the sub-project dependency has a hardcoded
> > classifier:
> >
> > <dependency>
> > <groupId>io.netty</groupId>
> > <artifactId>netty-transport-native-epoll</artifactId>
> > <classifier>linux-x86_64</classifier>
> > </dependency>
> >
> > Andor
> >
> >
> >
> > On Thu, 2023-06-15 at 14:31 +0200, Enrico Olivelli wrote:
> > > I think that the best way currently is to add these dependencies:
> > >
> > > Import the Netty BOM in the main pom.xml
> > > <dependency>
> > > <groupId>io.netty</groupId>
> > > <artifactId>netty-bom</artifactId>
> > > <version>${netty.version}</version>
> > > <type>pom</type>
> > > <scope>import</scope>
> > > </dependency>
> > >
> > >
> > > declare netty dependencies without setting the version and the
> > > classifier
> > > <dependency>
> > > <groupId>io.netty</groupId>
> > > <artifactId>netty-tcnative-boringssl-static</artifactId>
> > > </dependency>
> > >
> > > This is the way we are doing it in Pulsar
> > >
> > https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pom.xml#L647
> > https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pulsar-common/pom.xml#L146
> > > This way Maven should bundle all the native libraries for all the
> > > supported platforms
> > >
> > >
> > >
> > > Enrico
> > >
> > > Il giorno gio 15 giu 2023 alle ore 12:50 Andor Molnar
> > > <an...@apache.org> ha scritto:
> > > > Hi,
> > > >
> > > > I've come across the following when working on the support of
> > > > native
> > > > SSL libraries. Currently ZooKeeper supports loading the native
> > > > epoll-
> > > > based event loop of Netty, but a build profile which would
> > > > download
> > > > the
> > > > required dependencies is not shipped with our product.
> > > >
> > > > This is perfectly okay since the feature of using native
> > > > libraries
> > > > is
> > > > not a build-time requirement, but in this case the user has to
> > > > download
> > > > the required and appropriate versions of Netty jars and put
> > > > them on
> > > > the
> > > > classpath.
> > > >
> > > > Shall we add a Maven build profile to ease this process?
> > > >
> > > > <profile>
> > > > <id>netty-native</id>
> > > > <properties>
> > > > <os.detection.classifierWithLikes>fedora</os.detection.clas
> > > > sifi
> > > > erWi
> > > > thLikes>
> > > > </properties>
> > > > <dependencyManagement>
> > > > <dependencies>
> > > > <dependency>
> > > > <groupId>io.netty</groupId>
> > > > <artifactId>netty-tcnative-boringssl-
> > > > static</artifactId>
> > > > <version>${netty-tcnative.version}</version>
> > > > <classifier>${os.detected.classifier}</classifier>
> > > > </dependency>
> > > > <dependency>
> > > > <groupId>io.netty</groupId>
> > > > <artifactId>netty-transport-native-epoll</artifactId>
> > > > <version>${netty.version}</version>
> > > > <classifier>${os.detected.classifier}</classifier>
> > > > </dependency>
> > > > </dependencies>
> > > > </dependencyManagement>
> > > > </profile>
> > > >
> > > > What do you think?
> > > >
> > > > Andor
> > > >
> > > >
> > > >
Re: Netty native libraries in ZooKeeper
Posted by Enrico Olivelli <eo...@gmail.com>.
I may be wrong but Epoll is only a Linux thing probably.
You don't have it on Mac or Windows
Enrico
Il Gio 15 Giu 2023, 19:49 Andor Molnar <an...@apache.org> ha scritto:
> Interesting that with only the BOM included and the dependencies
> without the classifier, Netty doesn't load the native epoll selector,
> but loads the native SSL library.
>
> I'm confused.
>
> In the Pulsar example the sub-project dependency has a hardcoded
> classifier:
>
> <dependency>
> <groupId>io.netty</groupId>
> <artifactId>netty-transport-native-epoll</artifactId>
> <classifier>linux-x86_64</classifier>
> </dependency>
>
> Andor
>
>
>
> On Thu, 2023-06-15 at 14:31 +0200, Enrico Olivelli wrote:
> > I think that the best way currently is to add these dependencies:
> >
> > Import the Netty BOM in the main pom.xml
> > <dependency>
> > <groupId>io.netty</groupId>
> > <artifactId>netty-bom</artifactId>
> > <version>${netty.version}</version>
> > <type>pom</type>
> > <scope>import</scope>
> > </dependency>
> >
> >
> > declare netty dependencies without setting the version and the
> > classifier
> > <dependency>
> > <groupId>io.netty</groupId>
> > <artifactId>netty-tcnative-boringssl-static</artifactId>
> > </dependency>
> >
> > This is the way we are doing it in Pulsar
> >
> https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pom.xml#L647
> >
> https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pulsar-common/pom.xml#L146
> >
> > This way Maven should bundle all the native libraries for all the
> > supported platforms
> >
> >
> >
> > Enrico
> >
> > Il giorno gio 15 giu 2023 alle ore 12:50 Andor Molnar
> > <an...@apache.org> ha scritto:
> > > Hi,
> > >
> > > I've come across the following when working on the support of
> > > native
> > > SSL libraries. Currently ZooKeeper supports loading the native
> > > epoll-
> > > based event loop of Netty, but a build profile which would download
> > > the
> > > required dependencies is not shipped with our product.
> > >
> > > This is perfectly okay since the feature of using native libraries
> > > is
> > > not a build-time requirement, but in this case the user has to
> > > download
> > > the required and appropriate versions of Netty jars and put them on
> > > the
> > > classpath.
> > >
> > > Shall we add a Maven build profile to ease this process?
> > >
> > > <profile>
> > > <id>netty-native</id>
> > > <properties>
> > > <os.detection.classifierWithLikes>fedora</os.detection.classifi
> > > erWi
> > > thLikes>
> > > </properties>
> > > <dependencyManagement>
> > > <dependencies>
> > > <dependency>
> > > <groupId>io.netty</groupId>
> > > <artifactId>netty-tcnative-boringssl-static</artifactId>
> > > <version>${netty-tcnative.version}</version>
> > > <classifier>${os.detected.classifier}</classifier>
> > > </dependency>
> > > <dependency>
> > > <groupId>io.netty</groupId>
> > > <artifactId>netty-transport-native-epoll</artifactId>
> > > <version>${netty.version}</version>
> > > <classifier>${os.detected.classifier}</classifier>
> > > </dependency>
> > > </dependencies>
> > > </dependencyManagement>
> > > </profile>
> > >
> > > What do you think?
> > >
> > > Andor
> > >
> > >
> > >
>
>
Re: Netty native libraries in ZooKeeper
Posted by Andor Molnar <an...@apache.org>.
Interesting that with only the BOM included and the dependencies
without the classifier, Netty doesn't load the native epoll selector,
but loads the native SSL library.
I'm confused.
In the Pulsar example the sub-project dependency has a hardcoded
classifier:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
</dependency>
Andor
On Thu, 2023-06-15 at 14:31 +0200, Enrico Olivelli wrote:
> I think that the best way currently is to add these dependencies:
>
> Import the Netty BOM in the main pom.xml
> <dependency>
> <groupId>io.netty</groupId>
> <artifactId>netty-bom</artifactId>
> <version>${netty.version}</version>
> <type>pom</type>
> <scope>import</scope>
> </dependency>
>
>
> declare netty dependencies without setting the version and the
> classifier
> <dependency>
> <groupId>io.netty</groupId>
> <artifactId>netty-tcnative-boringssl-static</artifactId>
> </dependency>
>
> This is the way we are doing it in Pulsar
> https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pom.xml#L647
> https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pulsar-common/pom.xml#L146
>
> This way Maven should bundle all the native libraries for all the
> supported platforms
>
>
>
> Enrico
>
> Il giorno gio 15 giu 2023 alle ore 12:50 Andor Molnar
> <an...@apache.org> ha scritto:
> > Hi,
> >
> > I've come across the following when working on the support of
> > native
> > SSL libraries. Currently ZooKeeper supports loading the native
> > epoll-
> > based event loop of Netty, but a build profile which would download
> > the
> > required dependencies is not shipped with our product.
> >
> > This is perfectly okay since the feature of using native libraries
> > is
> > not a build-time requirement, but in this case the user has to
> > download
> > the required and appropriate versions of Netty jars and put them on
> > the
> > classpath.
> >
> > Shall we add a Maven build profile to ease this process?
> >
> > <profile>
> > <id>netty-native</id>
> > <properties>
> > <os.detection.classifierWithLikes>fedora</os.detection.classifi
> > erWi
> > thLikes>
> > </properties>
> > <dependencyManagement>
> > <dependencies>
> > <dependency>
> > <groupId>io.netty</groupId>
> > <artifactId>netty-tcnative-boringssl-static</artifactId>
> > <version>${netty-tcnative.version}</version>
> > <classifier>${os.detected.classifier}</classifier>
> > </dependency>
> > <dependency>
> > <groupId>io.netty</groupId>
> > <artifactId>netty-transport-native-epoll</artifactId>
> > <version>${netty.version}</version>
> > <classifier>${os.detected.classifier}</classifier>
> > </dependency>
> > </dependencies>
> > </dependencyManagement>
> > </profile>
> >
> > What do you think?
> >
> > Andor
> >
> >
> >
Re: Netty native libraries in ZooKeeper
Posted by Enrico Olivelli <eo...@gmail.com>.
I think that the best way currently is to add these dependencies:
Import the Netty BOM in the main pom.xml
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
declare netty dependencies without setting the version and the classifier
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</dependency>
This is the way we are doing it in Pulsar
https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pom.xml#L647
https://github.com/apache/pulsar/blob/d7f355881b2b1eebf2be6ea262c202660d684fb7/pulsar-common/pom.xml#L146
This way Maven should bundle all the native libraries for all the
supported platforms
Enrico
Il giorno gio 15 giu 2023 alle ore 12:50 Andor Molnar
<an...@apache.org> ha scritto:
>
> Hi,
>
> I've come across the following when working on the support of native
> SSL libraries. Currently ZooKeeper supports loading the native epoll-
> based event loop of Netty, but a build profile which would download the
> required dependencies is not shipped with our product.
>
> This is perfectly okay since the feature of using native libraries is
> not a build-time requirement, but in this case the user has to download
> the required and appropriate versions of Netty jars and put them on the
> classpath.
>
> Shall we add a Maven build profile to ease this process?
>
> <profile>
> <id>netty-native</id>
> <properties>
> <os.detection.classifierWithLikes>fedora</os.detection.classifierWi
> thLikes>
> </properties>
> <dependencyManagement>
> <dependencies>
> <dependency>
> <groupId>io.netty</groupId>
> <artifactId>netty-tcnative-boringssl-static</artifactId>
> <version>${netty-tcnative.version}</version>
> <classifier>${os.detected.classifier}</classifier>
> </dependency>
> <dependency>
> <groupId>io.netty</groupId>
> <artifactId>netty-transport-native-epoll</artifactId>
> <version>${netty.version}</version>
> <classifier>${os.detected.classifier}</classifier>
> </dependency>
> </dependencies>
> </dependencyManagement>
> </profile>
>
> What do you think?
>
> Andor
>
>
>