aspose file tools*
The moose likes JSF and the fly likes javaURLContextRoot.lookup called many times by JSF/Richfaces. CPU Usage is 100%. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "javaURLContextRoot.lookup called many times by JSF/Richfaces. CPU Usage is 100%." Watch "javaURLContextRoot.lookup called many times by JSF/Richfaces. CPU Usage is 100%." New topic
Author

javaURLContextRoot.lookup called many times by JSF/Richfaces. CPU Usage is 100%.

Sachin Jha
Greenhorn

Joined: Aug 15, 2011
Posts: 2
Technology used in UI is JSF Richfaces & Seam.
Number of concurrent users are 300-400.
Application is of midium size with 20-30 screens.

While doing performance testing we found that "javaURLContextRoot.lookup" is being called 30-40 times per screen for a user. Even on simple onchange listener ajax call 10-15 times lookup() is called.

Looks like its called by richfaces. Its causing to much CPU utilisation: mostly around 97-100% (with 300 users).

I will be gratefull if someone can show me a way to fix this high CPU Usage. I am pretty good in web layer development but never experienced things like this. I have 7-8 months exp in JSF & Richfaces.

Thanks in advance.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Hi and welcome to the JavaRanch.

CPU usage is meaningless. If I run an application with 50 users on my laptop I'll get the same cpu usage.
How much time is spend in this method and why do you think that it is invoked to many times?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Sachin Jha
Greenhorn

Joined: Aug 15, 2011
Posts: 2
We are using HP Diagnostics to see which methods is called how many times. Thats showed us the lookup being called so many times. And its around 20000 times for 300 users just doing a simple search after loggin in.

Our company enforces us to make sure CPU is not crossing a defined limit. Not sure whats the limit but it should be belore 70% i think.

I just dont know if lookup is really neccesary by richfaces or its something which we can control or improve.

Thanks a lot for replying.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16134
    
  21

Considering that every J2EE webapp resides under a URL Context root which is the anchor for each and every resource in the webapp, I don't find it surprising that that particular function is very popular.

On the other hand, I would look more closely to make sure that the function that you THINK is consuming the CPU is really the one that DOES consume the CPU.

I can't fault 70% as a safety margin for webapp operation. Management may press employees to "give 110%", but pull that stunt on machines, and they'll quickly show you what happens when you don't have reserve capacity. I can tolerate 80-85% myself, but that's because I'm in charge of overall keeping things in line and not depending on people who working at 110% to step in when the pressure begins to build.

While it's possible that you can tune some of the higher-level functions to reduce the overall CPU consumption, you might also simply be demanding more than the hardware/software platform can give. I've never been all that certain that I could call JSF a "lightweight" framework, and 300 concurrent users is definitely not casual use.

Fortunately, JSF allows intermingling technologies. If a particular function requires too much, you can swap it out for something more performant, such as Struts or even raw servlet/JSP without having to scrap the parts of the JSF app that don't have that limitation.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javaURLContextRoot.lookup called many times by JSF/Richfaces. CPU Usage is 100%.