XenonStack

A Stack Innovator

Post Top Ad

Showing posts with label serverless microservices. Show all posts
Showing posts with label serverless microservices. Show all posts

Tuesday, 6 June 2017

6/06/2017 11:46:00 am

Top 10 Things To Know in DevOps

Introduction To DevOps


DevOps is a Modern software engineering Culture and Practices to develop a software where the development and operation teams work hand in hand as one unit, unlike the traditional ways i.e. Agile Methodology where they worked individually to develop a software or provide required services.

The traditional methods before DevOps were time-consuming and lacked understanding between different departments of software development, which lead to more time for updates and to fix bugs, therefore ultimately leading to customer dissatisfaction. Even to make a small change, the developer has to change the software from the beginning.

That’s why we are adopting such a culture, that allows fast, efficient, reliable software delivery through production.


DevOps Features


  • Maximize speed of delivery of the product.
  • Enhanced customer experience.
  • Increased time to value.
  • Enables fast flow of planned work into production.
  • Use Automated tools at each level.
  • More stable operating environments.
  • Improved communication and collaboration.
  • More time to innovate.


    DevOps Consists of 5 C’s


    DevOps practices lead to high productivity, lesser bugs, improved communication, enhanced quality, faster resolution of problems, more reliability, better and timely delivery of software.

  • Continuous Integration
  • Continuous Testing
  • Continuous Delivery
  • Continuous Deployment
  • Continuous Monitoring



 

1. Continuous Integration 


Continuous integration means isolated changes are tested and reported when they are added to a larger code base. The goal of continuous integration is to give rapid feedback so that any defect can be identified and corrected as soon as possible.

Jenkins is used for continuous integration which follows 3 step rule i.e. build, test and deploy. Here developer does frequent changes to the source code in shared repository several times a day.

Along with Jenkins, we have more tools too i.e. BuildBot, Travis etc. Jenkins widely used because it provides plugins for testing, reporting, notification, deployment etc.

2. Continuous Testing 


Continuous Testing is done to obtain immediate feedback on the business risk associated with Software Release. It's basically difficult and essential part of the software. Software rating depends upon Testing. Test function helps the developer to balance the quality and speed. Automated tools are used for testing as it is easier to do testing continuously instead of testing a whole software. Tool used for testing the software is Selenium 

3. Continuous Delivery 


Continuous Delivery is the ability to do changes like including new features, configuration management, fixes bugs and experiments into production. Our motive for doing continuous delivery is the continuous daily improvement. If there is any kind of error in the production code, we can quickly fix it that time. So, here we are developing and deploying our application rapidly, reliably and repeatedly with minimum overhead.

4. Continuous Deployment 


The code is automatically deployed to the production environment as it passes through all the test cases. Continuous versioning ensures that multiple versions of the code are available at proper places. Here every changed code is put into production that automatically resulting in many deployments in production environment every day.


5. Continuous Monitoring 


Continuous Monitoring is a reporting tool because of which developers and testers understand the performance and availability of their application, even before it is deployed to operations. Feedback provided by continuous monitoring is essential for lowering cost of errors and change. Nagios tool is used for continuous monitoring.

Learn How XenonStack DevOps Solutions can help you Enable Continuous Delivery Pipeline Across Cloud Platforms for Increased Efficiency and Reduced Cost Or Talk With Our Experts

Key Technologies and Terminologies In DevOps

 

6. Microservices


Microservices is an architectural style of developing a complex application by dividing it into smaller modules/microservices. These microservices are loosely coupled, deployed independently and are focused properly by small teams.

With Microservices developers can decide how to use, design, language to choose, platform to run, deploy, scale etc.


Advantages Of Microservices


  • Microservices can be developed in variable programming languages.
  • Errors in any module or microservices can easily be found out, thus saves time.
  • Smaller modules or microservices are easier to manage.
  • Whenever any update required, it can be immediately pushed on that particular microservices, otherwise, the whole application needs to be updated.
  • According to client need, we can scale up and down particular microservice without affecting the other microservices.
  • It also leads to increase in productivity.
  • If any one module goes down, the application remains largely unaffected.

Disadvantages Of Microservices


  • If any application involves the number of microservices, then managing them becomes a little bit difficult.
  • Microservices leads to more memory consumption.
  • In some cases, testing microservices becomes difficult.
  • In production, it also leads to complexity of deploying and managing a system comprised of different types of services.


7. Containers

 

 

Containers create a virtualization environment that allows us to run multiple applications or operating system without interrupting each other.

With the container, we can quickly, reliably and consistently deploy our application because containers have their own CPU, memory, network resources and block I/O that shares with the kernel of host operating system.

