neharob / prettyfaces

Automatically exported from code.google.com/p/prettyfaces
0 stars 0 forks source link

Missing pretty-config.xml leads to bad performane #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the WEB-INF/pretty-config.xml is missing, there is no error or warning 
message in the logs and there is *severe* performance degredation.

REPRO:
1. Create a PrettyFaces web app with no WEB-INF/pretty-config.xml.
2. Deploy the web app in JBoss AS 7 with vanilla logging config.
3. Observe:

* No warnings or errors in the JBoss server.log file.
* The browser sees very long response times from the server for nearly all 
requests.

With the profiler, I could see that the PrettyFaces Servlet filter was 
configuring PrettyFaces from scratch on every single HTTP request.

EXPECTED:
* Some kind of warning in the log files, at least.
* Maybe application fails to deploy?

Environment:
* PrettyFaces 3.3.2 for JSF 2
* JBoss AS 7.0.2
* JSF 2, CDI, Seam 3

Original issue reported on code.google.com by joshua.d...@parityenergy.com on 23 Nov 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Is it safe to assume that you are running in Development PROJECT_STAGE? If so, 
PrettyFaces does reload the configuration on each request. However, this is not 
the case in Production PROJECT_STAGE.

Can you confirm?

Also, missing pretty-config.xml is not an error, so there is nothing to warn 
against :) Annotations (or zero configuration at all) is a perfectly valid 
scenario! The filter simply does nothing :)

Thanks,
Lincoln

Original comment by lincolnb...@gmail.com on 24 Nov 2011 at 5:41

GoogleCodeExporter commented 9 years ago
PROJECT_STAGE is set to 'Development'.   I have not changed that.

I thought you might say that missing pretty-config.xml is not an error.   
That's a perfectly reasonable design.   However, there is definitely something 
bad happening when pretty-config.xml is missing.   Without it, my application 
was taking more than ten seconds to serve a page (measured with Chrome).   The 
*only* change I made was to add an empty pretty-config.xml in WEB-INF, and the 
pages were served in less than one second.

The Yourkit profiler indicated that when the file was missing the filter 
(actually, some configuration class, I forget the name) was definitely doing 
*something*, that's how I got the idea to look at the prettyfaces docos and add 
the empty pretty-config.xml file.

Is it possible that it is scanning for annotations constantly?  I know from 
experience (with Seam 2 and my own stuff) that scanning can take a while.

Original comment by pgm...@gmail.com on 24 Nov 2011 at 3:35

GoogleCodeExporter commented 9 years ago
Thanks for sharing your observations. I'll try to reproduce this issue. I 
remember that some user on the forum also reported bad performance on AS7 but 
back then I wasn't able to reproduce this. But perhaps I had a 
pretty-config.xml in my project and the reporter of the issues not. ;)

Yes we are scanning classes for annotations on a regular basis. But this is 
only done in Development mode.  You can disable the configuration reloading by 
setting this configuration parameter:

<context-param>
  <param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name>
  <param-value>true</param-value>
</context-param>

However. I'll try to find the reason for this bad performance on AS7.

Original comment by chkalt on 24 Nov 2011 at 3:55

GoogleCodeExporter commented 9 years ago
Yeah. This definitely sounds like a problem. I agree. Thanks for working on 
figuring it out!

Original comment by lincolnb...@gmail.com on 24 Nov 2011 at 4:02

GoogleCodeExporter commented 9 years ago
Hey all,

I just tried to reproduce this issue. No luck. Everything works fine. 

Here is what I did: I took the Richfaces 4.0.0 showcase and deployed it to 
JBossAS 7.0.2. Everything works fine. The page loads in ~600ms (total of 25 
requests including all CSS and images files).

Then I added PrettyFaces 3.3.2 to the project (without any configuration) and 
deployed it again. The PrettyFilter starts up as expected. The loading time of 
the page now is the same as before. Around 600ms for the complete page.

I wonder what else may be causing this performance issue. Anything other 
special about your app?

You wrote that you used the Yourkit profiler to identify PrettyFaces as the 
source of the performance problems. Any chance that you could send us a thread 
dump or the profiling session? That could help us to identify the problem.

Thanks

Christian

Original comment by chkalt on 26 Nov 2011 at 10:51

GoogleCodeExporter commented 9 years ago
Sorry, haven't had the time to revisit this since adding the config file solved 
the problem completely (and very easily).

Original comment by pgm...@gmail.com on 16 Dec 2011 at 9:44

GoogleCodeExporter commented 9 years ago
Sure, no problem. It's really very weird that two people are running into this 
problem and that it's not reproducible for us.

Original comment by chkalt on 17 Dec 2011 at 6:29

GoogleCodeExporter commented 9 years ago
We have moved the project to GitHub.

If this issue is still relevant, please reopen it here:

https://github.com/ocpsoft/prettyfaces/issues

Original comment by chkalt on 7 Mar 2012 at 6:17