JVM tuning

1. Changing the JVM that Runs Servers
 
When you create a domain, if you choose to customize the configuration, the Configuration Wizard presents a list of SDKs that WebLogic Server installed. From this list, you choose the JVM that you want to run your domain and the wizard configures the weblogic start scripts based on your choice.

After you create a domain, if you want to use a different JVM, you can modify the scripts as follows:
  1. To change the JVM for all server instances that run on a WebLogic Server host, open WL_HOME\common\bin\commEnv.sh
    To change the JVM only for a specific domain's Administration Server, open domain-name\StartWebLogic.sh.
To change the JVM only for a specific domain's Managed Servers, open domain- domain-name\StartManagedWebLogic.sh .
where domain-name is the directory which you created the domain


2·  Change the value for the JAVA_HOME variable.
Specify an absolute pathname to the top directory of the SDK that you want to use. For example, c:\bea\jrockit81 or /usr/java/jdk1.6.0_21 for linux
On a Windows or Linux platform, BEA recommends the following JVMs:
  • For development mode, the Sun SDK with the HotSpot Client JVM.
  • For production mode, the WebLogic JRockit SDK. This SDK provides optimal running performance but initial startup cycles can require more time than other SDKs.



  • Change the value for the JAVA_VENDOR variable.





  • Specify the vendor of the SDK. Valid values depend on the platform on which you are running. For more information, refer to the Supported Platforms page at the following URL: http:/download.oracle.com/docs/cd/E13196_01/platform/docs81/support/index.html.
    For example:
    • Oracle indicates that you are using the JRockit SDK. It is valid only on platforms that support JRockit.
    • Oracle also indicates that you are using the Sun SDK.
    • HP and IBM indicate that you are using SDKs that Hewlett Packard or IBM have provided. These values are valid only on platforms that support HP or IBM SDKs.



  • Restart any servers that are currently running.





  • 2. Thread dump

    If an application seems stuck, or is running out of resources, a thread dump will reveal the state of the server.
    Java's thread dumps are a vital tool for server debugging. Because servlets are intrinsically multithreaded, it is very possible to create deadlocks without realizing it, or to have runaway threads that consume resources and cause OutOfMemory exceptions. That's especially true when you start adding software like databases, EJB, and Corba ORBs.

    Do thread dump from Admin Server > Server > Select Server > Configuration> Monitoring>Threads

    or From command line

    kill -3 process_name. Do this 3 times i.e

    kill -3 process_name
    kill -3 process_name
    kill -3 process_name


    or

    one thing to consider is that Thread dumps are redirected to server standard out. So if you're under unix environment and take the thread dump with kill -3 [PID] command you need to have redirected the standard out to a file. This usually is done using the nohup command while starting the server.  
    like nohup ./startWeblogic.sh
    This will redirect to   

    $DOMAIN_HOME/servers/$SERVER_NAME/logs/$SERVER_NAME.out 
    One another eary method in Unix enviroment is 
    One more easy step is in UNIX env. 1.5 JDK and beyond
    run below commands to get thread dump.( All needs to be running in command line only else you wont get any PID)
    jps -l (Java process list)
    jstack -l PID (This will give you total thread dump
    And finally,  you can also Thread dump from WLST command tool
    java weblogcic.wlst
    Connect to the managed server and make it online.  And then

    execute threadDump()
    Hope this will address all thread up related requests.





    No comments:

    Post a Comment