20th WebLogic Book Review comes from India!

The two statements from @ganeshk_8 a Senior Technical Consultant for OFM about my WebLogic 12c book are top notch:

“It promises much more than what its name suggests.”

“You will end up thinking – had I read this book earlier, I would have saved a lot of time in my project.”

 

Read the full review here.

Book Raffle: 3 Free Copies of WebLogic 12c Distinctive Recipes

It’s Christmas time, 2013 is almost over. I’ll be heading to Berlin next week, which will be my last business trip for this year. 2013 has been a good year! A year packed with exciting projects, interesting tech workshops and new customers looking for honest OFM consulting and doing cool stuff.

Free WebLogic 12c Distinctive Recipes Book

To give something back, I am offering three free copies of my 2013 book WebLogic Distinctive Recipes.

wls12book3d_lying

By the way, guess who is Santa Claus on that picture? Don’t get fooled by the belly… I had to use an extra pillow to trick my 9-year-old nephew into believing that Santa exists (some friends believe that Beyoncé later copied my trick with the pillow).

santa

The Raffle

To participate in the raffle simply let me know that you like a copy before Dec 20th:

✘✘✘  Just retweet the announcement on Twitter, or tweet about it yourself (and make sure I will see it).

✘✘✘  Or, if you are more a Facebook person,  SHARE the Facebook announcement.

The Smallprint

There is no purchase required to participate! All you need is a delivery address. Winners are drawn Dec 21st. Decisions are final. Any recourse to courts of law is excluded.

WebLogic SNMP UDP Port – Misleading Error Logs

Have you lately tried to use SNMP with WebLogic? I did, because I upgraded an earlier Windows-based domain to WebLogic 12.1.2 running on CentOS Linux.

SNMP Configuration

WebLogic is showing some strange and undesired behaviour here… Firstly, to get started with SNMP basically all you need to do is to enable the SNMP agent.

WebLogic SNMP Agent

 

This is good enough when running under Windows. Then you might specify a trap destination such as localhost 4000 and run the WebLogic command-line tool to listen to the destination and verify if your setup is working.

WebLogic Trap Destination

 

The command line to run the trap listener looks like this

$ java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 4000
Listening on port:4000

Now, of course you (well, in this case me) forgot to modify SNMP UDP Listen Port and the Master AgentX Port. For sure you know that you cannot bind to ports less than 1024 in UNIX.

WebLogic Bind Exception

What happens

  • Interesting enough, there is an error message in the Weblogic startup – it is just pointing you to the wrong direction since it complains about port 171 not being available. Now, you might wonder, port 171 is configured nowhere!
  • Apparently WebLogic is trying 161 and the following 10 port numbers, eg. to avoid conflicts when several servers are running on a single machine (nothing to complain about, this behavior is documented, just click on “help”).
  • If all ports are unavailable (or not allowed for non-root users in UNIX), WebLogic does not complain about the configured port not available, but about the last one it tried. Not such a good solution…
  • Looking at the Master AgentX port, the situation is different again. Of course the restriction for binding to ports less than 1024 still applies, but there is no auto-increment on WebLogic. Unfortunately, the error message in the log file does not even mention the port number.

To conclude, when specifying a SNMP port number that you cannot bind to, you might see an error message containing a different port number than the one you configured for SNMP UDP Listen Port.
For the Master AgentX Port you will see a rather generic message, not containing the problematic port number at all.

Both is good to know and leaves some space for improvement.

<Sep 21, 2013 8:53:54 AM CEST> <Error> <SNMP> <BEA-320951> <Failed to initalize the SNMP AgentX master subagent. One possible cause is the failure to bind the Master agentX port. If this is the case, check to see if the specified AgentX port is available, or ensure that the process has permissions to bind to the desired port.
weblogic.diagnostics.snmp.agent.SNMPAgentToolkitException: java.net.BindException: Permission denied
 at weblogic.diagnostics.snmp.agent.monfox.MonfoxToolkit.initializeMasterAgentX(MonfoxToolkit.java:186)

 


