Execute an java application under cgroups AND on virtual mininet host - java

On my Linux server, I run various Java applications under cgroups with the call of cgexec. These applications also communicate to each other under a given port.
However, I am also interested to reduce the bandwidth of this communication to simulate a real network here. For this, mininet seems to be the tool of choice.
Now my question is the following:
How can I run a process under a cgroup AND on a mininet virtual host?
Are there any probles with this config/idea? Like side-effects?

Related

Testing a distributed application on a single system

I am writing a simple p2p application using Java 7 and tomp2p. The problem is that peers need to bootstrap to other peers in the same network and in order for that to work, the ports have to be set correctly and the broadcast messages need to be sent and received properly.
I would like to know the best setup for testing the application (or any distributed application) using a single machine (since I do not always have multiple machines to experiment with).
First, I simply tried running two instances of my application in different terminals (and this worked), but as soon as I tested it in a real network with two machines, the peers of my network were not able to find each other anymore.
Therefore, I am now running Ubuntu 12.04 as a host OS and a virtual machine (virtualbox) with a Fedora 17 image. However, for my application to work, the host and the VM need to appear as if they were in the same network, but somehow I could not figure out the right setup for this to work (this is due to some NAT issues).
Does anybody have experience with testing a distributed application on a single system, and can give me some hints about the setup and the virtual machines used?
Thanks in advance,
r0f1

Determine the list of JVMs running on a remote machine on Linux platform

I need to determine the list of JVMs running on a remote machine, and once that is done, to connect to each of the JVMs using JMX. I am a newbie and have gone through the following concepts:
1. using jps and jstat: I read that these commands may not be available in the future jdk versions.
2. using the java class "virtualmachine().list" . The problem with this though is that it helps you fetch the list of JVMs but only for the local machine. I do not know how to connect to a remote machine and then obtain this list.
Can anyone please suggest how to use either "virtualmachine().list" or any other method to obtain a list of JVMs on a remote machine ?
The problem is that all the methods(including the way jconsole works) that I have studied to connect to a remote JVM are focused to a SPECIFIC JVM where I need to provide the port number(of the JVM process). But I need a list of all the JVMs running. How can I do this ? Is it even possible ?
One option would be to launch a small java application on the remote machine and have it run virtualmachine().list or similar and then send back the information or make it accessible using JMX. This application could be running all the time, or you could maybe launch it remotely.
Some other ideas mentioned here: Get System Information of a Remote Machine (Using Java).
You could add a java-agent or some other common component to each of the remote JVMs and have them "phone-home" their JMXServiceURLs to a central JVM clearing house. Other than that, I think your only options are derived broadly from monex0's suggestion.

How to up an aplication on remote linux and wait for answer

Someone can tell me the best way, through a web Java application, how to run an application on a remote machine (linux) and how to know if this application has already completed. I know the application terminates automatically, so just wanted to wait for the answer.
any help or advice are very welcome.
I was confused by the wording, so I will assume the following: the web application and the remote application are running on two different machines, with the remote application on Linux.
If that is the case, then you would be better off using a SSH library for Java (there are several - JSch, sshj, Ganymed SSH-2, to connect to the remote machine and run commands on it. This is a better approach than using ProcessBuilder, for it abstracts you from the problem of providing your password to the terminal (which can get quite tricky).
I'm not sure what you meant by this statement: "I know the application terminates automatically, so just wanted to wait for the answer." so I'll make another assumption that you want to know if the remote process terminated successfully or not. I'm unsure if any of the SSH libraries posted above, will allow you to get the remote process status in a non-trivial way, so you are better off writing a shell wrapper to your remote command that will return a parseable message.
If you are running both on the same machine, use ProcessBuilder.

Talk to VM through host operating system

I have here a Windows distribution server that runs an ANT task to build enterprise software. What I need to do is to have the ANT task copy and run a VM image (Linux), and then...talk to that Linux VM through the host operating system (through the ant task itself). We need to be able to send files and/or commands to it.
Is there a practical way to go about this? I know that we already have a way to send commands to VMs that are also running Windows (so windows-windows interaction) -- but is there a way to do a windows-linux interaction?
I've implemented the thing you wanted. Of course, for my own purposes, and then just found this question by googling on keywords "vmware" and "ant".
https://github.com/zhuravlik/ant-vix-tasks
This is the taskset for Ant to manage VMWare VMs.
It works via VIX API, so Linux guests should be supported by it.
I did not test it with VMWare Server, though. Only with Workstation.
But the API is common, so it should work.
Using ssh is probably the simplest. There is an ant task for that. Scp task is also there to copy files
It will depend on what you need to do, but:
The Linux system could expose an SSH server, and the host can do just about anything it needs to via SSH.
The Linux system could expose a web service that the host consumes.
The Linux system could expose a Samba share which the host then connects to and reads/writes from (if all you need to do is deal with some files, but that seems unlikely).
There are probably dozens of options.

Best way to deploy a Java application on a cluster of servers?

I have a cluster of 32 servers and I need a tool to distribute a Java service, packaged as a Jar file, to each machine and remotely start the service. The cluster consists of Linux (Suse 10) servers with 8 cores per blade. The application is a data grid which uses Oracle Coherence. What is the best tool for doing this?
I asked something similar once, and it seems that the Java Parallel Processing Framework might be what you need:
http://www.jppf.org/
From the web site:
JPPF is an open source Grid Computing
platform written in Java that makes it
easy to run applications in parallel,
and speed up their execution by orders
of magnitude. Write once, deploy once,
execute everywhere!
Have a look at OpenMOLE: http://www.openmole.org/
This tool enables you to distribute a computing workflow to several resources: from multicores machines, to clusters and computing grids.
It is nicely documented and can be controlled through groovy code or a GUI.
Distributing a jar on a cluster should be very easy to do with OpenMOLE.
Is your service packaged as an EJB? JBoss does a fairly good job with clustering.
Use Bit Torrent. Using Peer to Peer sharing style on clusters can really boost up your deployment speed.
It depends on which operating system you have and how security is setup on your network.
If you can use NFS or Windows Share, I suggest you put the software on an NFS drive which is visible to all machines. That way you can run them all from one copy.
If you have remote shell or secure remote shell you can write a script which runs the same command on each machine e.g. start on all machines, or stop on all machines.
If you have windows you might want to setup a service on each machine. If you have linux you might want to add a startup/shutdown script to each machine.
When you have a number of machines, it may be useful to have a tool which monitors that all your services are running, collects the logs and errors in one place and/or allows you to start/stop them from a GUI. There are a number of tools to do this, not sure which is the best these days.

Categories

Resources