Tuesday, December 22, 2009

FAQ #5 - How to remote profile an ADF application deployed on standalone WebLogic using JDeveloper 11g R1

Introduction

Profiling is a valuable tool in the JDeveloper toolbox that can help us in the diagnosis of performance issues by identifying code that consumes more time, code that is called more often (CPU profiling) and how memory is used by the deployed application (memory profiling).

Main Theme

To demonstrate this FAQ, let's create a sample Fusion Web Application (Web) based on the HR schema. Let's create an Employee entity from the EMPLOYEES table and an Employees view based on the Employee entity. Finally, let's bundle the Employees view in the HrAppModule application module.

For the ViewController let’s create a View Activity called Employees directly in the unbounded adfc-config task flow and an Employees.jspx JSF page for the Employees View Activity. Finally, let’s drag the Employees view from the HrAppModuleDataControl in the Data Controls and drop it onto the Employees.jspx JSF page as an ADF Form.

Configure the application security and deploy onto the standalone WebLogic server as explained in FAQ #3 - How to deploy an ADF application on a standalone WebLogic server directly from JDeveloper.

If you have any issues related to security or connecting to the database when running the deployed application, take a look at the references section at the bottom for a couple of pointers.

Once the application is deployed, let’s verify that all is well by accessing the application URL in your browser. For the sample application attached, enter the URL http://localhost:7001/JDeveloperFAQNo5/faces/Employees. You should see the log in screen below.
   

 
Log in using jdeveloper/jdeveloper1. The Employees page below will be displayed.
 

 
OK, let’s do some profiling now!

To enable remote profiling, bring up the Project Properties dialog and select Run/Debug/Profile. Select the Default run configuration from the list of Run Configurations and click Edit….



In the Profiler page under Tool Settings enter the name of the package in our code based on which the profiler results will be filtered. For the sake of our sample application enter com.jdeveloper.faq.*. This will enable the profiling of all the java classes that we generated in the ADF BC.



Click OK a couple of times to exit from the Project Settings dialog and then save the project settings.

From the Run menu select Attach to | CPU Profilee.



In the Attach to CPU Profilee dialog select Attach to Local Process, select the weblogic.Server process and click OK.



Once attached, the Profiling ViewController tab will be displayed. Click on the Begin Use Case to begin a new profiling use case. That is, the icon on the top left with the green run triangle.



In order to generate profiling metrics, play around with the sample application deployed on WebLogic. As you can see CPU statistics are generated. The Hotspots tab displays the methods in the code where most CPU is spent in terms of percentage of CPU time. The Call Stacks tab displays the metrics in a different view.



There are all sorts of other goodies you can do while profiling. For example, saving a use case and then comparing it with the new one that you run after you make certain code changes could be useful to verify the changes in performance.

Conclusion

Profiling an application is another tool that could be of use when looking for bottlenecks and performance improvements in your application. It’s easy to setup and use. Give it a try!

Until the next time, keep on JDeveloping!

References

http://andrejusb.blogspot.com/2009/12/solving-error-403-forbidden-in-adf.html
http://radalcove.com/blog/?p=34 [at the bottom of the page]

Code

http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo5.rar










5 comments:

  1. Hi Nick,

    I followed your procedure but when I login into employees.jspx after authorization, I get a blank page with only outputtext at top. (security role in weblogic.xml is correct)

    Screen shot:
    http://img717.imageshack.us/img717/6817/23660110.jpg

    Anticipating your reply
    Regards-

    ReplyDelete
  2. Forgot to mention its displaying the data when I deploy it through the integrated server.

    ReplyDelete
  3. Hi Senthil,

    Can't tell you off hand what the problem might be. A couple of basics to try: 1) Ensure that the database connection is OK, 2) Ensure that WLS is setup for remote profiling. Are there any exceptions in the log?

    ReplyDelete
  4. Hi,

    You are profiling a local process, not a remote one (another machine)... this is not "remote profile" as the title says...

    ReplyDelete
  5. Can someone point out the instructions for remote profiling

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...