Wednesday, July 29, 2020
Multi-Module Project using Maven
Introduction to SpringBoot
- Create stand-alone Spring applications
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
- Provide opinionated 'starter' dependencies to simplify your build configuration
- Automatically configure Spring and 3rd party libraries whenever possible
- Provide production-ready features such as metrics, health checks, and externalized configuration
- Absolutely no code generation and no requirement for XML configuration
- Setup Java JDK from Oracle’s official site.
- Download and Setup STS(Spring Tools Suite).
- Start a new spring starter project
- Click on File -> New -> Spring starter project
- Fill the appropriate details and add dependency and finish.
- Edit the application properties.
- Run the main file as a Java application.
Saturday, July 25, 2020
Kong Api Gateway
- 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
- 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.
Tuesday, July 21, 2020
Akka Toolkit
- 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.
- 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.
- Ask Pattern
- Ask Pattern mapTo
- Ask Pattern pipeTo
- Actor Hierarchy
- Actor Lookup
- Child actors
- Actor Lifecycle
- Actor PoisonPill
- Error Kernel Supervision
- RoundRobinPool
- ScatterGatherFirstCompletedPool
- TailChoppingPool
- BroadcastPool
- 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
- 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
- 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
- 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
- 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.
Sunday, July 5, 2020
Vault by HashiCorp
- 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.
Thursday, July 2, 2020
Deploy Spring Boot with Docker into AWS EC2
-
Azure DevOps is also known as Microsoft visual studio team services (VSTS) is a set of collaborative development tools built for the cloud...
-
It is a tool for developers to develop, release, and operate production-ready containerized applications on Amazon ECS. From getting starte...
-
Docker Content trust When transferring data among networked systems, trust is a central concern. In particular, when communicating ove...