JSF performance problems with ajax requests - java

I am trying to find a bottleneck in a web-application running on JBoss.
I have a module that contains forms for which when moving from field to field I do some server side validation of the data, using Ajax (those validations take below 1 ms). The modules are used in two separate web applications:
One running on Apache Tomcat Application Server, where each
validation takes about 200-400ms;
Second one running on JBoss 7.1.1, where each validation takes about
3-5 sec. The problem here is that I have the exact same modules as those used on the Tomcat and the 5sec delay is really not an option.
I've measured the times anywhere I could, but I couldn't find any bottlenecks in the application, running on JBoss.
So I used JProfiler and thread dumps to try find the problem. Here's a screenshot of the result.
To me it looks like a problem in jsf/richfaces, but I am not sure for the exact reason and what can be done to fix this.
I'm using:
jboss 7.1.1, patched with jsf-impl-2.1.19-redhat-1
Richfaces 4.2.3.Final
jboss-jsf-api_2.1_spec-2.1.19.Final-redhat-1
What I've tried is: using the latest richfaces version, changing the viewstate of jsf to server side, enable partial state saving.
Here's JProfiler screenshot:
From it for me it seems that the performance issue here is with javax.faces.view.facelets.ComponentHandler.applyNextHeader
I am running out of ideas, any hits would be appreciated.

Check your JSF PROJECT_STAGE if it is development. If so, try changing it into production.
You can do it by removing the <context-param> with name of javax.faces.PROJECT_STAGE from your web.xml, or set its value to Production instead of Development.

Related

seamless redeploy for java web application

I am working at a startup, we are just about to roll out our first beta. Knowing that we will be having a good number of users, we want to have seamlessly deployment when we are adding new features.
I have worked with windows azure before, and I know they support seamless deployment, so I did some googling and cloudbees was the first result.
So the question is, with what we have now (geronimo server, rackspace hosting), is it possible to seamlessly redeploy a java web application? If so, how?
Are there other alternative solution, such as using another hosting provider or use a different web server? (Because it is a startup, it would be beneficial if the answer keeps scalability in mind)
If with a seamless redeploy, you mean an upgrade of your application without any downtime or restarting of your server, LiveRebel might be something to look at.
See http://zeroturnaround.com/liverebel
There are a lot of methods for doing this in the java world. If you don't use sessions (or use shared sessions between app servers) you can do a rolling stop/deploy/start of your appservers, taking 1 offline at a time and using a load balancer to ensure that traffic goes to the other servers.
I have heard Glassfish has such feature, the reference probably ment this (Glassfish 3.x redeploy command) : http://docs.oracle.com/cd/E19798-01/821-1758/6nmnj7q1h/index.html

Suggestion GWT High Scale Application Server

Currently I am working on a Large Scale Application which uses GWT with Hibenate. We are facing some performance issues with existing Jetty / Tomcat server. And we want a another server that handles hibernate queries and GWT both perfectly.
Problem with tomcat is it sometimes stops responding GWT requests, and client hangs up on some points.
There are certain servers that comes in my mind like :
GlassFish
Jboss
IBM WebSphere AS
etc.
Please suggest some high scale server that handles GWT RPC request well and can run in multi-client environment well. We are expecting 100 concurrent users, Hardware is not an issue.
Thanking You,
Regards,
I think that your problem is not related to Tomcat or Hibernate. Your application should have scalebility problem. I do suggest you to investigate your application before investing to a fancy application server.

How can I embed Weblogic server in java?

