Saturday, July 25, 2020

Kong Api Gateway

Kong Api Gateway
Kong Gateway is an open-source, lightweight API gateway optimized for microservices, delivering unparalleled latency performance and scalability.

Kong can be deployed, in a variety of configurations, as an edge API gateway, as an internal API proxy, or even as a sidecar in a service mesh configuration.



Key Concepts in Kong:

  • API Object – wraps properties of any HTTP(s) endpoint that accomplishes a specific task or delivers some service. Configurations include HTTP methods, endpoint URIs, upstream URL which points to our API servers and will be used for proxying requests, maximum retires, rate limits, timeouts, etc.
  • Consumer Object – wraps properties of anyone using our API endpoints. It will be used for tracking, access control and more
  • Upstream Object – describes how incoming requests will be proxied or load balanced, represented by a virtual hostname
  • Target Object – represents the services are implemented and served, identified by a hostname (or an IP address) and a port. Note that targets of every upstream can only be added or disabled. A history of target changes is maintained by the upstream
  • Plugin Object – pluggable features to enrich functionalities of our application during the request and response lifecycle. For example, API authentication and rate limiting features can be added by enabling relevant plugins. Kong provides very powerful plugins in its plugins gallery
  • Admin API – RESTful API endpoints used to manage Kong configurations, endpoints, consumers, plugins, and so on

There are two Kong modalities:
  • Community Edition: Kong’s CE version boasts a comprehensive range of functionalities, including open-source plugin support, load balancing and service discovery, bud does not include a management panel. Therefore, we will need to configure Kong via REST, or using an open-source dashboard, such as Konga or Kong Dashboard.
  • The Enterprise Edition features expanded out-of-the-box functionalities, such as the management dashboard, security plugins, metrics and 24×7 support, to name a few.
Kong Download Link : https://konghq.com/kong/itm_source=website&itm_medium=nav

Tuesday, July 21, 2020

Akka Toolkit

Akka is a free and open-source toolkit and runtime simplifying the construction of concurrent and distributed applications on the JVM.

Akka supports multiple programming models for concurrency, but it emphasizes actor-based concurrency, with inspiration drawn from Er-lang.

Akka handles all of the underlying threading complexities by allowing you to just focus on dividing your tasks into actors, defining messages to pass among actors, and wiring together their communication logic.

The real power of Akka is realized when you distribute actors across multiple machines.

Akka folows Actor Model.

In the actor model, the actor is represented as an individual entity. 
Some characteristics of the actor are as follows:
  • Actor encloses the state and application logic
  • Actor interacts only using messages.
  • Every actor has an exclusive address and mailbox through which he can receive messages from others.
  • Mailbox messages are processed by the actor in consecutive order.
  • Tree hierarchy is used to represent the actor system.
Benefits of using the Actor Model:
The following characteristics of Akka allow you to solve difficult concurrency and scalability challenges in an intuitive way:
  • Event-driven model — Actors perform work in response to messages. Communication between Actors is asynchronous, allowing Actors to send messages and continue their own work without blocking to wait for a reply.
  • Strong isolation principles — Unlike regular objects in Java, an Actor does not have a public API in terms of methods that you can invoke. Instead, its public API is defined through messages that the actor handles. This prevents any sharing of state between Actors; the only way to observe another actor’s state is by sending it a message asking for it.
  • Location transparency — The system constructs Actors from a factory and returns references to the instances. Because location doesn’t matter, Actor instances can start, stop, move, and restart to scale up and down as well as recover from unexpected failures.
  • Lightweight — Each instance consumes only a few hundred bytes, which realistically allows millions of concurrent Actors to exist in a single application.
Akka Actors:
  • Ask Pattern
  • Ask Pattern mapTo
  • Ask Pattern pipeTo
  • Actor Hierarchy
  • Actor Lookup
  • Child actors
  • Actor Lifecycle
  • Actor PoisonPill
  • Error Kernel Supervision
Akka Routers:
  • RoundRobinPool
  • ScatterGatherFirstCompletedPool
  • TailChoppingPool
  • BroadcastPool
Akka Dispatchers:
  • Akka Default Dispatcher
  • Akka Lookup Dispatcher
  • Fixed Thread Pool Dispatcher
  • Resizable Thread Pool Dispatcher
  • Pinned Thread Pool Dispatcher

Akka HTTP: 

As the name implies, this module is typically best suited for middle-tier applications which require an HTTP endpoint. As an example, you could use Akka HTTP to expose a REST endpoint that interfaces with a storage layer such as a database. For additional information, you can refer to the official Akka documentation on Akka HTTP.


Akka Streams:

This module is useful when you are working on data pipelines or even stream processing. For additional information, you can refer to the official Akka documentation on Akka Streams.


Akka Networking:

This module provides the foundation for having actor systems being able to connect to each other remotely over some predefined network transport such as TCP. For additional information, you can refer to the official Akka documentation on Akka Networking.


Akka Clustering:

This module is an extension of the Akka Networking module. It is useful in scaling distributed applications by have actors form a quorum and work together by some predefined membership protocol. For additional information, you can refer to the official Akka documentation on Akka Clustering.


For Creating a Simple Application,use the below link

https://developer.lightbend.com/start/?group=akka&project=akka-quickstart-java




 

Monday, July 20, 2020

Spring Cloud

