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.

 

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

Sounds cool, doesn’t it? Yet a bit academic – I agree. So why this title? It is as precise as it gets. And it’s less 140 chars, so I can even tweet it. Yet no worries, I’ll enjoy dissecting the headline for. There are a number of important messages. To make it more readable I will split it into three parts.

  • So let’s get to the topic right away (which by the way is precompilation).
  • To prove it makes a real difference, I will show in part II how you can measure the effect of precompilation since quite often people fail to do so.
  • Later in the cool part, part III, we look at some exciting bells and whistles for web applications (Twitter Bootstrap framework).

Precompilation

Why would you precompile your application?

Precompilation isn’t really necessary to make an application work correctly. WebLogic will compile necessary artifacts when they are needed. For example a JSP page which is not precompiled will be compiled at the time it is accessed.

Deploying an application without precompilation forces you to use lame excuses such as “It’s a bit slow right now, because it is running for the first time after deployment“. I am sure you don’t want to be remembered for lame comments. Running your applications without precompilation costs you time. And time is expensive.

What is the difference between precompilation and compilation?

Well, every Java class has to be compiled before it is executed by the JVM. The .java file is converted into a .class file. Other stuff, such as a JSP page could be deployed as is. It will then be compiled by WebLogic.

What can be precompiled?

If you don’t want to think about it, simply precompile your .war or .ear files. JSPs, web service artefacts and EJBs can be precompiled. Let’s look at the JSPs in more detail:

The JSP is converted into a servlet Java file which in turn is compiled into a .class file.

precompile a JSP

Precompilation after deployment?

You can request WebLogic to precompile your application right after deployment. To do so set the XML element <precompile>true</precompile> in the weblogic.xml deployment descriptor.

Many projects seem to use this solution, but it is certainly not the best idea. There are at least two reasons why I am not a big fan of this solution.

1.) Using the setting mentioned above precompilation happens right after deployment. This is the time when you want to show off your application. However, the application is not precompiled yet. Even worse, during precompilation system resources are used and the application is slowed down.

2.) When setting the <precompile> element, the application is precompiled after redeployment and after server restart. Do you really want your application to be precompiled after every server start?

Precompilation before deployment!

I recommend to precompile before you deploy. If building your application takes a long time, precompiling will make the process even longer. Then consider to have two different build targets: One for quickly testing your application without precompile, another one with precompile for load testing and deploying your application in an production environment.

After setting an environment suitable for running WebLogic commands from the command-line, all artifacts for an application surf.ear can be precompiled as follows:

java weblogic.appc surf.ear

Note, that the former JSP precompiler weblogic.jspc is deprecated.

Sometimes JSP fragments are included within a JSP yet these JSP fragments are not syntactically correct JSPs. Now if the fragments have a .jsp extension the precompiler will try to compile them and fail, therefore you should set the tag <precompile-continue>. Then precompilation will continue on errors.

Also there are faster compilers than javac. You can specify a different compiler with the switch -compiler.

Precompilation with Maven

If you use Maven to manage yours builds, Maven can call the application compiler appc for you when building you application. So everything in the paragraph above applies to building your application with Maven as well.

Possible Problems

If you precompile the deployment module before deploying, the classes will be added to the module and you should never see WebLogic compiling them again.

In case you are having problems with reoccurring precompilation, check the following issues:

  • Verify that the JDK version used to precompile is exactly the same as the JDK used to run WebLogic.
  • Make sure the time on the machine used for precompilation is synchronized with the machine where the application is deployed.

Conclusion

Precompilation isn’t a new topic, however it is often done the wrong way or it is not done at all.

Always precompile your deployments unless you manually create a quick distribution for testing during development. Don’t precompile using the <precompile> deployment descriptor after server start.

Add the precompile step into your continuous build process.

Additional Links:

WebLogic 12c deployment descriptor documentation for precompile:

http://docs.oracle.com/cd/E24329_01/web.1211/e21049/weblogic_xml.htm

Using WebLogic Maven plugin:

http://docs.oracle.com/cd/E24329_01/web.1211/e24368/maven.htm

WebLogic Maven appc goal:

http://docs.oracle.com/cd/E24329_01/web.1211/e24368/maven.htm#CHEBEHEH

