Introduction to OpenShift by Red Hat

OpenShift by Red Hat and acquired by IBM

Red Hat OpenShift is Kubernetes(K8s) platform that provides trusted foundation on premises, hybrid and multi cloud deployments with automated operations and streamlined lifecycle management. Red hat OpenShift empowers the development teams to build and deploy their applications and helps operations team to provision, manage and scale in K8s application platform.

Developer teams has access to validated images and solutions from 100 of partners like security and scanning throughout the delivery process. Developers can access native images and wide range of 3rd party cloud services all through a single platform.

Operation teams can deploy applications wherever they want and across teams with built-in login and monitoring. Service mesh helps to enable communication between two or more different services.

OpenShift is Red Hat opensource platform to develop and host Enterprise grade Container based applications of the various Cloud computing models such as,

  1. Infrastructure as a Service (IaaS)
  2. Platform as a Service (PaaS)
  3. Software as a Service (SaaS)

OpenShift is Platform as a Service offering by Red Hat. Once deployed OpenShift takes care of managing the underlying infrastructure components. So, developers can concentrate only application development.

Flavors of OpenShift:

Types offered by OpenShift

OpenShift available in 4 flavors,

  1. OpenShift Origin is based on top of Docker containers and the Kubernetes cluster manager, with added developer and operational centric tools that enable rapid application development, deployment and lifecycle management.
  2. OpenShift Online is Red Hat’s public cloud application deployment and hosting platform. Get on-demand access to OpenShift to build, deploy and manage scalable containerized applications, operated and supported by Red Hat.
  3. OpenShift Dedicated is a container application platform hosted on Amazon Web Services (AWS) or Google Cloud Platform and managed by Red Hat. OpenShift Dedicated is built on Red Hat Enterprise Linux, Docker container technology, and Google Kubernetes for orchestration and management.
  4. OpenShift Enterprise/Container Platform is an enterprise-ready Kubernetes container platform with full-stack automated operations to manage hybrid cloud and multi-cloud deployments. Red Hat OpenShift is optimized to improve developer productivity and promote innovation.

As shown in the above image, we need to understand Docker, Kubernetes and related tools to understand better about OpenShift.

Docker: Docker is the fundamental technology that powers the development of containerized applications in the form of reusable images. Docker enables us to create an image with all prerequisite dependencies of an application. These images can be deployed in any environment.

Kubernetes: Powers deployment and management of Docker images across large clusters by providing self-healing and autoscaling features.

Note: OpenShift built on these technologies by providing the layer of tools that abstract the underlying Kubernetes and infrastructure management tasks to help developers to easily deploy and manage their applications on the Kubernetes based infrastructure.


StringJoiner vs StringBuffer vs Collectors.Joining() Performance Test

In this article we are sharing the program to identify which is the best performance provider out of StringJoiner, StringBuffer, StringBuilder and Collectors.joining() while joining/appending String.

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
public class PerformanceTest {
	public static void main(String[] args) {
		List<String> l = new ArrayList<>();
		for(int i=0;i<1000;i++) {
		long start = System.currentTimeMillis();
		long middle = System.currentTimeMillis();
		System.out.println("Time taken by StringJoiner : "+(middle - start));
		long end = System.currentTimeMillis();
		System.out.println("Time taken by StringBuffer : "+(end-middle));
		long end1 = System.currentTimeMillis();
		System.out.println("Time taken by Collectors.joining() : "+(end1 - end));
		System.out.println("Time taken by StringBuilder : "+(System.currentTimeMillis() - end1));
	private static void usingStringJoiner(List<String> list) {
		StringJoiner sj = new StringJoiner("|"); -> code != null).forEach(code -> sj.add(code));
		String s = sj.toString();
	private static void usingStringBuffer(List<String> list) {
		StringBuffer buf = new StringBuffer(); -> buf.append(code).append("|"));
		String output = buf.toString();
		if (output.endsWith("|")) {
			output = output.substring(0, output.length() - 1);
	private static void usingCollectors(List<String> list) {
		String str ="|"));
	private static void usingStringBuilder(List<String> list) {
		StringBuilder builder = new StringBuilder(); -> builder.append(code).append("|"));
		String output = builder.toString();
		if (output.endsWith("|")) {
			output = output.substring(0, output.length() - 1);

Time taken by StringJoiner : 49
Time taken by StringBuffer : 2
Time taken by Collectors.joining() : 4
Time taken by StringBuilder : 3

If you observe the above statistics of StringJoiner and Collectors.joining(), StringJoiners are taking 49 milliseconds to complete the task where Collectors.joining() is taking only 4 milliseconds which is 45 milliseconds lesser. Here one point I would like to bring to your notice is, StringJoiner is used in the implementation of joining() in Collections. But, when I use StringJoiner externally, it is taking more time than how joining() performing.

public static Collector<CharSequence, ?, String> joining(
CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
    return new CollectorImpl<>(
            () -> new StringJoiner(delimiter, prefix, suffix),
            StringJoiner::add, StringJoiner::merge,
            StringJoiner::toString, CH_NOID);

StringJoiner internally uses StringBuilder to store value.

 * StringBuilder value -- at any time, the characters constructed from the
 * prefix, the added element separated by the delimiter, but without the
 * suffix, so that we can more easily add elements without having to jigger
 * the suffix each time.
private StringBuilder value;

/* preparing StringBuiler object in StringJoiner */
private StringBuilder prepareBuilder() {
  if (value != null) {
  } else {
    value = new StringBuilder().append(prefix);
  return value;

StringBuilder has been used across all the methods of StringJoiner to perform various operations. There is one more option of using StringUtils.join() method to perform similar operation. I would like to suggest to use StringBuffer than StringUtils because it internally uses the StringBuffer only to store value.

Docker Container

Objective of this article to explain about Docker Container and why do we need to use them.

What is Docker Container?

A Container is a standard unit of software packages up code and all its dependencies, so the application runs quickly and reliably from one computing environment to another. Docker is the container based, industry best software. Docker container is lightweight, standalone, executable package of software that includes everything needed to run an application such as code, runtime, system tools, system libraries and settings.

Container images become containers at runtime and in the case of Docker containers, image become container when they run on Docker Engine. Docker container that runs on Docker Engine,
Standard: Docker created the industry standards for Containers, so they could be portable anywhere.
Lightweight: Containers share the machine OS system kernel, so does not require OS per application.
Secure: Docker provides the strongest default isolation capabilities in the industry and applications are safer in containers.

Why do we need to use Docker Container?

As shown in the below diagram, there could be the dependencies between applications and its underlying software which is using to run. There could be many chances of raising problems with infrastructural and dependencies issues.

Application dependencies without Docker support

That’s where docker helps us to containerize each and every application into individual containers. Each individual container contains its dependent code, dependencies, system configurations, etc. So, they run any where.

Application dependencies with Docker support

If you observed the difference between above two images, image without Docker shown the common library and dependencies which is shared across multiple applications. Image with Docker will clearly shows that each individual docker container contains it’s libraries and Dependencies. So, with docker there is not chance of getting the problems related to libraries and dependencies and there is no chance of saying it works in my machine.