gRpc netty 创建 .dll 文件 windows

问题描述 投票:0回答:1

在 tomcat(版本 9.0.43)的

temp
文件夹中,我注意到有许多具有此模式名称的
.dll
文件:`io_grpc_netty_shaded_netty_tcnative_windows_x86_SOME_RANDOM_NUMBER.dll.

我注意到

.dll
文件在 tomcat 启动时至少创建一次,但我不确定它是否也在运行时由某些操作创建。

在这个 java 项目中,这些是可能重要的依赖项..

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-gcp-dependencies</artifactId>
            <version>1.2.8.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-gcp-starter-vision</artifactId>
        <version>1.2.8.RELEASE</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.4.3</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

为了不创建太多

.dll
文件,从长远来看会使系统内存混乱,有没有办法告诉 java webapp 只使用一个
.dll

我尝试了在此 link 找到的临时解决方案,但对我来说没有用。

这是我找到的另一个解决方案,但我正在使用 Spring 的 ApplicationRunner 来运行一些东西,我不知道它有什么帮助.. 我猜的一种方法是在 ApplicationRunner 中运行一条指令来删除那些

.dll
文件,但我不太喜欢这个主意。

java spring tomcat grpc netty
1个回答
0
投票

.dll 不是连续创建的。但是每次部署战争时都可以创建它们。由于 Windows 的行为,在 Java 进程运行时无法安全删除它们。

您可以通过使用

-Dio.grpc.netty.shaded.io.netty.handler.ssl.noOpenSsl=true
启动 tomcat 来禁用 netty-tcnative(这可能会影响性能)。如果使用 Java 8,性能差异可能很大。如果你使用 Java 11 或更高版本,差异就小得多。

© www.soinside.com 2019 - 2024. All rights reserved.