I am searching any way for embedding Weblogic server in Java , I know its possible because we have maven plugins for Weblogic which embeds Weblogic in maven, But googling for it did'nt gave me useful output, Does anybody know how can we embed wemlogic in java program ?
WebLogic doesn't provide an embedded API so, even if it's a pure Java Server and if you can thus call weblogic.Server from Java code, you will have to handle everything yourself (starting the container, waiting until it's started, deploying things, waiting until they are deployed, etc). In other words, this will require some work.
Maybe have a look at the sources of Cargo, although Cargo isn't really starting an embedded Weblogic (i.e. running weblogic.Server in the same JVM). This will give you an idea of what has to be done. Or, depending on your needs, use Cargo Java API.
But if you need a full Java EE server and if this is an option, I would use GlassFish v3 in embedded mode instead of WebLogic, it will be much simpler. Check the following links and see yourself:
Embedding Glassfish V3 in Unit Test - Two Jars, Three Lines Of Code And Five Seconds Start With Deployment
Embedding EJB 3.1 Container Into Your Unit Tests - Boot Time: 5 Seconds
Using the EJBContainer API with or without Maven (but with GlassFish v3)
TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3
Do you need WLS specifically, of any servlet container would do? If the latter is OK, then use Jetty.
WLS is not designed to be embeddable. But you can do it. After all, WLS is just a class named weblogic.Server. Setup classpath correctly, setup PATH and other environment variables (see setDomainEnv.sh and startWeblogic.sh), start that class from Java, and you have an "embedded" WLS.
There is probably a way, but I don't know it. My experience from writing maven plugins tells me that the most likely way that the plugin works is that it starts up a new command line process just like you would normally start up the server. So in a sense, not really embedded it.
The best way to see is to track down the source of the plugin and see how they did it.
WebLogic doesn't support embedded mode like Glassfish but you can have control over your Weblogic using "WebLogic Maven Plugin", this provide several maven goals for managing and working with Weblogic instance.
See this link for further information.

Best practices in terms of replacing a web service?

So we have a busy legacy web service that needs to be replaced by a new one. The legacy web service was deployed using a WAR file on an apache tomcat server. That is it was copied over into the web apps folder under tomcat and all went well. I have been delegated with the task to replace it and would like to do it ensuring
I have a back up of the old service
the service gets replaced by another WAR file with no down time
Again I know I am being overly cautious however it is production level and I would like everything to go smooth. Step by step instructions would help.
Make a test server
Read tutorials and play around with the test server until it goes smoothly
Replicate what you did on the test server on the prod server.
If this really is a "busy prod server" with "no down time", then you will have some kind of test server that you can get the configuration right on.
... with no down time
If you literally mean zero downtime, then you will need to replicate your webserver and implement some kind of front-end that can transparently switch request streams to different servers. You will also need to deal with session migration.
If you mean with minimal downtime, then most web containers support hot redeployment of webapps. However, this typically entails an automatic shutdown and restart of the webapp, which may take seconds or minutes, depending on the webapp. Furthermore there is a risk of significant memory leakage; e.g. of permgen space.
The fallback is a complete shutdown / restart of the web container.
And it goes without saying that you need:
A test server that replicates your production environment.
A rigorous procedure for checking that deployments to your test environment result in a fully functioning system.
A preplanned, tested and hopefully bomb-proof procedure for rolling back your production system in the event of a failed deployment.
All of this (especially rollback) gets a lot more complicated when you system includes other stuff apart from the webapp; e.g. databases.

Tomcat - Asynchronous HTTP Calls Super Slow vs. Jetty

We have a java-based web application that makes a couple bursts of asynchronous http calls to web services & api's. Using a default Jetty configuration, the application takes roughly 4 seconds to complete. The same operation in Tomcat is taking over a minute.
A slew of configuration changes for Tomcat have been attempted, but nothing seems to help. Any pointers?
Use a profiler to investigate where the time is spent. A good initial choice is jvisualvm in the JDK.
My initial guess would be a DNS issue.
It's not logical that tomcat needs 60 seconds for processing something that Jetty solves in 4. They are both executing Java code.
Is there thread congestion on tomcat? How many threads can the http connectors of tomcat and jetty handle at the same time? What is your configuration?
One suggesting i have to get to the bottom of your problem is to download the Tomcat source and step through the code. Although as mentioned... profiling would save you allot of time. Odd are that its a DNS issue.

Categories