Review: WebLogic 12c Distinctive Recipes Workshops in AUS (Brisbane, Adelaide, Perth)

Reviews and Attendee’s Opinions

My WebLogic 12c training courses in AUS were a great success so I’d like to share the reviews with you. My special thanks go to AUSOUG president John Bushell for making this possible and Burke Scheld for organizing the events.

 

workshop perth

 

what Did you like about the workshop?

 

I got some really nice feedback after the presentation, here is all the answers.
Tricks and Tips :)
4/22/2013 3:31
Info about the non-core tools and tricks, very handy to get to hear about little odd things like that.
4/22/2013 3:24
Useful hints and tips, and a good overview of WebLogic 12c
4/22/2013 3:18
Useful open source software and administration tips
4/20/2013 2:13
It covered some left of field topics and points – some of the things I was hoping for.
4/19/2013 1:46 PMView
Good tips on tuning. Good opensource tool suggestions.
4/19/2013 11:44
Grand
4/18/2013 5:35
Tips and tricks on weblogic server management.
4/18/2013 4:10
Live demos, interesting content
4/18/2013 3:04
Opportunity to see things that are new to me in a class room environment
4/18/2013 2:55
Good independently sourced information about Weblogic features and capabilities. The idea of using virtual images helps to set a test environment quickly. The expertise of the presenter makes him capable of providing information that is beyond what you can find on the official Oracle docs.
4/18/2013 2:47
Good presentation, good explanations, aimed at the right level for me.
4/18/2013 2:16
We can discuss the good, as well as criticise the bad, features of Oracle software.
4/18/2013 2:02
Frank provided information about some useful tools that I wasn’t aware of. The overview of the new features in 12 was good. The configuration tips were handy. The cost of the workshop was very reasonable for the information gained from it.
4/18/2013 1:54
To get an overview of technologies and to discuss those.
4/18/2013 1:51
Well presented with references to resources for continuing help
4/18/2013 1:49
Nice pens from the presenter. And the idea of giving away a free book.
4/11/2013 2:59
Interesting insite into some open source tools that enhance the administration features of WebLogic
4/11/2013 2:43
Frank obviously knows his stuff, and backs up recommendations with excellent real world examples.
4/10/2013 1:26
Very well presented. Topics were relevant and current

Comments about presenter:

Good presenter, and well prepared. Always interesting
4/22/2013 3:18
Experienced and keen to answer questions and offer advice
4/20/2013 2:13
Good relaxed presentation with time to digest the material – thankyou well done
4/19/2013 1:46 PMView
Frank was a great presenter and his style was very professional. English was very good and understandable.
4/19/2013 11:44
Knowlegable, responsive, good communicator
4/19/2013 1:21
Frank had good experience and knowledge of weblogic server.
4/18/2013 4:10
Frank Munz was knowledgeable, concise and to the point
4/18/2013 3:04
Friendly, knowledgeable
4/18/2013 2:55
Well prepared, you can tell that he has a long experience with the platform
4/18/2013 2:47
Very good, knowledgeable, easily understood
4/18/2013 2:16
Frank is an excellent presenter and very knowledgeable about almost every aspects of Weblogic software.
4/18/2013 2:02
I liked Frank’s relaxed presentation style and the depth of his knowledge of the product.
4/18/2013 1:54
Excellent guy who knows what he’s talking about, broad range of experience and good examples.
4/18/2013 1:51
excellent presentation style
4/18/2013 1:49
I like how he is not biased towards a brand of technology but instead rationalises upon technology choice depending on immediate/long term goals.
4/11/2013 2:59
Great presentation – really informative and easy to follow.
4/22/2013 3:24
Good presenter, though he gets a little carried away reiterating key points :)
4/11/2013 2:43
Frank is organised and knowledgeable and presents with a comfortable, easy to listen to style.
4/10/2013 1:26
Very nicely presented
4/10/2013 12:34

 

More?

Learn about my internal WebLogic 12c training offerings.

Oracle SOA Suite for the Busy IT Professional

SOA Suite

Oracle SOA Suite is certainly the most comprehensive and also the most complex product of the classical WLS / OSB / SOA Suite stack. There are plenty of tools and other products tightly interwoven with SOA Suite:
It all starts with the installation where a supported database is required for the meta data repository. The necessary schema are created with the separate repository creation utility (RCU).  Testing processes is done from Oracle Enterprise Manager. Finally developing BPEL processes requires JDeveloper as an IDE.