WebLogic 12.1.2 Node Manager Bug

While working with WebLogic 12.1.2 I discovered the following bug. Not sure though if the same would happen with 10.3.X.

Try the following:

- Create a domain with one managed server

- Configure a machine, then start the per domain node manager. Using the admin console start the managed server. All working lovely so far.

- It’s lunch time. Stop node manager. Then stop the managed server using the admin console. This shouldn’t be a big deal.

- After lunch: start admin server and node manager. Node manager reports managed server is running (which is not correct!).

- Try to start managed server and it will report an error message that it is in incompatible state. :(

bug

 

Check the video below to reproduce it (just a quick recording, not a nice one):

 

1.) Interesting enough the server.PID file is removed when the managed server is shut down. However when restarting the node manager the managed server it is detected as running.

2.) With the node manager stopped, when forcing the managed server to shut down via admin console, ms1.state file shows FORCE_SHUTTING_DOWN, whereas when forcing the managed server to shut down (same button) with node manager running, the state is SHUTDOWN.

 

As you could guess, I wanted to spend my morning with sth else.
Comments welcome! Lunchtime for me now.

 

A Twitter Bootstrap Based Self-Measuring Application To Quantify the Effect of Precompilation on WebLogic – Part II

This is part II. It’s the part explaining how to measure the effect of precompilation.

The previous part, part I, covered the basics of precompilation. The next part, part III, will be about why even simple web applications should be different to what you and me were doing 10 years ago.

Measure the Effect of Precompilation

How NOT to do it

Don’t create a non-precompiled web application, run it with a load script that is simulating the requests of several clients, and then to compare run a precompiled version of the same web application with the same load. There is a rather big middleware vendor who is exactly showing this in a performance tuning course, but please folks, don’t try it at home.

There are quite a some reasons while at the end you cannot really measure a difference this way. To list a few: you load testing tool might record think times, several simulated clients won’t help, because after the first access the resource will be automatically compiled and so on.

A more clever way…

To measure how much time could be saved with precompilation I developed an application which is timing itself!

The application contains 10 JSP pages and automatically forwards from one JSP to another. The first JSP page will store the wall clock time and the last one will retrieve it and calculate the total execution time of the application. When running the application for the first time it will roughly take 9 times the time to precompile a JSP page plus 9 times the delay that the application is waiting until it is forwarding to the next JSP. Note, that you cannot measure the time to compile the first page, because it has to be compiled first before you can store the starting time.

precompilation

If you subtract the time the application is waiting until automatically forwarding  to the next page (a value arbitrarily set to 3 seconds here) and divide it by 9, you will have an estimation the average time it takes to precompile a single JSP.

Even better: if you run the exact application again, it is already precompiled! That’s a handy cross check. This way you can even quantify the time it takes to load the JSP page or the class file.

Measurement Results

On my small Lenovo X220 laptop with a SSD the compilation of a single JSP page cost more than half a second. When running the app for the first time I get the following results:

Without Precompile Results

 

For the second run the results look as follows:

res2

There is still some time needed per JSP but it is about 40 times smaller and more or less constant if you decide to run the precompiled version again.

Measure your own system, it’s an interesting benchmark. And let the world know – post your results here including your CPU, disk etc!

 

Hands-On Webcast

I recorded an a webcast showing how to use the application to measure the compilation time of  JSPs. You can watch the webcast using the following URL:

The application that is shown in this webcast above is a first prototype, without any design touches. Part III of this posting will explain who to achieve a beautifully looking design almost without any extra work!

Download the Application

The application that is provided to download here is the one that is described in part III of this posting. It has the same functionality but includes a tiny bit of web design using the Twitter Boostrap framework.

You can download the new and pretty application from the following location:

http://munzandmore.com/downloads/wls12book/ForwardBS.war

forwardbs

Conclusion

Not precompiling your apps will cost you more than half a second per JSP. Use the application above to benchmark your system.

For an application with 5000 JSPs you will waste an extra 40 minutes waiting.