Speed up Weblogic Server startup times
Asked Answered
D

8

25

At my work, we use Weblogic Server to host an enterprise portal. Which is fine.

However, I've recently had the opportunity to use Tomcat for some side projects, and I am struck by the incredible difference in speed. Tomcat takes 3-5 seconds to start up, and 10-15 seconds to deploy a medium-sized projects. Wewblogic takes 3-5 minutes to start, and up to 10 minutes to deploy. This kills any iterative development.

Am I going to have to resign myself to its being slow and bloated, or is there anything I can do to speed it up? Anyone have experience with this?

Dunaj answered 10/2, 2009 at 20:32 Comment(1)
3-5 minutes,!? How sadQuilmes
W
19

You will not be able to turn the frog into a princess. I would wonder slightly about those startup times for weblogic - they seem a bit excessive, you're not running on linux by any chance ?

If you're running nested archives (wars within ears etc) and also directory-scanning technologies (hibernate, spring etc), you may try unpacking it all to the corresponding exploded structure before deploying; it has been known to help a bit.

Tomcat contains a very small subset of the features weblogic has. We develop on jetty but deploy on weblogic for acceptance/production environments and this works fairly well. You can do the same with tomcat.

Tomcat is a fairly strict container whilst weblogic is lenient, so you'll normally have only minor troubles deploying to weblogic, especially as long as you continuously do both.

You can also use a tool like javarebel to do really nifty hot-deployment and avoid all those restarts.

Wane answered 10/2, 2009 at 20:46 Comment(2)
Interesting. I'll definitely look in to javarebel. Unfortunately I can't deploy to Tomcat or Jetty for development... We're running Weblogic Portal which unfortunately relies very much on the rest of the BEA ecosystem and seems to choke without it.Dunaj
Are you running weblogic on linux ? There is a very obscure issue with the random number generation on linux that causes very slow startup times of weblogic. I can dig up the solution if that's the case.Wane
M
7

As krosenvold said, the random number generation can cause slow startup.

The recommendation from Oracle is to use one of the -D flags below - only on non-production systems since it lessen security.

Use -Djava.security.egd=file:///dev/urandom switch or file:/dev/./urandom to the command that starts weblogic.

The information above is taken from http://download.oracle.com/docs/cd/E12839_01/doc.1111/e14772/weblogic_server_issues.htm#CIHIIBGJ

If the -D flag doesn't work, look at the following solution: http://www.itonguard.com/20090313/weblogic-starts-slow/

Merino answered 23/9, 2009 at 8:17 Comment(0)
H
4

You haven’t mentioned what level and what platform but the WebLogic Server Performance and Tuning guide contains a number of hints and tips that may help you.

Hallmark answered 10/2, 2009 at 21:3 Comment(0)
C
3

WebLogic can also be slow to start up on Linux if it's connecting to a database and you haven't set up DNS properly.

Depending on your setup, you might be able to edit /etc/resolv.conf and comment out the nameserver line. This can reduce WebLogic's startup time from 20 minutes to less than a minute.

Chlorella answered 24/2, 2012 at 12:2 Comment(1)
This is a good answer exactly I stuck with the database connection it tries to connect with it and after multi tries, it gets a timeout and starts in final. so thanx @ChlorellaCellophane
S
2

On the memory consumption issue, you might want to try setting the memory parameters of the JVM used by your WebLogic server. Log in to your WL Web Admin Console and go to Environment/Servers/[your server]/Configuration/Server Start and, on the "Arguments", setting something like -Xms256m -Xmx256m will set your JVM's initial (Xms) and maximum (Xmx) heap size to 256 megabytes. You will want to play around with these numbers and find the best values for your environment. But please be aware that your Eclipse instance might be consuming a lot of memory as well.

Regarding the startup time, although a bit larger than I would expect, they seem OK. This problem is very frequent, and I don't think you will be able to definitely solve it. WebLogic has much more features than Tomcat, and this reflects in other characteristics of the environment (like startup time).

Turns out Weblogic uses random number generator during start up. Because of the bug in java it reads ‘randomness’ from /dev/random. /dev/random is very good random numbers generators but it is extremely slow. It takes sometimes 10 minutes or more to generate one number. /dev/urandom is not that good, but it is instant. Java somehow maps /dev/urandom file to /dev/random. That’s why default settings in $JAVA_HOME/jre/lib/security/java.security are useless.

Possible solutions: 1) Add “-Djava.security.egd=file:/dev/./urandom” (/dev/urandom does not work) to java parameters.

Worse but working solution is: 2) mv /dev/random /dev/random.ORIG ; ln /dev/urandom /dev/random

3) Best solution is to change $JAVA_HOME/jre/lib/security/java.security Replace securerandom.source with

securerandom.source=file:/dev/./urandom

This problem does not happen under windows because it uses different implementation of /dev/random.

It takes seconds to start weblogic server now.

Schweitzer answered 2/1, 2014 at 13:53 Comment(0)
Q
1

If you use Weblogic workshop, then you just need to publish, not restart the application server while doing iterative development.

Queen answered 26/11, 2009 at 1:52 Comment(0)
Q
0

Please check that the lengthy startup time is actually due to WebLogic Server startup and not WebLogic Portal startup time.

Quilmes answered 9/8, 2011 at 17:53 Comment(0)
C
0

As Tomas F and krosenvold suggested it may be for the random number generator.

On the standard startup of Weblogic 12.2.1 I got this message :

Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. 
To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true

So I specified it and it cut the startup time in half. About 13 seconds on a clean domain.

There is a great code example where you can try it out yourself in plain old Java.

public class JavaSecurityEgdTester {
    public static final double NANOSECS = 1000000000.0;

    public static void main(String[] args) {
        SecureRandom secureRandom = new SecureRandom();
        long start = System.nanoTime();
        byte[] randomBytes = new byte[256];
        secureRandom.nextBytes(randomBytes);
        double duration = (System.nanoTime() - start) / NANOSECS;

        System.out.println("java.security.egd = " + System.getProperty("java.security.egd") + " took " + duration + " seconds and used the " + secureRandom.getAlgorithm() + " algorithm");
    }
}

Run

java -Djava.security.egd=file:/dev/random -cp JavaSecurityEgdTester

vs

java -Djava.security.egd=file:/dev/urandom -cp . JavaSecurityEgdTester
Clackmannan answered 15/4, 2016 at 5:12 Comment(1)
it disabled it for better performance right ? how come enabling it reduced the time !!Quadrature

© 2022 - 2024 — McMap. All rights reserved.