Developing distributed systems can be challenging. Complexity is moved from the application layer to the network layer and demands greater interaction between services.

Making your code "cloud-native" means dealing with 12-factor issues such as external configuration, statelessness, logging, and connecting to backing services.

The Spring Cloud suite of projects contains many of the services you need to make your applications run in the cloud.

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). 
Features of Spring Cloud:
  • Distributed/versioned configuration
  • Service registration and discovery
  • Routing
  • Service-to-service calls
  • Load balancing
  • Circuit Breakers
  • Global locks
  • Leadership election and cluster state
  • Distributed messaging

Spring Cloud Netflix:
Spring Cloud Netflix features:
  • Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans
  • Service Discovery: an embedded Eureka server can be created with declarative Java configuration
  • Circuit Breaker: Hystrix clients can be built with a simple annotation-driven method decorator
  • Circuit Breaker: embedded Hystrix dashboard with declarative Java configuration
  • Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations
  • Client Side Load Balancer: Ribbon
  • External Configuration: a bridge from the Spring Environment to Archaius (enables native configuration of Netflix components using Spring Boot conventions)
  • Router and Filter: automatic registration of Zuul filters, and a simple convention over configuration approach to reverse proxy creation

Thursday, July 9, 2020

Configure New Relic

NewRelic is an APM (Application performance management) tool, it helps in monitoring the JVM, databases, transactions, external services, etc.

New Relic has an agent, which is a small piece of code that sits inside the web application and watches what the web page code is building while it’s building web pages.

 The agent measures how long the code takes to build the web page and reports it back to the user. It informs the user of the time taken for a page to load and specifies if any factors are delaying the process.

It displays the load time for users all across the globe accessing the web application and it follows it all the way down, right to the code.

So the user will be able to determine if the longer load time is caused by something in your server, code, network, or in the browser, etc.

Command: java -javaagent:newrelic\newrelic.jar -jar yourapplication.jar

Key features of New Relic include:

  • Key business transaction monitoring
  • External services performance monitoring
  • Availability and error monitoring
  • End-to-end user monitoring through browser support
  • Synthetic monitoring
  • Alerts and notifications
  • Native integration with third-party tools such as Slack and PagerDuty

A sample demo can be viewed from my youtube channel:



 

 


Tuesday, July 7, 2020

Introduction to Heroku

Heroku is a Platform as a Service (PaaS), delivering tools that enable software development. Heroku, as a PaaS, allows business to quickly deploy, build, manage, and scale enterprise-level applications while bypassing infrastructure headaches normally required to host an enterprise quality application.
 It acts as the middle-man between hosting/infrastructure and Salesforce.

Advantages
  • Easy setup - as a PaaS you don't need to know how to install and configure Apache, nginx, unicorn, passenger, MySQL, Postgres etc
  • Easier to scale initially - spin up more dynos, size up DBs etc
  • Great plugin support for third party apps
Disadvantages
  • Pricey - after the free tier the pricing is steep, you will pay literally 3x - 5x more than a comparable performing setup through an IaaS
  • Performance - as highlighted by rap genius recently the switch away from being purely a Rails PaaS and the updates to the routing engine has worse performance which translates to more dynos and still higher costs
  • Lock-In - since you aren't managing your infrastructure you can't move it to take advantage of savings
  • Single point of failure - granted it happens rarely but it's there. Architecting around this on your own requires a lot of experience but you'll be glad once you get past the learning curve.
We can perform operations on heroku by simply creating an account using below link.


Sunday, July 5, 2020

Vault by HashiCorp

Vault is a tool for securely accessing secrets. A secret is anything that you want to tightly control access to, such as API keys, passwords, or certificates.

Vault can be used when we are working on below Concepts:
1)Database credentials 
2)API keys for external services
3)credentials for service-oriented architecture communication.
4)Securing Configuration files
...etc

Key Features of Vault:
  • Secure Secret Storage: Arbitrary key/value secrets can be stored in Vault. Vault encrypts these secrets prior to writing them to persistent storage, so gaining access to the raw storage isn't enough to access your secrets.
  • Dynamic Secrets: Vault can generate secrets on-demand for some systems, such as AWS or SQL databases. For example, when an application needs to access an S3 bucket, it asks Vault for credentials, and Vault will generate an AWS keypair with valid permissions on demand. After creating these dynamic secrets, Vault will also automatically revoke them after the lease is up.
  • Data Encryption: Vault can encrypt and decrypt data without storing it. This allows security teams to define encryption parameters and developers to store encrypted data in a location such as SQL without having to design their own encryption methods.
  • Leasing and Renewal: All secrets in Vault have a lease associated with them. At the end of the lease, Vault will automatically revoke that secret. Clients are able to renew leases via built-in renew APIs.
  • Revocation: Vault has built-in support for secret revocation. Vault can revoke not only single secrets, but a tree of secrets, for example all secrets read by a specific user, or all secrets of a particular type. Revocation assists in key rolling as well as locking down systems in the case of an intrusion.
Vault Installation:
Vault can be installed from the below link.




Thursday, July 2, 2020

Deploy Spring Boot with Docker into AWS EC2

In this Post,we will be starting AWS EC2 instance and deploying the microservices on them using Docker.



Sample App can be found under below link: https://github.com/srinivastraining/Boot-docker

ES12 new Features