That’s it to get started yet more complex projects often involve a Oracle Web Service Manager, and sometimes a repository and a registry.

Oracle SOA Suite Introduction

 

The recipe below is part III of a series of introduction recipes covering Oracle Fusion Middleware. It’s reduced to the max and as buzzword free as it gets. It certainly doesn’t replace an in-depth training though.

 

… better read this first

For a better understanding make sure to read part I and II first:

Part I: Basic SOA Principles (not really related to OFM) and Oracle Fusion Middleware (OFM) Introduction

Part II: Oracle Service Bus (OSB) for the Busy IT Professional – an Introduction

Part III: this document

 

Download the Oracle SOA Suite Introduction Recipe

You can download the SOA Suite recipe as a PDF file from here. Enjoy!

 

More?

This recipe is straight out of my book WebLogic Server 12c: Distinctive Recipes

 

Oracle Coherence with WebLogic 12c

Collecting material for the next edition of my WebLogic 12c book I began writing a primer about Oracle Coherence from a WebLogic perspective. Coherence is part of the WebLogic Suite and you can start using it right away.

Many WebLogic professionals still consider Coherence as something complicated and challenging to get started with, so I made a number of hands-on Coherence primer screencasts available – also more blog postings with best practices will follow.

Make sure to subscribe to WebLogic book YouTube channel: http://www.youtube.com/weblogicbook

 

Basic Introduction

Coherence is a coherent data grid that provides a number of different cache implementations, which are well described here. The following figure illustrates how data A. B, C is stored into different nodes with the same put(key, value) method.

coh_cache impl

Oracle Coherence Basics, Multicast Test and Firewall Issues

Oracle Coherence Command Line, Replication and Availability

 

 

Development with NetBeans Introduction

Oracle Coherence NetBeans API and NamedCache

 

 

Coherence ActiveCache with WebLogic

Coherence ActiveCache can be used to offload session data from WebLogic into Coherence cache nodes. These cache nodes can be managed with WebLogic Nodemanager. A detailed explanation can be found here.

coh_wlsdomain

 

Oracle Coherence ActiveCache for WebLogic 12c configuration

 

Oracle Coherence ActiveCache Demo for WebLogic 12c

 

Oracle Service Bus (OSB) for the Busy IT Profesional

Audience

Oracle Service Bus is one of these software products that haven’t changed much in their core since many years. These days I tend to see more and more OSB projects and one reason certainly is that license wise OSB is included with Oracle SOA Suite.

Compared to SOA Suite, OSB is conceptually different though. Even with a good understanding of SOA Suite (which I will cover in one of the following posts), there will be a slightly steep, but rather short learning curve for OSB.

The following recipes tries to motivate and explain the usage of OSB without the usual marketing hype. Make sure to read the previous posting about getting started with SOA in general and Oracle Fusion Middleware.

Technology

OSB is virtualizing service calls from clients to the service implementation. By using so called proxy and business services (both are components within OSB) incoming and outgoing requests can be arbitrarily connected and protocols can be converted. Proxy services contain the processing logic (validation, enrichment, transformation etc.).

Oracle Service Bus OSB Architecture

Download

If you are trying to get started with OSB, here is the link to download Oracle Service Bus Overview and Getting Started (PDF).

Enjoy!

PS. Actually this recipe is taken out of my book Oracle WebLogic Server 12c – Distinctive Recipes.

SOA and Oracle Fusion Middleware for the Busy IT Professional

Audience

Not everybody is starting up JDeveloper first thing in the morning in order to work with Oracle SOA Suite. Let’s face it: Instead of being an SOA expert, any given IT specialist is more likely a certified DB admin, a Java developer or somebody who was just told by his manager to take care of that Oracle Service Bus installation. In case you are one of them and looking into SOA and the related Oracle products this posting is written for you.

Technology and Oracle

The following two recipes provide firstly a no-nonsense explanation of Service Oriented Architecture (the first part is not related to Oracle at all !) and secondly an overview of Oracle’s Fusion Middleware (OFM) product stack.

ofm stack

