Using CloudSigma PaaS to Shift Java Applications into Containers featured image

Using CloudSigma PaaS to Shift Java Applications into Containers

For the longest time, application development and management were completely dependent upon physical infrastructure. As businesses looked to host multiple applications on a singular hardware system, virtualization solutions like hypervisors were introduced. A hypervisor, also known as a Virtual Machine Monitor (VMM), is software that creates and runs Virtual Machines (VMs). The hypervisor will allocate resources to each guest or VM from a pool comprising components like memory and storage.

Virtual Machines- the Challenge?

While the introduction of VMs has enabled more efficient management of multiple workloads on one infrastructure, there is still much room to improve. For example, the overhead associated with the consumption of resources is a major challenge. Each virtual machine requires an operating system to be able to function.

The Counter: Containerization

Virtualization of hosting hardware has benefited immensely from containerization. This is when OS libraries and associated dependencies are compiled into a lightweight package or “container” which can be run easily on any given infrastructure. These containers can share a lot of system resources like the OS kernel and the file system so that less memory and CPU space is consumed. 

VMS to Containers- Why Migrate?

With many businesses making the shift from VMs to containers, you may wonder if it is the right approach for your company. Here are just a few benefits of migrating to a container-based hosting system:

  • Compared to VMs, containers are much better at optimising resource allocation and consumption.
  • Faster start times and spin ups of containers.
  • Scaling is much easier with containers without the need to restart.
  • If your containers are on the same host, you can easily share resources.
  • Security updates are easier to implement.
  • Tend to be smaller in size which allows a single machine to host multiple containers.
  • Several templates are available at your disposal based on the Docker packaging standard.
  • In case you are looking to migrate or transfer, the smaller amount of code makes things much quicker and simplified:

Using CloudSigma PaaS to Shift Java Applications into Containers image 1

Containerized Environments with CloudSigma PaaS

At CloudSigma, we have invested a lot of experience and expertise into optimizing our hosting technology over the past several years. CloudSigma PaaS allows its users to create containerized environments for languages such as Java, PHP, Python, Node.js, Ruby, and .Net. If you are still in the process of making the shift, CloudSigma PaaS even enables you to run VMs and containers simultaneously using a single user interface.

Migrating from VMs to Containers: a CloudSigma PaaS Use Case

Additionally, CloudSigma PaaS makes migration from VMs to containers an absolute breeze. It uses a minimum amount of code changes, it’s much more cost-efficient than most other platforms, and the process is as simplified as it can possibly be.

Next, let’s take a look at how a typical migration would take place. Say, we have an application that is running in GlassFish, a Java EE application server. It operates on a VM-based system and we will be looking to convert it into containers instead. Here is how you would go about it using CloudSigma PaaS technology:

  • GlassFish Server in a Virtual Machine

Let’s start off by exploring what the structure of such an application environment would look like. Typically, when it comes to GlassFish application environments, you have the DAS or the Domain Administration Server as the center. This is the management hub where all of your applications are configured and resources are distributed from. These resources are allocated to worker Instances which can be websites, applications, or miscellaneous web services:

Using CloudSigma PaaS to Shift Java Applications into Containers image 2

  • Scaling in GlassFish (VMs)

Consider that you need to add more resources to a virtual machine. Vertical scaling for VMs can only be performed by shifting to a bigger machine that can accommodate your new, bigger resource limits. When it comes to horizontal scaling, you need to follow these steps:

  1. Create a new VM with a preconfigured GlassFish template.
  2. Configure SSH Connect.
  3. Add the new virtual machine to the DAS as an SSH node.
  4. Create a new remote worker Instance on a node. You can do this by using the DAS user interface or the admin CLI:

Using CloudSigma PaaS to Shift Java Applications into Containers image 3

Unfortunately, you will need to repeat the same process every time you hit the top limit. Not only does this require a lot of time and manual work, but it can also lead to significant application downtime which has detrimental consequences for businesses in this competitive day and age. Furthermore, the repetitive manual operations make the project more prone to be impacted by human errors which can lead to further unnecessary complications.

  • Migrating to Containers from VMs

Moving from VMs to containers can be viewed as a process of “decomposition”. You essentially take a monolithic application topology and break it down into small, logical pieces. Then, you distribute these pieces across a set of packages or “containers” that are all connected to each other. To simplify application topology, we tend to place each application component in an isolated container:

Using CloudSigma PaaS to Shift Java Applications into Containers image 4

  • Types of Containers

There are two main types of containers that you can choose from. You can either have application containers or system containers. Here is what each of these is ideal for:

Using CloudSigma PaaS to Shift Java Applications into Containers image 5

    • Application Containers

An application container is typically used to execute a single process. You can use these containers to package individual application components. A good example of an application container is Docker. One of the best things about application containers is that you will find a number of publicly accessible Docker templates to produce standard images for your new projects. Additionally, having separate containers for application components gives you a lot more control and security. Not to mention, they are much more reliably transferred and migrated in this form.

    • System Containers

System containers, on the other hand, are capable of running entire operating systems and init systems like Systemd and OpenRC. This can give rise to further processes such as OpenSSH and Syslogd inside the same container. They work similarly to VMs in the sense that they are able to utilize the host OS kernel. The difference is that system containers do not use hypervisors. Unlike application containers, you can use these to run multiple processes at the same time using the same OS. If you wish to use monolithic applications, then system containers are more suitable as they allow you to use the configurations you originally used in your VM-based architecture.

Apart from that, system containers are also more beneficial when you are trying to migrate a legacy application. It virtualizes your resources and isolates them efficiently, and gives you access to features like SSH-based config rolls and love migration of the memory state. You can install the libraries and databases you wish to use without compromising the portability of the containers. Even though they offer comparatively slower start-up times than application containers, they are leagues above VMs.

Containers in CloudSigma PaaS

Most PaaS providers are currently using the Twelve-Factor App methodology. At CloudSigma, we believe in letting our users determine the approach to designing and deploying legacy monoliths. You can use both application and system containers on the CloudSigma PaaS and set up your projects in just a few minutes. This streamlined approach reduces the risk of vendor lock-in and significantly improves time-to-market.

  • GlassFish Server in a Container

The components in a GlassFish cluster will be distributed across different isolated containers like this:

You can add or remove worker Instances automatically. You can also have them attached to a DAS node with the help of a container orchestration platform and some automation scripts:

Most of the fine details about the migration and automation that can throw you for a loop are kept behind the scenes at CloudSigma. This ensures you have a clutter-free PaaS platform to work with as you efficiently manage your container-based web application. You can also create new dev, test, and production environments to explore your options and determine future strategies.

Migrating to the Future with CloudSigma PaaS

It is no secret that containerization is the future of hardware virtualization. Not only does it give you a competitive edge, it optimizes your resource spending and consumption. Not to mention that it makes scaling a breeze, amps up your security, and allows you to host multiple applications on a single server with practically zero downtime. 

The only obstacle that may deter you from this is the migration from VMs to container-based technology. That is where CloudSigma comes in. CloudSigma PaaS simplifies the migration process as much as possible, automating and hiding most of the complexity and providing you with a comprehensive platform to manage your web applications. You can continue to scale, manage, and monitor all aspects of your application lifecycle as the workloads are processed in real-time. Learn more about what the CloudSigma PaaS provides or even try it out for yourself with a free trial. You can contact us here for more details or if you have any questions. 

Try Free for 7 days

About Zhenya Mocheva

Zhenya is a Digital Marketing Expert at CloudSigma, focusing on brand strategy, social media marketing and digital marketing campaigns. She is passionate about the continuous innovation within the digital environment and the endless growth opportunities that inbound marketing brings.