Java Weblogic 增加内存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19857219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 20:46:11  来源:igfitidea点击:

Weblogic increase memory

javaweblogicpermgenweblogic12c

提问by Akhil K Nambiar

How do I increase the memory used by my Weblogic (Java). While starting the server from eclipse it shows a message that JAVA Memory arguments: -Xms256m -Xmx512m -XX:MaxPermSize=256m. I couldn't understand from where is it taking that value from. After sometime the Weblogic server fails because of low permgen space.

如何增加 Weblogic (Java) 使用的内存。从 Eclipse 启动服务器时,它会显示一条消息JAVA Memory arguments: -Xms256m -Xmx512m -XX:MaxPermSize=256m。我无法理解它从哪里获取这个价值。一段时间后,Weblogic 服务器由于 permgen 空间不足而失败。

I added startup arguments from console but that doesn't have any effect. Can you help me from where is it taking the memory values from?

我从控制台添加了启动参数,但这没有任何效果。你能帮我从哪里获取内存值吗?

采纳答案by Derek

When you configure a "Server" in Eclipse for WebLogic, you select a domain directory (for local). That domain directory contains the startup scripts that Eclipse will use to start the WebLogic Server. These are the same scripts that you would use if you started the server if you did it without Eclipse. Inside the domain directory is a folder called "bin". In the "bin" directory, locate the setDomainEnv file (.sh for unix, or .cmd for Windows). In that file, alter the memory settings to suite your needs.

在 Eclipse 中为 WebLogic 配置“服务器”时,选择域目录(用于本地)。该域目录包含 Eclipse 将用于启动 WebLogic Server 的启动脚本。如果您在没有 Eclipse 的情况下启动服务器,您将使用这些脚本。在域目录中有一个名为“bin”的文件夹。在“bin”目录中,找到 setDomainEnv 文件(Unix 为 .sh,Windows 为 .cmd)。在该文件中,更改内存设置以满足您的需要。

Based on the error message you mentioned in your question, I would increase both the PermSize and MaxPermSize settings to 512m. For PermSize and MaxPermSize, there are two locations each by default in a simple WLS installation, one for 32-bit, and another for 64-bit. It won't hurt to change them both. But if you know which JVM architecture you are running, you can change the one that applies to your environment.

根据您在问题中提到的错误消息,我会将 PermSize 和 MaxPermSize 设置增加到 512m。对于 PermSize 和 MaxPermSize,在简单的 WLS 安装中,默认情况下各有两个位置,一个用于 32 位,另一个用于 64 位。改变他们两个不会有什么坏处。但是,如果您知道正在运行的 JVM 架构,则可以更改适用于您的环境的架构。

回答by Siva

You will have a file setDomainEnv.cmd/setDomainEnv.sh under your server bin folder. this file contains

您将在服务器 bin 文件夹下有一个文件 setDomainEnv.cmd/setDomainEnv.sh。这个文件包含

 set MEM_MAX_PERM_SIZE_64BIT=-XX:MaxPermSize=512m

set MEM_MAX_PERM_SIZE_32BIT=-XX:MaxPermSize=512m

Max and Min memory values as

最大和最小内存值作为

if "%JAVA_VENDOR%"=="Sun" (
    set WLS_MEM_ARGS_64BIT=-Xms256m -Xmx512m
    set WLS_MEM_ARGS_32BIT=-Xms256m -Xmx512m
) else (
    set WLS_MEM_ARGS_64BIT=-Xms512m -Xmx512m
    set WLS_MEM_ARGS_32BIT=-Xms512m -Xmx512m
)

You can update the values inside it.

您可以更新其中的值。

回答by Display Name is missing

In addition to the previous two answers that are correct (modifying setDomainEnvand potentially wl_server\common\bin\commEnv), you can also modify servers individually if you are starting them with the nodemanager.

除了前两个正确的答案(修改setDomainEnv和潜在wl_server\common\bin\commEnv)之外,如果您使用节点管理器启动服务器,您还可以单独修改服务器。

In the admin console navigate to:

在管理控制台中导航到:

Servers -> <server name> -> Server Start tab -> Arguments

Here you can set the JVM args you want for that server rather than making a blanket change in all servers to setDomainEnv

在这里,您可以为该服务器设置所需的 JVM 参数,而不是在所有服务器中将所有服务器都更改为 setDomainEnv

回答by Taras

Looks like eclipse plugin adds it own USER_MEM_ARGS variable, so it should be rewritten using following approach:
Open following file:

看起来 eclipse 插件添加了它自己的 USER_MEM_ARGS 变量,所以应该使用以下方法重写它:
打开以下文件:

$WL_HOME/user_projects/domains/mydomain/bin/setDomainEnv.sh

and add the next line to it (e.g. after help description)

并添加下一行(例如在帮助描述之后)

USER_MEM_ARGS=$ECLIPSE_MEM_ARGS

Then, open weblogic server properties (double click at weblogic in servers view) and click "Open launch configuration". In a opened window select "Environment" and add new variable ECLIPSE_MEM_ARGS with memory params as value, e.g.:

然后,打开 weblogic 服务器属性(在服务器视图中双击 weblogic)并单击“打开启动配置”。在打开的窗口中选择“环境”并添加新变量 ECLIPSE_MEM_ARGS 并使用内存参数作为值,例如:

ECLIPSE_MEM_ARGS=-Xms1024m -Xmx2048m -XX:MaxPermSize=512m

Save and check that server was applied new configuration.
P.S. Using this approach you can change/add memory params directly from eclipse.
P.S.S. In Windowsyou should use setDomainEnv.cmdfile and added line should be:

保存并检查服务器是否应用了新配置。
PS 使用这种方法,您可以直接从 Eclipse 更改/添加内存参数。
PSS 在Windows 中你应该使用setDomainEnv.cmd文件并且添加的行应该是:

set USER_MEM_ARGS=%ECLIPSE_MEM_ARGS%

回答by Heezer

For Weblogic12:

对于 Weblogic12

Environment->Servers->[your_server]->Configuration/Server Start -> Arguments:

环境->服务器->[your_server]->配置/服务器启动->参数:

-Xms1024m -Xmx2048m

Restart the server: Environment->Servers->[your_server]->Control/"Start/Stop" -> Suspend and then Start.

重启服务器:Environment->Servers->[your_server]->Control/"Start/Stop" -> Suspend 然后Start。

Check your memory: Environment->Servers->[your_server]->Monitoring/Performance.

检查您的内存:Environment->Servers->[your_server]->Monitoring/Performance。