java: what libraries are there to manage/monitor processes? - java

I am helping develop an application that needs to run several processes. I need to be able to start and stop the processes as well as monitor them. JPPF provides the ability to do management and monitoring of JPPF jobs and nodes/servers that run those jobs, but that is all across JVMs. I'm trying to weigh other solutions for management/monitoring processes that may not all be JVMs. The library I am looking for would be preferable if it can be used in Java.

I don't think this addresses your issue of running processes that are not JVMs, but you might be interested in looking at Akka library as an alternative to JPPF: http://akka.io/. It is mostly built for scala I think (not a bad thing!) but also has a java api.

Related

Command-line-based daemon for Java Mission Control? Alternatives?

I have been asked to investigate Oracle Java Mission Control, so that server-side Java applications may be monitored and actions taken (e.g., alerts emitted and logged, flight recordings saved) under certain conditions. Java Mission Control's trigger system, where you specify conditions and actions, meets our needs, but it seems to depend on the GUI application ("Oracle Java Mission Control") being running, implying that triggers are not the monitored JMX server's responsibility. Is this the case? There are a number of servers usually accessed via terminal...
Is there a way of running Java Mission Control as a daemon, from a terminal session, unattended, while retaining and obeying any specified trigger rules (e.g., imported from an XML file)?
If not, are there competing tools with a similar trigger system that can fill the void?
Thanks! :)
Currently no, you can't run JMC without a GUI.
You are not the first person that wants to do this.
One option is to run JMC in another machine, and make it connect to many servers, which of course requires running the remote JMX agent etc.
We have been discussing server side triggers/rules, but AFAIK, it is not planned for any JDK release.
It is possible to dump flight recordings from code, so you could write your own little agent that uses the DiagnosticMBean to do this on another JVM on the same machine or on remotely. I'm pretty sure this how some people solve the same sort of problem. It is also possible to parse and analyze flight recordings in code. If you're interested in this approach, I'm sure there's some sample code around, of course it's more work than if JMC could run as a daemon :/
You should probably have a look at an APM tool instead of monitoring with JMC. The product is extremely weak, introduces a lot of overhead (making it unsuitable for production) and creates a lot of issues. There are also developer focused tools available out there.
APM : AppDynamics (deepest of the bunch), New Relic, Ruxit
Java Developer Tools : Takipi, Fusion Reactor, Javosize

What are some ways to do multi-core programming on Android, not just multi-thread?

What are some ways to do multi-core programming on Android, is it that Async-Tasks and threads they themselves used multiple cores or do we need to call some API's to enforce that?
You don't need to use any API. The operating system and the Dalvik virtual machine schedule the execution of the threads on the available cores.
I like this blog post on the qualcomm dev site, since qualcomm is deep into the hardware cores side of things for Android: https://developer.qualcomm.com/blog/multi-threading-android-apps-multi-core-processors-part-1-2 and https://developer.qualcomm.com/blog/multi-threading-android-apps-multi-core-processors-part-2-2
TL;DR - No API's necessary, just do clean parallelization using different Android constructs available like AsyncTasks, Java Threads and IntentService and Dalvik-Linux Kernel will do the rest.
Some good parts of it relevant here:
Can my single-threaded application benefit from multiple cores? How?
Even a single-threaded application can benefit from parallel
processing on different cores. For example, if your application uses a
media server, then the media processing and your UI rendering
application logic can run on different cores at the same time. Also,
the garbage collector can run on a different core.
How can I write code that takes advantage of multiple cores?
To realize the maximum potential of the available processing power on
multi-core devices, write your application with concurrency in mind.
The application should be designed so that tasks which can be executed
in parallel are set up to run on separate threads.
Also the answers here: does single thread application utilize multi core in android? especially the one analysing perf wrt how sinngle threaded applications can utilize multicores.
I also like this from AT&T going into the specifics of Multi Core Coding in Dalvik itself. They use a Mandelbrot set image to explain which is cool with backlinks to Android dev site for multithreading.
Use multithreading to use multi cores because the android operating system and Dalvik vertual machine (DVM) manage multitasking and use multicores when in need so you do not have to use any Api . To know more about them download this pdf.

Multi-node concurrency in Java