The description is deliberately easy to read and I intentionally didn’t reuse any fancy marketing slides since they are often too generic and contain too many buzzwords.

Download

For everybody trying to get started and reading a 101, here is the link to download SOA and Oracle Fusion Middleware for busy IT professionals (PDF).

Enjoy!

PS. Actually these two recipes are taken out of my book Oracle WebLogic Server 12c – Distinctive Recipes.

Oracle WebLogic Server 12c in 7 Cities of Australia!

AUSOUG Workshop Series 2013 with Frank Munz

 

This independent workshop is run by Frank Munz, Oracle Technologist of the Year 2011 and published author of WebLogic 12c: Distinctive Recipes and Middleware and Cloud Computing. Frank was running the popular Oracle and Amazon Cloud Workshops in 2012 and now presents a 3h workshop based on his new WebLogic 12c book in 2013.

wls12book3d_lying

Workshop Details

Duration: 3h including a short coffee break

Content: In the workshop we will cover worthwhile WebLogic 12c features, best practices (also applying  to earlier version of WebLogic), default settings that you should better change, security glitches, useful open source tools and other stuff Oracle doesn’t tell you about.

The workshop will be centered around the core WebLogic technologies. We will examine the interesting new features of Java EE 6, the merged JVM, configuration management, debugging of memory leaks, stuck threads, deployment of configuration settings with application modules, performance tuning tools and mistakes, custom JMX MBeans, etc.

Format: The workshop will contain lots of live presentations. An Oracle Virtual Box Image with all the examples will be provided at the end, so you take them away and use them any time you like on any computer. (Note: The Virtual Box Image won’t contain Oracle WebLogic Server which can be installed in a couple of minutes.)

Target Audience: Ideally you have some hands-on experience with WebLogic, but even if you are just starting and looking for an overview of the exciting parts you are most welcome. The workshop is suited for architects, administrators and those developers interested in more than just Java EE standards.

Links:

Frank’s WebLogic 12c book: http://www.amazon.co.uk/dp/0980798019

twitter:         @frankmunz
blog:              http://www.munzandmore.com/blog

Subscribe to the WebLogic 12c webcast channel on YouTube with over 30 free WebLogic 12c videos available online: www.youtube.com/WebLogicBook

Registration:

For registration check the AUSOUG site first.

$95.00 (inc GST) for members

Dates and Venues:

Broome Western Australia (c) F. Munz

Seats are still available for the following venues:

Apr 8, 2013: Brisbane

Apr 10, 2013: Sydney

Apr 15, 2013: Hobart

Apr 17, 2013: Adelaide

Apr 19, 2013: Perth

Apr 11, 2013: Canberra

Apr 12, 2013: Melbourne

3h are too short? You’d rather prefer an in-house WebLogic 12c workshop? Feel free to drop me an email! All my workshops include course material, all lab applications to take away. Also typically a VirtualBox image is provided so you can ran any example at any time and anywhere.

About Frank:

fm_test3Dr. Frank Munz has over 15 years’ global experience with top middleware vendors such as Sun and Oracle. A middleware and distributed-computing expert, Frank has a Ph.D. in computer science and has published more than 20 peer-reviewed scientific papers and over 200 articles.

Frank’s consultancy, munz & more, focuses on Oracle middleware and cloud computing, offering a high-end training program worldwide.

Oracle rewarded Frank with the Oracle Technologist of the Year award in 2011.

Frank loves to talk about features and showstoppers at conferences all over the world.

 

Reviews and Attendee’s Opinions

Click here for the reviews of the WebLogic training course (Brisbane, Adelaide, Perth events)

New Book WebLogic Server 12c: Distinctive Recipes (Architecture, Development and Administration)

writers

My new WebLogic book is published now!

  • Over 40 videos replacing the boring screenshots used in typical cookbooks.
  • No “Click here. Click there.” instructions
  • Useful recipes
  • Download deployment modules: Web Services, EJB 3.1, Timer EJBs etc
  • Q&As
  • Best Practices
  • Default parameters that you should better change
  • Performance glitches you should be aware of
  • Open source projects you have to know
  • Stuff Oracle doesn’t tell you about…
  • Published in Australia. Click on the book image to buy.

 

WebLogic 12c Book: Distinctive Reciopes (Architecture, Development and Administration)

Check out the book’s homepage.

 

 

