Showing posts with label Container. Show all posts
Showing posts with label Container. Show all posts

Monday, June 10, 2019

Kubernetes Introduction



Kubernetes is an open source platform for automating the deployment, scaling, and management of containerized applications and services. It was developed in response to the challenges of deploying and managing large fleets of containers at Google, which open sourced the project and donated it to the Cloud Native Computing Foundation (CNCF). That foundation fosters the cloud native computing ecosystem. Kubernetes was the first graduated project for CNCF, and it became one of the fastest growing open source projects in history. Kubernetes now has more than 2,300 contributors and has been widely adopted by companies large and small, including half of the Fortune 100.

1) Kubernetes is a production-ready, open source platform designed with Google's accumulated experience in container orchestration,

With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day.
Containerization helps package software to serve these goals, enabling applications to be released and updated in an easy and fast way without downtime.
Kubernetes helps you make sure those containerized applications run where and when you want,
and helps them find the resources and tools they need to work.

2) One can say Kubernetes is a Multi Container management solution
3) Kubernetes gives containers their own IP addresses and a single DNS name for a set of containers, and can load-balance across them.
4) Automatically mount the storage system of your choice, whether from local storage, a public cloud provider such as GCP or AWS or a network storage system
5) Kubernetes progressively rolls out changes to your application or its configuration,
   while monitoring application health to ensure it doesn’t kill all your instances at the same time
6) If something goes wrong, Kubernetes will rollback the change for you
7) In addition to services, Kubernetes can manage your batch and CI workloads, replacing containers that fail, if desired.
8) It Automatically places containers based on their resource requirements and other constraints,
9) It Restarts containers that fail, replaces and reschedules containers when nodes die, kills containers that don’t respond to your user-defined health check,
10) Deploy and update secrets and application configuration without rebuilding your image and without exposing secrets in your stack configuration.

Kubernetes is cluster orchestration system.
Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit.
Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines.
Kubernetes automates the distribution and scheduling of application containers across a cluster in a more efficient way.
Kubernetes is an open-source platform and is production-ready.

-> A Kubernetes cluster consists of two types of resources:
Master: The Master coordinates or manage the cluster
Node: Nodes are the workers that run applications.

-> The master coordinates all activities in your cluster:
- Scheduling applications
- Maintaining applications' desired state,
- Scaling applications
- Rolling out new updates.

-> A Pod represents a unit of deployment: a single instance of an application in Kubernetes, which might consist
of either a single container or a small number of containers that are tightly coupled and that share resources.

Friday, July 29, 2016

Everything About Servlet

Basic meaning of Servlet is Let Serv. 
It a technology to receive a user's Request and Serv back a Response.

In java Servlet is an Interface.
It contains four methods declaration.

public interface Servlet{
    void     destroy();
    ServletConfig     getServletConfig();
    java.lang.String     getServletInfo();
    void     init(ServletConfig config);
    void     service(ServletRequest req, ServletResponse res);
}


Usually developers prepare servlet classes to receive HTTP request and send back HTTP Response.
Servlet works on the HTTP (Hyper Text Transfer Protocol) protocol.

The servlet interface contains method to Inititlize a servlet, to serv the request, and to provide back response.
and to destroy or remove servlet from the server.

To use this servlet interface or to implement this servlet interface, developer can prepare a class which extends the GenericServlet (javax.servlet.GenericServlet) class OR developer can extends the
HttpServlet(javax.servlet.http.HttpServlet) class.

All the servlet classes have their servlet life cycle.
First the Servlet is Initialized by the container using the init(ServletConfig config) method.


Then all the clients requests are handled using the service(ServletRequest req, ServletResponse res) method and finally servlet is destroyed by the container.
(Note: All the Servlet instances are destroyed when server is shutting down )


The init(ServletConfig config) method is called exactly once in the life cycle of a servlet. It is called by Container.


Before serving any request the servlet's init methos's execution must be successfully complete.

All servlets have their configuration information in the ServletConfig object.
ServletConfig object are servlet specific.

Servlet is initialized on the applications startup or on the first request received to that servlet.


There is always one instance of each servlet in webapp.
Developer cannot destroy servlet on their need base. Only container can destroy the servlet.

ServletConfig (Servlet Configuration)

public interface ServletConfig{
    java.lang.String     getInitParameter(java.lang.String name);
    java.util.Enumeration<java.lang.String>     getInitParameterNames();
    ServletContext     getServletContext();
    java.lang.String     getServletName();
}

ServletConfig is an Interface


When the Web Container initializes the Servlet then it container creates the ServletConfig object by reading servlet specific information from the web.xml file and passes the ServletConfig object to the Servlet's init method.

There is always one ServletConfig object per servlet instance.
Developer can get the ServletConfig object using the getServletConfig() method.
i.e.


ServletConfig sc = getServletConfig();
out.println(sc.getInitParameter("dbUrl"));

ServletConfig object provides the ServletContext object using the getServletContext() method.
It provides the Init Parameters values configured into web.xml file, using the getInitParameter(java.lang.String name) method.
It provides the Servlet Instance name using the getServletName() method.
It provides its own Init Parameters names using the getInitParameterNames() method.

ServletContext (Servlet Context)

ServletContext is an Interface


public interface ServletContext{
    .......
    java.lang.Object     getAttribute(java.lang.String name);
    java.util.Enumeration<java.lang.String>     getAttributeNames();
    java.lang.String     getContextPath();
    java.lang.String     getInitParameter(java.lang.String name);
    .......
}


It has lots of more  methods.
There is one ServletContext object "per application" per JVM(Java Virtual Machine).


Container created the ServletContext object when it created the servlet config object.


It passed the ServletContext object to the servlet config. so developer can have the servlet context object using the ServletConfig object.


Developer can put all the application specific informtion into the servlet context object. So, the information will be accessible to whole application.


It means to share the information between multiple servlets in a web app, servlet context can be used.

Wednesday, September 2, 2015

Servlet Container's Role

Loads the servlet.
Authenticate the user (if required).
Calls the service method.
Update the current session(if required).
Create a resuest object (javax.servlet.ServletRequest interface or the javax.servlet.http.ServletRequest).
Populate the required information in the request object.
Create a response object (javax.servlet.ServletResponse interface or the javax.servlet.http.ServletResponse).

Scrum and Scrum master

Scrum  Scrum is a framework which helps a team to work together.  It is like a rugby team (the scrum name comes from rugby game). Scrum enco...