Containers are lightweight because they don’t need the extra load of a hypervisor, they can be directly run within host machine.

Before we were facing a problem that code can easily run on developer environment but while executing it in the production environment, dependency issue occurs.

Then virtual machines came, but they were heavyweight that leads to wastage of RAM, the processor is also not utilized completely. If we need more than 50 microservices to run then, VM is not the best option.

Docker is light weighted Container that has inbuilt images and occupies very less space comparatively. But for running a docker we need a Linux or Ubuntu as a host machine.


Terms used in docker that are:-

Docker Hub - It's cloud hosted service provided by Docker. Here we can upload our own image or also can pull the images in public repository.

Docker Registry - Storage component for docker images Either we can store in public repository or in private repository. We are using this to integrate image storage with our in-house development workflow and also to control where images are to be stored.

Docker images - Read only template that is used to create the container. Built by docker user and stored on docker hub or local registry.

Docker Containers - It's runtime instance of Docker image. It's built from 1 or more images.

Hence Docker helps in achieving application issues, Application Isolation, and faster development.


Advantages Of Containers


  • Wastage of resources like RAM, Processor, Disc space are controlled as now there is no need to pre-locate these resources and are met according to application requirements.
  • It’s easy to share a container.
  • Docker provides a platform to manage the lifecycle of containers.
  • Containers provide consistent computation environment.
  • Containers can run separate applications within a single shared operating system.

8. Container Orchestration


Container Orchestration is Automated, Arrangement, Coordination, and Management of containers and the resources they consume during deployment of a multi-container packed application.

Various features of Container Orchestration includes 

  • Cluster Management - Developer’s task is limited to launch a cluster of container instances and specify the tasks which are needed to run. Management of all containers is done by Orchestration.

  • Task Definitions - It allows the developer to define task where they have to specify the number of containers required for the task and their dependencies. Many tasks can be launched through single task definition.

  • Programmatic Control - With simple API calls one can register and deregister tasks, and launch and stop Docker containers.

  • Scheduling - Container scheduling deals with placing the containers from the cluster according to the resources they need and the availability of requirements.

  • Load Balancing - Helps in distributing traffic across the containers/deployment.

  • Monitoring - One can monitor CPU and memory utilization of running tasks and also gets alerted if scaling is needed by containers.

Tools used for Container Orchestration


For Container orchestration different tools are used, few are open source tools like Kubernetes, and Docker Swarn which can be used privately, also some paid tools are there like AWS ECS from Amazon, Google Containers, and Microsoft Containers.

Some of these tools are briefly explained below:


 


  • Amazon ECS - Amazon ECS is yet another product from Amazon Web Services that provides the runtime environment for Docker Containers and provide orchestration. It allows running Dockerized applications on top of Amazon’s Infrastructure.


  • Docker Swarm - It’s an open source tool, part of Docker’s landscape. With this tool, we can run multiple docker engines as a single virtual Docker. This is Dockers own containers orchestration Tool. It consists of the manager and worker nodes that run different services for orchestration. Managers that distributes tasks across the cluster and worker node run containers assigned by managers.

  • Google Container Engine - Google Container Engine allow us to run Docker containers on Google Cloud Platform. It schedules the containers into the cluster and manages them as per the requirements were given. It is built on the top of Kubernetes i.e. an open source Containers Orchestration tool.

    Continue Reading About Latest DevOps Trends At: XenonStack.com/Blog

Friday, 10 February 2017

2/10/2017 03:45:00 pm

Building Serverless Microservices With Python


Serverless Computing is Exploding


As we move to the different models of production, distribution, and management when it comes to applications, it only makes sense that abstracting out the, behind the scenes processes should be handled by third parties, in a move towards further decentralization.

And that’s exactly what serverless computing does – and startups and big companies are adopting this new way of running applications.

In this post, we will discover answers to questions:

What Serverless is all about and how does this new trend affect the way people write and deploy applications?

Serverless Computing


"Serverless” denotes a special kind of software architecture in which application logic is executed in an environment without visible processes, operating systems, servers or virtual machines.

It’s worth mentioning that such an environment is actually running on the top of an operating system and use physical servers or virtual machines, but the responsibility for provisioning and managing the infrastructure entirely belongs to the service provider.

Therefore, a software developer focus more on writing code.

Serverless Computing Advances the way Applications are Developed


Serverless applications will change the way we develop applications. Traditionally a lot of business rules, boundary conditions, complex integrations are built into applications and this prolongs the completion of the system as well as introduces a lot of defects and in effect, we are hard wiring the system for certain set of functional requirements.