DevOps Basics II: What is Listening on Open Ports and Files – WebLogic Essentials

Situation

who_is_listeningCan you easily find out which WebLogic servers are listening to which port numbers and addresses?

Imagine a multi-project machine with a dozen IPs and tens of domains. When trying to start WebLogic another process has already bound to the address and port so you get the following Java exception:

java.net.BindException: Address already in use

What is listening to a particular port on a certain IP?

Is it a WebLogic? If so, what is its domain name and directory?

Solution

There is a helpful UNIX command lsof (the name means “list open files”).

Description

Actually lsof is very versatile. Here are some examples of its usage.

Find what is listening on localhost and port 7001 on the local machine.

$ lsof -i @localhost:7001

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

java    2802 oracle  397u  IPv6  37417      0t0  TCP ccloud:afs3-callback (LISTEN)

You can tell from the output it is a Java process with PID 2802. To find out more about the Java process, (is it really WebLogic or maybe the Derby database or node manager using a weird port number?) narrow it down with ps.

 

$ ps -ef | grep 2802

 

oracle    2802  2746 18 10:40 pts/2    00:03:10 /usr/java/jdk1.7.0_04/bin/java -client -Xms256m -Xmx512m … .
-Dweblogic.Name=AdminServer … weblogic.Server

Looking at -Dweblogic.Name=AdminServer in the output above tells you it is a WebLogic admin server running. Now if you’d followed recipe 7 you could determine from the username the name of the WebLogic domain. Then you could conclude the domain directory from the domain name.

Discover Domain Name and Directory

Even if you didn’t follow recipe 7 with regard to users and names, there is still a solution. Here comes another trick with lsof (this is why I mentioned that it is so versatile!).

You can still find out what domain the WebLogic instance belongs to by looking at the files it has opened. In particular, you want to see the log files it has opened, because they belong to the domain and unveil the domain directory.

$ lsof -p 2802 | grep ‘\.log’

The last line in the output looks as follows:

java    2802 oracle  348w   REG      253,0        0 261838 /u01/domains/surfandconsulting/servers/AdminServer/logs/access.log

You can easily narrow down the grep command above if you know that your domain directory contains e.g. the word “domain”.

 

Process holding a file

You can also do it the other way around. Find out which process has a particular file opened.

$ lsof /domains/surfandconsulting/servers/AdminSrv/logs/access.log

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME

java    2802 oracle  348w   REG  253,0        0 261838 /domains/surfandconsulting/servers/AdminServer/logs/access.log

The output is telling you it is a Java process with process ID 2802, so you could use ps again to find out what exactly this Java process is.

 

 

Binding  to name

Check if WebLogic is listening to a particular name, e.g. the host name of the machine.

$ lsof -i @ccloud:7001

 

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

java    2802 oracle  397u  IPv6  37417      0t0  TCP ccloud:afs3-callback (LISTEN)

From the output you can tell it does!

Binding to IP address

Check if WebLogic is listening on the local machine to the address 192.128.9.1

$ lsof -i @192.128.9.1:7001

There is no output, so WebLogic is not listening to this address.

 

 

Hands-on Webcasts

I recorded a hands-on webcast available that walks you through the usage of lsof.

 

Oracle WebLogic Server 12c: Distinctive Recipes

Many more recipes are contained in my new WebLogic 12c book.

How-to: Starting with Oracle Service Bus

I will use this posting to collect my own recommendations for everybody starting with Oracle Service Bus (OSB).

- Get a formal training. Unlike SOA Suite, where 5 days of training merely scratch the surface, a good OSB training can cover most things you have to know in a week. There is a rather steep learning curve and the official documentation is slightly less brilliant than let’s say Weblogic documentation. “SOA” generally speaking involves more marketecture.

- If you are really new to OSB, then create a simple project with pipeline pairs and stages and find out the order how the actions are executed in the response pipeline. An easy challenge with at least two different approaches, yet sometimes the solution is not that obvious.

- After the training try it yourself. Develop a super simple web service, then call it through OSB, e.g. using SOAPUI or even the WebLogic admin server as a client.

Books