I've written a multi-threaded Java program to solve an embarrassingly parallel problem such that it utilizes all the free CPU cycles of on a multi-core CPU. I'd like to refactor my solution so that it can run on multiple nodes while still keeping the majority of the code I've already written.
I've used MPI with C in the past and been told that it's the "correct" way to address the issue of maximizing CPU cycles, but I'm also aware of other concurrent frameworks in Java like RMI and wonder if they are just as good.
Is there a good way to handle multi-node and multi-core concurrency in Java where the main goal is to leverage the most CPU cycles as possible out of the cluster?
Edit: I get the impression that there's no easy way to handle this stuff. I'm not surprised, but I was hoping. :)
Depends on what you are doing and your budget you might want to look into (in no particular order)
Actors especially Akka that has good remote actors, STM and supervisor style managment with a Java API
Norbert
GridGain
Terracotta
Gigaspaces
Oracle Coherence
IBM Extreme Scale
TIBCO ActiveSpaces
Also see:
java util concurrent and guava (Presentation slides focusing on util.concurrent) (EventBus)
Libraries such as javolution or JSR 166
Functional programming capable JVM languages such as Scala and Clojure has better multi core utilization than Java.
RXJava (Java, Clojure, Scala ... Reactive Extentions)
You can try Hazelcast. It has a distributed ExecutorService. This should allow you to add tasks to a service which run across any number of nodes.
JMS is a good place to start.
Also consider Apache Hadoop, it uses MapReduce and is well suited for many parallel solutions.

How to find cpu,io,memory utilization of a loading page in web application

I've written a Java file, using Jsp,servlets, that I would like to perform run-time tests on. I've never done this before and was just curious on how to go about it.
What I'm interested in knowing, besides the actual timings, is how to find cpu,memory and io utilization when running the application.Your thoughts are appreciated.
Typically you wouldn't measure these from within the application, but by running another tool on the same host.
If you just want to see the impact on the host operating system, you can use a program like top (on *nix boxes), or good old Task Manager on Windows, to see the CPU/memory/IO utilisation of your Java process (typically the servlet container such as Tomcat).
If you want more detailed information on the actual Java process itself, you can connect JConsole or jvisualvm to get VM information (including memory and CPU) for the process itself. (With Java 6 you should be able to do this from the local machine without passing any parameters to the Java process at startup; for Java 5, or remote connections, you'll need to pass command-line arguments to the Java process to allow (remote) JMX connections.)
Finally, if you want really in-depth details of the resource usage, down to the performance of various methods (which it sounds like you're after), you'll need to use a profiler. There are several of these for Java - with YourKit and JProfiler being the biggest commercial ones (in my unqualified opinion). I believe that the NetBeans IDE also has a decent profiler built-in. The process for connecting these to your application would vary depending on the app itself, but these will all typically allow you to "drill down" into the CPU time to see which classes/methods took the most cycles to execute, and likewise to drill down into memory use to see which classes are taking up the most memory.
The standard way to monitor running Java applications these days is sing JMX through the JConcole
If your a using a commercial application server like Weblogic or WebSphere these have custom and powerful management consoles that provide the monitoring information you are looking for. The technology at the heart of these consoles is still JMX so these can also be monitored and managed using the standard JConsole. This article shows how to do this for Weblogic.
I guess you need this info in the client side (browser). So it's not Java based question.
If so, here is my answer:
I prefer using FireBug and ySlow extensions. They give performance information, memory information and much more.
I combine it with using regular task-manager to view more information about the browser.
BR

MPI , Sungrid vs JPPF?

I have a little experience with SungridEngine and MPI (using OpenMPI).
Whats the different between these frameworks/API and JPPF?
All three of these are somehow related to parallel computing, but on pretty different levels.
The Sun Grid Engine (SGE) is a queueing system. It is usually set up by the system administrator of a big computing site, and allows users to submit long-running computing "jobs". SGE checks whether any computing nodes are unoccupied, and if they are, it starts the job on that machine, otherwise the job will have to wait in the queue until a machine becomes available. SGE mainly cares about correct distribution of the jobs. For a single user, SGE is of very limited use. SGE is often used in high performance computing to schedule the user jobs.
JPPF is a Java framework which can help an application developer to run and implement a parallel Java program. It allows a Java application to run independent parts of it on other machines in parallel. It is useful to split a computing-intensive Java application into several mostly independent parts (which are typically called "tasks"). Although I do not really know the framework, I guess that it is mostly used to distribute big business applications onto several computers.
MPI (Message Passing interface) is an API (mainly for C/FORTRAN, but bindings for other languages exist) that allows developers to write massively parallel applications. MPI is mostly intended for data-parallel applications, where all parallel jobs do the same operations, but on different data, and where the different jobs have to communicate a lot. It is used in high performance computing, where a single application may run on up to several thousands of processors for up to several days.

Categories

Resources