A Java application is launched with the java command which starts a JVM and runs the application. As an Application support engineer, there are few basic operations that you will typically perform on the JVM. Here are they:
Starting the JVM simply means starting the Java application. A Java application is started using the java command.
java is the command
HelloWorld is the classfile without the .class extension
Note: Don’t use the .class extension in the java command. If you do, you will get an error
[ec2-user@java]$ java HelloWorld.class
Error: Could not find or load main class HelloWorld.class
There are numerous command line options for the java command. Here are some of the main ones you need to know.
As an Application Support Engineer, you will invariably end up managing Java based applications. JVM (Java Virtual Machine) is the all-important process that runs the Java Application you are going to manage (which can be either custom developed by your development group, or a commercial off the shelf product). It is imperative that you have a very good understanding of how JVM works.
Note: Some of the material in this section will be very basic that experienced Administrators can choose to skip.
At a high level:
- Java is a high level programming language (this is the code). A java program is a text file(s) that is/are human readable.
- Javac is a compiler program that compiles the human readable java code in to machine readable byte code.
- JVM (Java virtual machine) is a process that runs the java byte code. It is an implementation of specification created by Sun/Oracle.
Virtualization is a technique using which you can run multiple Operating Systems (aka Guest) in a physical server (host) by abstracting (or virtualizing) CPU, Memory, Disk and Network resources. The core component of any virtualization solution is Hypervisor – the software that performs the abstraction of bare metal resources.
Here are the primary benefits of using Virtualization:
- Save cost on hardware
- Centrally manage the infrastructure
- Add effective fault tolerance and high availability
- Dynamically update the infrastructure
The diagram below shows virtualization at a high level.
The verdict is in. Virtualization is the future. If you are still running your applications on bare metal, you are missing out on tons of benefits, or even hurting your business. Virtualization is a software tech that lets you run multiple operating systems and applications on a physical server by abstracting the hardware underneath. Among several Virtualization software makers, the following are considered leaders:
Let’s dive in to 5 reasons why you can’t afford NOT to virtualize (not necessarily in any order)
Yes, AppDynamics is awesome for Application monitoring – Java Heap, deep transaction tracing, tons of out-of-the-box framework monitoring (JDBC,WebService etc) and the list goes on. But do you know Appdynamics can be used to effectively monitor Servers too, whether it is virtual or physical? When I say server, I mean the host operating system such as RedHat Enterprise Linux, Windows 2012, Solaris etc. Let me show you how you can do this.
Enter AppDynamics Machine Agent
While Java can be monitored using a Java Agent, a Server can be monitored using a special type of agent called Machine Agent. You will have to have license to run these agents (When you purchase Application agents, typically AppDyanmics throws the same number of Machine Agents, and so you should be good in terms of additional cost). If you are not sure about your present licensing situation, click on ‘licensing’ in your Controller UI as shown below.
Unlike Application agents which run inside the JVM/CLR, Machine agent is a standalone Java program that runs on the host operating system. It collects hardware metrics and sends them to Controller (once a minute). A user can view these metrics via Controller UI. Pretty simple, hah?
Java Heap is a labyrinth. You can spend hours or even days analyzing a heap dump from a production Java application. Heap is where all the objects created by your application live. And even in a relatively simple application, there could be hundreds of thousands of objects created. When dealing with Java memory leak, you know you are looking for one the following (or both):
- Excessive number of objects of certain class
- Objects with unusually large size
Fortunately, Appdynamics provides a feature using which you can easily reveal both of the above cases. Let’s get right to it.
- In AppDynamics Controller UI, locate the Node that you want to troubleshoot and click on ‘Memory’ tab
In this part, let’s explore AppDynamics facilities for diagnosing Memory Leaks. AppDynamics provides two powerful tools to hunt down memory leaks.
- Automatic Leak Detection
- Objet Instance Tracking
Automatic Leak Detection
With Automatic Leak Detection enabled, Appdyanmics can capture objects that live longer than usual period – i.e long lived Collection objects that simply won’t get garbage collected. If your application is leaking memory, it is definitely one of these long-living, never-dying objects that cause the leak. Use the following procedure to make use of this tool.
Troubleshooting JVM memory issues can be daunting, but you if you don’t fix it, it can kill your application and possibly your face in front of your customers. There is good news though. With any modern APM tool, you virtually get an X-Ray vision to this labyrinth named Java Heap.
In this blog post, I’ll show you how to use AppDynamics to troubleshoot Java memory issues.
AppDynamics is one of the leading APM vendors in the market, providing tons of useful tools ranging from Hardware monitoring to End user experience monitoring to operational data analytics (Actually it can be quite overwhelming. If you don’t know what exactly you are looking for in the tool, you can go in circles. But don’t worry, I can help).
There are three major areas where AppDynamics can help in regards to Java memory troubleshooting.
Software installation has never been more fulfilling since YUM came along.
YUM is the most popular rpm based interactive package manager. It is super powerful and reliable.
In this quick article, I show how to install apache web server, the world’s most popular web server in your Linux Server.
You need to have root access to do this. You also need to have internet access on the server you are installing apache.
Simply run the command
sudo yum install httpd
That’s it. Yum does the rest.
Once done, which takes about 10 seconds, start the httpd server
Sudo service httpd start
Once the service starts, simply use a browser to access the server (use the default server name or the ip address).
Or you can choose the geeky way to use curl to test out. I created a basic html file. Here is how to access it
You can check access.log to see how you did. Access_log is present under /var/log/httpd/
The configuration file for apache (httpd.conf) will be under /etc/httpd. (This depends on your platform).
That’s it. Your own enterprise grade Web Server, up and running in about 10 seconds.
Way to go YUM !!