如何最小化jhipster microservice环境的内存占用?
创建基本微服务环境的步骤如下:如何最小化jhipster microservice环境的内存占用?,jhipster,Jhipster,创建基本微服务环境的步骤如下: 注册表:jhipster注册表 用户记帐和授权:jhipster uaa 网关:jhipster网关 微服务:jhipster微服务 设置环境变量时内存不足: JAVA_OPTS='-Xmx512m' 和我自己的电脑8Go(系统使用2Go) jhipster注册表通过启动。/mvnw jhipster-{uaa、网关、微服务、foo}通过启动。/gradlew 谢谢你的帮助 注意:位于用于生成这些应用程序的jh文件下方 # documentation http
- 注册表:jhipster注册表
- 用户记帐和授权:jhipster uaa
- 网关:jhipster网关
- 微服务:jhipster微服务
# documentation https://www.jhipster.tech/jdl/
application {
config {
baseName uaa,
packageName fr.org.foo.uaa,
applicationType uaa,
serverPort 9999,
buildTool gradle,
clientPackageManager npm,
nativeLanguage en,
languages [en,fr],
enableTranslation true,
authenticationType uaa,
cacheProvider hazelcast,
databaseType mongodb,
devDatabaseType mongodb,
prodDatabaseType mongodb,
searchEngine elasticsearch,
enableHibernateCache true,
serviceDiscoveryType eureka,
testFrameworks [gatling,cucumber],
skipClient true
}
entities Workflow, Task, Command
}
application {
config {
baseName gateway,
packageName fr.org.foo.gateway,
applicationType gateway,
serverPort 8080,
buildTool gradle,
clientPackageManager npm,
nativeLanguage en,
languages [en,fr],
enableTranslation true,
authenticationType uaa,
uaaBaseName "uaa",
cacheProvider hazelcast,
websocket spring-websocket,
databaseType mongodb,
devDatabaseType mongodb,
prodDatabaseType mongodb,
searchEngine elasticsearch,
enableHibernateCache true,
serviceDiscoveryType eureka,
clientFramework react,
testFrameworks [gatling,cucumber,protractor],
jhiPrefix jhi
}
entities Workflow, Task, Command
}
application {
config {
baseName foo,
packageName fr.org.foo.foo,
applicationType microservice,
serverPort 8081,
buildTool gradle,
clientPackageManager npm,
nativeLanguage en,
languages [en,fr],
enableTranslation true,
authenticationType uaa,
uaaBaseName "uaa",
cacheProvider hazelcast,
websocket spring-websocket,
databaseType mongodb,
devDatabaseType mongodb,
prodDatabaseType mongodb,
searchEngine elasticsearch,
enableHibernateCache true,
serviceDiscoveryType eureka,
testFrameworks [gatling,cucumber],
jhiPrefix jhi
}
entities Workflow, Task, Command
}
entity Workflow {
id Long required,
name String required minlength(3),
description String
}
entity Task {
id Long required,
name String required minlength(3),
type TaskType required,
description String
}
# http://www.workflowpatterns.com/patterns/
enum TaskType {
Sequence,
Split,
Synchronization,
ExclusiveChoice,
SimpleMerge
}
entity Command {
id Long required,
command String required minlength(3),
parameters String,
version String required
}
relationship OneToMany {
Workflow{task} to Task,
Task{command} to Command
}
relationship ManyToOne {
Task{previous} to Task
Task{next} to Task
}
microservice Workflow, Task, Command with foo
您确定mvnw或gradlew使用JAVA_OPTS吗 就我个人而言,我在spring boot maven插件配置的pom.xml中设置了JVM参数:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
...
<configuration>
<executable>true</executable>
<fork>true</fork>
<mainClass>${start-class}</mainClass>
<jvmArguments>-Xms64m -Xmx128m</jvmArguments>
</configuration>
</plugin>
感谢Gaël,现在通过您的设置,这些应用程序启动后需要4Go,而不是6Go以上。我将等待一点,如果他们是为了改善这一点而做的其他事情,在验证你有用的答案之前,你的应用程序使用MangGDB和ActudiScript选项,这些选项在嵌入DEV时消耗了大量的内存。
bootRun {
jvmArgs = ["-Xms64m", "-Xmx128m"]
}