The serverless application concept moves us away from dealing with complex system requirements and evolves the application with time. It is also easy to deploy these microservices without intruding the system.

Below figure shows how the way of application development changed with time.

Monolith- A monolith application puts all its functionality into a single process and scale by replicating the monolith on multiple servers.

Microservice- A microservice architecture puts each functionality into a separate service and scale by distributing these services across servers, replicating as needed.

FaaS- Distributing Microservices further into functions which are triggered based on events.

Monolith => Microservice => FaaS


building serverless microservices with python


Let’s get started with the deployment of a Serverless Application on NexaStack.To create a function, you first package your code and dependencies in a deployment package. 

Then, you upload the deployment package on our environment to create your function.
  • Creating a Deployment Package
  • Uploading a Deployment Package

You May also Like: Building Serverless Microservices With Java

Database Integration For Your Application


  • Install MongoDB and configure it to get started.
  • Create Database EmployeeDB
  • Create table Employee
  • Insert some records into the table for the demo.
  • Write a file “config.py” to setup configuration on the serverless architecture as shown below.


building serverless microservices with python

 

Continue Reading the full Article at: XenonStack.com/Blog

Monday, 6 February 2017

2/06/2017 11:16:00 am

Building Serverless Microservices With JAVA


Serverless Architecture


The phrase “serverless” doesn’t mean servers are no longer required. It solely proposes that developers no longer have to think that much about them.

Going serverless lets developers shift their focus from the server level to the task level which is writing codes.


serverless microservices with java


 

What it means to have servers?


First, let’s talk about what it means to have servers (virtual servers) providing the computing power required by your application. Owning servers comes with responsibilities -
  • Managing how the primitives (functions in the case of applications, or objects when it comes to storage) map to server primitives (CPU, memory, disk etc.).
  • Own provisioning (and therefore paying) for the capacity to handle your application’s projected traffic, independent of whether there’s actual traffic or not.
  • Own managing reliability and availability constructs like redundancy, failover, retries etc.

Advantages of going Serverless


Why should one move to serverless architecture can be adequately described through its benefits.

  • PaaS and Serverless - A user of traditional PaaS have to specify the amount of resources—such as dynos for Heroku or gears for OpenShift—for the application. The Serverless platform will take care of finding a server where the code is to run and to scale up when necessary.
  • Lower operational and development costs - The containers used to run these functions are decommissioned as soon as the execution ends. And the execution is metered in units of 100 ms, You don't pay anything when your code isn't running.
  • Fits with microservices, which can be implemented as functions.

Serverless architectures refer to applications that significantly depend on third-party services (knows as Backend as a Service or "BaaS") or on custom code that's run in ephemeral containers (Function as a Service or "FaaS").

But there are cons related to moving your application to FaaS which is discussed in our next post: Building Serverless Microservices with Python

Simplest way of thinking about FaaS is that it changes thinking from "build a framework to sit on a server to react to multiple events to "build/use micro-functionality to react to a single event."

How to migrate to a Microservices Architecture?


In a simple definition, Microservices are independently scalable, independently deployable systems that communicate over some protocols HTTP (XML, JSON), Thrift, Protocol Buffers etc.

Microservices are Single Responsibility Principle at code base level.

Below are some of the factors that can be followed to build Microservices:
  • One code per app/service: There is always a one-to-one correlation between the codebase and the service.
  • Explicitly declare and isolate dependencies: This can be done by using packaging systems.
  • Use environment variables to store configurations.
  • Strictly separate build, release and run stages.
  • Treat logs as event streams. Route log event stream to analysis system such as Splunk for log analysis.
  • Keep development, staging, and production as similar as possible.


Microservices Architecture: Benefits


Microservices Architectures have lots of very real and significant benefits:
  • Systems built in this way are inherently loosely coupled
  • The services themselves are very simple, focusing on doing one thing well
  • Multiple developers and teams can deliver independently under this model
  • They are a great enabler for continuous delivery, allowing frequent releases whilst keeping the rest of the system available and stable
In this post, we will implement a Nexastack function which integrates with a database(MongoDB used here).

We are going to implement this new function in Java using Spring Framework. So, Let’s get started -

Employee Service


We are going to build an Employee Service consisting of a function to show Employees information from the database.

For Demo purpose we are here implementing one function “GetEmployee”.
serverless microservices with java

1. Setting up MongoDB Instance 


  • Install MongoDB and configure it to get started.
  • Create Database EmployeeDB
  • Create table Employee
  • Insert some records into the table for demo.
  • Write a file “config.properties” to setup configuration on the serverless architecture


serverless microservices with java


 Continue Reading the full article at: XenonStack.com/Blog