While trying to profile our WebApp with JVisualVM I have the problem that a lot of the interesting stuff is hidden behind the methods of our ApplicationServer.
I would love to have a tool that would allow me to profile the complete webapp inside of the server, but without profiling the server itself or any other webapps that might be running on the same server. Basically I think the server itself should be in a good position to provide something like that, but I never heard of such a feature in any server. Is anyone aware of such a functionality?
I would like to add that I already do profile my web app with JVisualVM...
You can use VisualVm and connect to your application server. There you can profile your application. You can connect also to a remote application server via JMX.
Profiling a web application without profiling the server is not really feasible, since profilers always look at the entire JVM.
You could define entry points to automatically start and stop profiling, but that is not really necessary: Just set your method call recording filters to the package of your web application and you will only see method calls in the classes that you are interested in, without the surrounding stack frames of the container.
In JProfiler, this is done by opening the session settings and defining a single inclusive filter:
Disclaimer: My company develops JProfiler.
You can connect VisualVM to the server's process also to profile it. See Working with Remote Applications and Connecting to JMX Agents Explicitly for reference.
Related
Jolokia is uncharted territory for me, and after having read the documentation, I'm still not sure if it'll work with the scenario I have in mind.
Setup:
Tomcat application server (version ranges from 6.x to 7.x), usually on a Windows platform, occasionally a flavour of Linux.
Deployed third-party Java web application (SAP BusinessObjects) with JMX monitoring enabled (accessible through RMI).
Possible gotcha's:
The Java web application to be monitored is commercial and closed source, so modifications are not possible. The only thing that can be changed is the JMX port number
The JMX endpoint is a custom one, thus not the default jmxrmi endpoint.
The JMX connection requires authentication.
Goal:
What I'd like to do is to deploy the Jolokia WAR file onto the Tomcat server and then configure it so that I can read the MBean attributes from the other web application.
I would code the client myself using Python (version 3) and the Requests HTTP library.
I've been reading through the Jolokia documentation (again, I'm a complete newbie at this point), but can't figure out if this would be possible or not (as I can't seem to find where to enter the JMX/RMI url or the authentication information).
Questions:
Can I use the WAR agent for this setup?
If not, can you please explain why (so I can understand, not because I don't believe you). Also, is there another agent that's more suited for this scenario?
If yes, can you point me in the right direction how to configure the Jolokia to the web application to connect to?
First of all, Jolokia by passes the JSR-160 connector stuff completely, so there is no need for any JMX/RMI authentication. The whole purpose of Jolokia is to provide a bridge over HTTP/JSON to the internal JMX subsystem. Depending on the agent, you can secure Jolokia quite easily. For the WAR agent, securing is the same as for any Java EE web app: Setup some roles and users for tomcat (e.g. in tomcat-users.xml) and reference the role in the security contstraints within the jolokia.war's /WEB-INF/web.xml.
To your questions:
Yes, you can. If you don't have any specific authentication needs, simply drop the jolokia.war into tomcat's /webapps directory. I suggest to try this first before adding security. For deinstalling the agent, simply remove the war.
As an alternative, you could also use the JVM agent, which opens an own HTTP server on an extra port (default: 8778). More on this in the reference manual
There is no need for a dedicated connection to the web app since MBeans are registered globally and are accesible from anywhere in the JVM. A webapp should of course select carefully the management information it exposes. So, there is no extra step needed and you can access the MBeans for the WEB app directly (except when it does something unusual with Java security, but I don't think so).
To test the installation, simply connect to the Tomcat with your browser and the context /jolokia (e.g. "http://localhost:8080/jolokia"). You should see the version information about the agent itself.
The next step would be to explore the JMX namespace, either with the browser (and operation "list" like in http://localhost:8080/jolokia/list , but that's tedious) or with a client like j4psh or hawt.io. Hopefully you will find the MBeans of your webapp you are looking for.
I have coded a Jersey based java server which is all wrapped in one excecutable jar.
I am looking for a web host service in which i can deploy the jar and run it.
I saw some dedicated servers which can do this but this is overshooting the need, any suggestions?
As per your comment I understand that you created a web application with a Jetty embedded server.
I think the best solution for you in this case is to get a virtual machine host, install JRE, upload your *.jar and run it from there. Given firewall permissions and correct configuration you should be able to receive requests on the 80 port. Cons? It costs. A lot.
Most of the Java hosts have already a servlet container running (almost always Tomcat) and you can only deploy your web application in it. Having an embedded Jetty server messes up everything for you.
I strongly suggest you to detach your web application (or as you called it REST server) from Jetty and deploy the *.war in any of the multiple free Java hosts to test it online.
EDIT
Thanks to you I made a deeper research on the topic and found an interesting guide to deploy a web application with embedded Jetty server in Heroku. I've never tried it nor I know if its free, but maybe you can give a try.
Digital Ocean work pretty well for me. Their basic packages are really cheap and you get root control over your own machine, meaning you can host whatever you want without restrictions. The only downside is that they are pretty old school - you have to set up EVERYTHING yourself, including firewalls etc. There are a lot of guides available on their website though, which makes life a lot easier!
http://www.digitalocean.com
I know this is a touch redundant but I don't have voting or comment rights yet so this is the only method for me to communicate.
Digital Ocean is a solid choice. I am paying 5$ a month for a VM with 512 Mb Ram and 20 gigs of storage (which for my use is just fine.) I am still working on my first proper deploy but as stated above there are tons of tutorials to guide you through it. I have no prior command line experience but I've managed to get the server running, Created an SSH key, uploaded my landing page and have gotten a test project using Spark as the embedded server up and functional in a matter of a few hours. The Droplets are easily scalable from what I've seen. I'm still having trouble deploying an Rest based app with Postgres as the DB but it seems more to do with the ports in play than anything else. Keep getting 404s.
Good time!
I need to integrate JProfile7 and Weblogic 11g. I have done all the steps are described for this and nearly everithing is ok except the following thing.
My application connects to the remote data base and there is a proxy server that I need to use to communicate to the world outside the company.
As far as JProfiler rewrites the Weblogic's start script to use its agent, there should be a way to tell it to use the proxy, but I can't find how do this.
Could somebody, please, suggest, how to do this?
EDIT:
I've tried to use the
-Dhttp.proxySet=true -Dhttps.proxyHost=12.121.12.12 -Dhttps.proxyPort=1212 java options, but the problem remains
As long as your application and the jProfiler are running within the same network without any proxy restrictions, you should be fine. It is the application, not jProfiler, who communicates with the proxied DB node.
You should be able to start your application as is - if the app is using the current proxy, then the same app with the jProfiler settings will be also using that given proxy. There should not be any difference in the application behavior.
Also, you start the application VM, let it run for a while with the correct proxy and then attach the jProfiler to the application - thiw will not change the proxy settings.
Actually, I don't know the main cause of the problem, but to resolve the issue I've done the following:
created a new file: profiledStartScript.bat outside the weblogic server's bin directory.
added the following lines:
set DOMAIN_HOME=C:/Oracle/Middleware/user_projects/domains/myDomain
set JAVA_OPTIONS=%JAVA_OPTIONS% -agentpath:C:\PROGRA~1\jprofiler7\bin\windows-x64\jprofilerti.dll=port=8849
call "%DOMAIN_HOME%\bin\startWebLogic.cmd"
and that did the trick.
I'm relatively unexperienced in developing JAVA and I was hoping on getting some advice.
I have a modular JAVA server application setup in which a high level service that acts as a front-end interface which communicates with 8 lower level services.
In production, each service is hosted on its own machine.
I'm looking to profile a standard SE development environment which launches all instances locally. I am currently using eclipse and JVMmonitor.
My current workflow involves manually starting each service, followed by triggering the monitoring process on each service manually through eclipse. This workflow gets the job done, but I'm sure there is a more intelligent solution someone has come across. Most forum postings only solve monitoring one java instance.
Are there any other stand alone JAVA applications that anyone would suggest? I would like to avoid adding profiling code if possible.
Most profilers allow you to profile JVMs without the need to manually start the profiler.
For example, JProfiler calls this "offline profiling" and the integration wizards in the JProfiler GUI have an option for it:
Disclaimer: My company develops JProfiler.
Use visualVM.You can profile from urs local computer to different servers .
http://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/applications_remote.html For profiling in different servers you need to define jstatd.all.policy file. For example if you want to monitor to different servers say s1,s2,s3 then in s1,s2,s3 server define jstatd.all.policy file and run statd - Virtual Machine jstat Daemon.Then from yours local computer you can monitor 3 s1,s2,s3 servers.
In very easy to configure it.
1.Run visualVm you can get eclipe pluging for it.
2.Run jstatd -J-Djava.security.policy=D:\jstatd.all.policy // location of yours jstatd.all.policy file in yours servers
3.In jstatd.all.policy define
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
4.Now connect to yours servers and monitor from local .
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