- Get the OSB cookbook from Schmutz and colleagues for further assistance. It’s a cookbook as it says in the title, so don’t expect a lot of explanation or too much background information. Yet it will support you doing more difficult tasks. According to an Amazon review the ebook has some problems (which well be fixed soon I hope!). I recommend it for everybody who is not working everyday with OSB. All examples worked for me so far.

- You may consider the OSB book from Davies, but I personally don’t recommend it for anybody who is not a real expert (then, why would you need a book?). At least don’t expect any simple explanations in the book.

Build

Check out Biemond’s blog posting for deploying OSB and OFM with Puppet.

 

Underlying Tech

If you need a refresher for XPath or XQuery I recommend the free and brief tutorials at w3schools.

Very readably introductions to XSD, XML Namespaces, WSDL and versioning of web services can be found in Thomas Erl’s book about web service contract design and versioning.

 

Links

- Check the following link on slideshare for the new OSB 11g features.

- Calling custom code: Java callouts and custom XPath.

Limitations of OSB

Understand the current OSB 11g limitations. It’s still using Eclipse but all the rest of Oracle SOA Suite has changed to JDeveloper already. So working with OSB and SOA Suite is a bit cumbersome at the moment (you need 2 IDEs when deploying an JCA adapter, XQuery functions differ etc.).

 

Make sure you have a good start with OSB – I personally think it’s a great product of the Oracle SOA stack!

 

DOAG 2012 Konferenz: WebLogic and Cloud Talk

WebLogic Talk

I will hack a WebLogic password live at DOAG 2012 conference ;)
… and explain 9 more things you should know about WLS12c. Mostly stuff out of my WebLogic Advanced Recipe book.

There will also be some chocolate and a book to win!

My WebLogic 12c talk on Tuesday.

Cloud Talk

Don’t miss my cloud talk! I will demonstrate live a couple of things you won’t be able to with the Oracle cloud ;)  Public Cloud talk on Wednesday. More chocolate and of course another book to win!

WebLogic 12c JMX DevCast

I was doing a DevCast on behalf of the Oracle WebLogic team.

Learn about the WebLogic 12c JMX ecosystem: JMX clients, WebLogic scripting tool, JConsole, Jolikia JMX shell with syntax highlighting and tab completion, developing MBeans for your own applications with Spring and Java EE 6.

The slides can be accessed from here as PDF. They are just supporting the presentation, so I recommend to grab a coffee and watch it instead.

It’s a free DevCast, sign up by clicking on the image below.

Enjoy ;) You’ll find many more recipes in my WebLogic 12c book.

Using Apache Derby Database with WebLogic (the express way)

this is more a note to myself, because I keep forgetting the details and then I get angry about myself when I am in a hurry ;)

If you quickly require a database with WebLogic 12.1.1 (or some other version 10.3.3 or later, because since then WLS comes with Derby) and some content (e.g. to try some monitoring tool or a WLST script or something), do the following:

- make sure you have the WebLogic samples and the sample DB installed.

- create a new domain.

- in the domain’s setDomainEnv.sh under DOMAIN_HOME/bin
change the DERBY_FLAG from false to true.

- start the Admin server which will start the Derby database as well.

- Create a data source using the following values:

 DBName: medrec
 Host: localhost
 Port: 1527
 Username: medrec
 Password: medrec

- Test the connection pool after creating it. It should work right away.

Done!

 

 

more details, recipes and discussions …

DevOps Basics I: Track Down High CPU Thread with ps, top and the new JDK7 jcmd Tool.

I captured the following webcast last night. I was writing about how a clever combination of simple tools like ps, top and jcmd can help to track down the Java code that is causing a thread to consume a high amount CPU time.

The approach is very generic and works for WebLogic, Glassfish or any other Java application. UNIX commands in the example are run on CentOS, so they will work without changes for Oracle Enterprise Linux or RedHat.
Creating the thread dump at the end of the video is done with the jcmd tool from JDK7.

The webcast uses the StuckThreadForFree sample application which is specific for WebLogic 12c and can be downloaded from my stuck thread recipe.

Oracle Database as a Service in the Amazon Cloud: Now with APEX, Oracle XML DB and your Data Center’s IPs.

Amazon Web Services improved its Relational Database as a Service (RDS) for Oracle. It now supports APEX (finally, see the lengthy APEX discussion here), the OracleXMLDB and Virtual Private Cloud (VPC).

