I've implemented a REST API with Vert.x and I want to monitor its threads. I package the app as a fat-jar and I'm using JVisualVM and JProfiler for monitoring.
When I launch it from the IDE (Intellij) I can see everything, but when I launch it with java -jar fatjar I can only see memory consumption.
I enabled JMX from the application thinking JVisualVM uses JMX to get the metrix, but it didn't help.
What should I do to enable JVisualVM access to threads and CPU?
Thanks in advance :)
With jvisualVM you should be able to see all vert.x threads, however you should be aware that Vert.x is a reactive framework so you will not see a thread being spawn for each request. One thread (per CPU core) will handle all load.
What are you trying to monitor exactly would be interesting to know since it could be that you're just looking on the wrong place...
Related
So we need to provision (add the jms extension/subsystem/configurations to standalone.xml) the JMS subsystem in wildfly when starting the server if it's not already provisioned and that needs to happen automatically. We have an application written in java and we chose to provision the jms subsystem with wildfly's cli java api and that is executed when our application starts deploying. The thing is we need to provision the jms subsystem and use it in the same application.
Problem is, when we add the needed configurations in standalone.xml with wildfly's cli java api, the server requires a reload but we can't reload it because our app is already deploying, it tries to use the defined queues and fails because... Well, the subsystem is not active yet. On next server restart everything is ok but as you can guess in a production environment this is unacceptable. Is there any solution to this? I've tried adding a reload cli command in the end of the batch that creates the jms subsystem and it starts reloading the server but the deployment doesn't stop and exceptions start flying left and right.
Also the whole idea of reloading the server from the app while the app is deploying seems kinda wrong to me.
Thanks in advance.
Solution:
Well the solution in the end was an easy one, we just had to add a reload step in the batch operation that adds the jms subsystem. The problem was that we had a set of async operation that all fired off when the app was deployed so i just had to make sure none of them started until i can check for the messaging subsystem and reload wildfly if necessary. That way I'm not interrupting any async tasks forcefully.
You need to select appropriate profile i.e full or full-ha while starting server only. If you do this there will not be need to add JMS subsystem.
If you want to go with your approach only, add dependency of queue in
application. It will not start deploying until and unless queue is bound to server.
we need to perform reload operation when we add new subsystem, if you dont want to perform reload operation then I will suggest you to start server in 'admin-only' mode. When we start server in 'admin-only' mode then it open only management port(9990/9999). Configure messaging subsystem through CLI command reload server instance. Hope it helps..!!
I am new to jboss and would like to know what are the differences between ServiceMBean and load-on-startup servlet tag in web.xml? Also, I would like to know which one will always get loaded first or they are loaded at the same time? In what situation, I should use MBean and when I should use startup servlet or it doesn't matter?
I need to write a a class/servlet to validate if all the required system properties (e.g -DINSTALL_DIR=blah ) is set. If not, then stop right there. else proceed and start the application.
Thanks in advance
-A
ServiceMBean is JMX, it is part of your JVM. load-on-startup servlet tag in web.xml is part of your J2EE application.
JMX is part of J2SE starting from JDK 1.5. So, you can have one ServiceMBean per JVM. not per application. JMX is used mostely for monitoring and managing the JVM. It provides access to information such as: number of classes loaded and threads running, memory consumption, garbage collection statistics, on-demand deadlock detection, and others. Another common use, is to refresh your cache.
JMX will allow you to instrument your application and control/monitor it using what-ever management console that your JMX container supports. An example would be a web application that implements a reference data cache...
A problem we had before was we would occasionally need to refresh the cache because a customer name changed in the database. If we had a refresh method on the MBean interface then we should be able to trigger this event using the JMX console. The JMX console may be a web or fat client that comes with our J2EE server. Our J2EE server may also support SNMP. This means that we may be able to invoke the method from a standard Tivoli or UniCenter console.
http://www.theserverside.com/news/1364664/J2EE-Application-Management-The-Power-of-JMX
You don't need remote access to ServiceMBean in order to trigger some asynchrious action. Moreover, you need validation on scope of application, not the whole JVM (while, you can, theoretically, handle this issue in the ServiceMBean). So, it is more naturally, to do it as load-on-startup servlet tag in web.xml. In this way, in every start up of your application validation will happen.
One more clarification: ServiceMBean is JBoss-way to write JMX. All MBeans are server wide (not application wide). That's why I use MBean and ServiceMBean freely above.
At a high level, what does JBoss 5's shutdown do? What might go wrong if I just kill the java process instead of gracefully shutting down JBoss?
A graceful JBoss 5 shutdown takes about 6 minutes for my application, which is pretty big and has 305 EJBs. JBoss seems to pause for a long time just before unbinding the EJB LocalHomes from jndi.
Given that, I am considering simply killing the java process. I am wondering about what might go wrong if I do that.
I run JBoss in mostly in *nix, sometimes in Windows.
Killing the process will leave the JBoss files in a potentially inconsistent state, and will certainly leave them in a messy state. When it restarts, it will probably clean up after itself OK, but then again it may not.
On Windows (you didn't say which platform you use), I've seen a killed JBoss process not release locked files properly, and the server won't restart at all. It's pretty rare, though.
In the end, if it works for you, the I wouldn't worry too much about it.
It releases all you connections such as jndi, jdbc, jms.. It also waits for your classes to finish up what it is doing. It also stops other services such as jms and web console
I'm totally a newbie in Java Enterprise and I have a lot stuff yet to learn. Right now I'm working which involves JMS using JBoss and ActiveMQ. An application sends messages to queues in JBoss and my goal is to access those messages using any message broker (in this case I tried to use ActiveMQ). So I think it's better for me to embed ActiveMQ to JBoss. I used the link below as the guidance :
http://activemq.apache.org/integrating-apache-activemq-with-jboss.html
I followed every single steps in the guide except that I used JBoss 4.2.3 and ActiveMQ 5.1.1. If this problem results from the different version of the tools, I think I can't help it out because other versions seem does not work on my machine. When I run JBoss to test whether the embedding is working or not, I can't see anything running on port localhost:61616 which is the default port for ActiveMQ, although JBoss seems run well. My question is :
Is any one know how to fix this? Or has anyone ever experienced such problem?
Is there any way to access queue in Jboss?
If this question is pretty ambiguous or need more details, let me know. Thanks in advance for any help.
I'm quite sure the embedded broker is started (transport vm://localhost) which results in a working JMS broker for that VM. But this broker isn't reachable from outside (via tcp or anything else)
Do you see any error in the log when launching jboss? I managed to make it work with Jboss 4.2 and ActiveMQ 5.4, and once integrated it only gives you a small hint that is working correctly with some info message saying "broker started in port ..." .
Also you can try to use the sample producers and receivers in ActiveMQ to test if the queue is working correctly.
If you still have problems I can try to help
We are performing some JMeter tests on a JBoss 4.0.5 deployed web app. We want to integrate the resource usage on the application on the server (memory, threads, etc) with the JMeter response time results.
We have found a tutorial for doing that with Tomcat: http://www.informit.com/guides/content.aspx?g=java&seqNum=273 and we want to know if it could be done with JBoss.
One alternative is doing resource usage monitoring by hand, using jconsole or something similar, but we prefer something automated and integrated.
Regards,
JBoss includes Tomcat, so yes. Instead of the /manager/status?XML=true URL path mentioned in the article, use /status?XML=true. That should be it.