For more information:

 

IOPS Quality of Service for Amazon EBS Cloud Storage

Define the pipe!

You can now have EBS optimized EC2 instances with e.g.  500 or 1000 Mbit/sec throughput to EBS.

According to AWS a standard EBS volume will cope with 100 IOPS on average allowing some burts. As I mentioned before there was plenty of complaints and discussion about EBS performance workarounds though. Here is the news: AWS is offering provisioned IOPS EBS volumes. You can create up to 20 TB of provisioned IOPS volumes with a total of 10,000 IOPS per AWS account (but apply to extend your AWS account for more).

Seems like a lovely idea for a db data file, doesn’t it?

Does that make you run your EBS I/O benchmark again? Let me know about the results!

Simple Custom JMX MBeans with WebLogic 12c and Spring

Using the Spring framework bundled with WebLogic 12 the programming of JMX MBeans becomes as easy as writing a simple POJO within a web application. After coding the MBean as a POJO all that is left to do is creating the Spring configuration file and editing the web.xml deployment decriptor:

- Firstly you have to add the Spring <listener> to the web.xml deployment descriptor with the web.xml to get Spring started.

- Secondly create the applicationContext.xml for Spring in the WEB-INF subdirectory. Declare the Spring bean and let Spring export it to the platform MBean server.

- Thirdly deploy the web application and test it with JConsole, WLST or j4psh.

For your convinience I already built an example. You can download the deployable SimpleJMX.war file or the complete NetBeans project.

You can see the application in action, including the involved files and the deployment in the following screencast:

How to access custom MBeans from WLST is shown in the second part:

The third part is showing how to retrieve MBean attributes from a JSP:

Amazon / Oracle Cloud Workshops: Mission Completed

I am just back from a successful, long and intensive trip to Australia. If you are waiting for a reply to an email there is a good chance you will get it soon now.

I delivered an  Amazon and Oracle public cloud workshop series on behalf of AUSOUG, based on my cloud computing book: 6 cities, 6 workshops of 4 h each, almost 200 attendees, hands-on, live development in the cloud (WebLogic with 61 GB heap deployed live on 3 continents, cloud storage, auto scaling, transformation of a classical Java EE app in the cloud), 16 flights (including a 1 week trip to the outback, flying 2,5 h north of Perth and driving 2200 km for shooting the cover image for my upcoming WebLogic 12c: Advanced Recipes book).

Check out the flattering reviews for the event.

 

 

thanks to everybody who attended!

 

Amazon Web Services (AWS) EC2 Autoscaling

 

How many blog posts have you read that were written on a ferry? Well this is post makes it one more. Live from famous Manly ferry since I am currently offering a number of Amazon and Oracle Cloud Computing Workshops in Australia.

Elasticity is a key criteria for cloud computing. Autoscaling is automated elasticity. Interesting enough is widely unknown how this will be implemented on the Oracle Public Cloud for the Java Service.

Autoscaling on AWS can only be configured with lengthy commands from the command line but not from the web cased AWS console. Getting all the parameters right can be tricky, so here is one of the easiest examples and a hands-on screen cast using it:

 

 

[shell]

as-create-launch-config surfLaunch –region ap-southeast-1 –key access –image-id ami-b83374ea –instance-type t1.micro
as-create-auto-scaling-group surfScale –launch-configuration surfLaunch –region ap-southeast-1 -availability-zones ap-southeast-1a,ap-southeast-1b –min-size 2 –max-size 4
as-describe-auto-scaling-groups –headers –region ap-southeast-1

as-describe-auto-scaling-instances –headers –region ap-southeast-1
as-put-scaling-policy ScaleDown -auto-scaling-group surfScale –adjustment=-1 –type ChangeInCapacity –region ap-southeast-1
as-put-scaling-policy ScaleUp -auto-scaling-group surfScale –adjustment=+1 –type ChangeInCapacity –region ap-southeast-1

 

as-execute-policy ScaleUp –auto-scaling-group surfScale –region ap-southeast-1

as-describe-scaling-activities -g surfScale –region ap-southeast-1 –show-long

 

as-execute-policy ScaleUp –auto-scaling-group surfScale –region ap-southeast-1

 

mon-put-metric-alarm HighCPUAlarm –comparison-operator GreaterThanThreshold –evaluation-periods 1 –metric-name CPUUtilization –namespace “AWS/EC2″ –period 600 –statistic Average –threshold 80 –alarm-actions “XXX” –dimensions “AutoScalingGroupName=surfScale” –region ap-southeast-1

 

mon-put-metric-alarm LowCPUAlarm –comparison-operator LessThanThreshold –evaluation-periods 1 –metric-name CPUUtilization –namespace “AWS/EC2″ –period 600 –statistic Average –threshold 20 –alarm-actions “XXX” –dimensions “AutoScalingGroupName=surfScale” –region ap-southeast-1

 

REMOVE ALL:

as-update-auto-scaling-group surfScale –min-size 0 –max-size 0 –region ap-southeast-1
as-delete-auto-scaling-group surfScale –region ap-southeast-1

as-delete-launch-config surfLaunch –region ap-southeast-1

 

[/shell]

The comments section is open now for your suggestions how this will be done with the Oracle Public Cloud.

EJB 3.1: Stateless Session Bean Deployed as .war, Dependency Injection, Asynchronous Methods

Development of an EJB 3.1 stateless session bean has become incredibly simple. You add an annotation, there is no XML required at all, no need to implement an interface anymore, and you can easily implement asynchronous methods that decouple your client calls from the method execution. Then, at the end you deploy the EJB as a simple .war file – no need to warp it in an .ear file.

 

The following screencasts explain you how to do it. You can also download the whole NetBeans project  or just a deployable .war file exactly the sources created in the screencasts.

 

Simple Stateless Session Bean with asynchronous method, developed with NetBeans 7.1 and deployed as .war file:

Asynchronous Methods with Stateless Session Bean:

Inject Stateless Session Bean into Servlet:

 

Here is a tough question at the end:

Imagine you have to add a WebLogic specific settings for your stateless session bean. There is no annotation for that. These settings have to be put in the deployment descriptor which typically used to be the weblogic-ejb-jar.xml file within an .ear file. But what if you have already build a .war file which is perfectly possible now (and neither an .ear nor an ejb.jar file).

Where do you put these settings then? Post your answer here.

Oracle DB with OEM in Amazon Cloud

Since today Oracle EM is available with the Relational Database Service in Amazon Web Services.

RDS instances come with a free trial for 60 days and there is no additional cost for OEM.

I recommend to read my Cloud Databases whitepaper to get started, follow the discussion of Oracle DB instances in this previous posting and give it a try yourself.

Here is a screencast that explains how to create an Oracle DB instance in AWS, how to enable OEM (just in case you are an admin) and how to connect to your cloud instance with a local installation of NetBeans (in case you are a developer).

 

AWS Cloud: Use Same Access Key in Different Regions (or in All Regions)

In the Amazon cloud you require an access key to connect to your instances. This key is can be generated when you create your first instance. It’s then downloaded to your client and you specify it when connecting to the instance. Typically you need one key per AWS region.

However, you can use the same key also for different or all regions. You have to connect to a running instance and then copy it from the instance’s authorized_key file under .ssh/and import it as a key pair in the new region as shown in the following video.

Web Service Development with NetBeans and Testing with WebLogic Admin Console

Developing of SOAP based web services for WebLogic 12c (or any other application server) with NetBeans is a breeze. You can do it without using any templates or IDE wizards, no XML is required, no modification of deployment descriptors.

The following screencast shows how to develop the most simple web service pobbislbe, how to test it entirely with WebLogic admin console, and how modifying the web service will work without redeployment.

WebLogic 12c Configuration Management: Change Your Defaults to Track What Happens

Good morning. I just finished the chapter about configuration management for my new WebLogic book. Here is a very short summary of it.

There is a number of default configuration settings that I recommend to change to better keep track of configuration changes. The screencast showing you hands-on how to do this is still rendering and will be available once you are reading this (you can subscribe to all of them here).

After creating a WebLogic domain, consider the following:

 

1.) User personalized administration users.

2.) Audit WebLogic configuration changes (including usernames) so you will know who changed what.

3.) Enable the configuration archiving so you will be able to revert to a previous set of configuration files.

 

None of these settings are enabled per default. All of this you should think about for your environment.

Here is the three-part screencast how to enable it (switch to HD quality and full screen).