What is the difference between a monolithic architecture and a 3-tier architecture? - amazon-web-services

I have an application which is packaged as a single ear file deployed on WebSphere. Inside the package, the code is organized in to UI files, Business Logic files and Database related files. Now, is this a monolithic application or a 3-tier architecture?
What is the difference?

You are comparing wrong things. Monolithic application need to be compared against Micro Services. In monolithic application; you deploy all the features/api end-points in a single EAR/WAR file; i.e. single JVM. In micro-services they are deployed in multiple JVMs. Note that in Monolithic architecture also you have multiple REST end points exposed.
3 tier, or 2 tier or N tier architectures is a different concept. It says how many subsystems/modules your application is divided like database layer, client layer, application logic layer. Hence, monolithic as well microservices both can be n tier applications.

Remember that a EAR and what is in it is a packaging choice. Your same application can be deployed in multiple ears in multiple Java EE containers on one or more servers. The EJB-jars and WARs are intended to do that. With Java EE you choose how to distribute you application across the containers and nodes based on what make sense.
Technically a tiered application is one where the layers can be independently deployed, distributed and accessed. I.e. my business logic can be on 5 servers in 9 ejb containers and accessed by 3 user interfaces that could be desktop, mobile, web etc. And possibly parts of different applications.
The more traditional definition of a monolith was an application that wasn't tier. Specifically that its parts cannot be composed in to other applications at runtime

Related

Multiple web jobs on same App Service or single Web Job on multiple app services?

I need to deploy multiple web jobs for my current project. However, none of them will be too resource intensive, so I will be using the same App service plan. I am trying to decide between
Create separate App Services per Web Job and deploy them all into the same App Service Plan OR
Create a single App service, and deploy multiple instances of the Web Job into that same app service, with different web job names to make them unique
I know this answer may be based on different opinions, but I am hoping you could share some things to consider. For e.g., one advantage of #1 is that it is easier for me to deploy each web job separately in that option. Any other things that I should consider?
Thanks!
#Snooks, Web Apps are designed to run multiple Web Jobs and there is no platform limit (although there might be practical limits depending on what your web job is doing). My suggestion would be to go with route 1 from a management perspective. This will make life easier when navigating through the portal etc.
A third option to consider as well would be Azure Functions (serverless). While many customers create app services that aren't hosting any web site just to use for the web job capability, the initial intention was for app services services to serve web sites and then also have automation capability via web jobs.
Since web jobs became so popular, Azure Functions was born to provide a more focused product on task/job automation (and much more) while running on a serverless platform. This means you only pay for what you consume, whereas with a web app, you pay a flat rate each month, no matter how much or how little you consume.
If your requirements state you must go the route of Web Jobs, I would certainly go with route 1 just to avoid having to manage multiple apps. If you are willing, I think it's worth looking into Azure Functions to see if it meets your needs.

Boilerplate for independently deployable microservices based on Serverless framework

Following the principles of microservices,
Defined domain: Each microservice has a defined domain of responsibility (sometimes referred to as a bounded context). The microservice manages this domain itself, without concerning itself about other domains.
Self-contained: Each microservice is a self-contained unit. It may contain multiple components that all work together.
Independently deployable: Each microservice can be built and deployed as an independent entity. Deploying one microservice does not affect another microservice.
Manages data stores: The data store or stores used by each microservice should be contained within the microservice boundary, thereby ensuring that there are no hidden dependencies caused by data stores being shared.
Loosely coupled: Microservices should be loosely coupled, and ideally communication will occur asynchronously using event sourcing or queues.
Highly automated: The build, deployment, and ongoing management of microservices should emphasize automation wherever possible.
I am looking for recommendations for the code structure/boilerplate to realize these principles, especially- Independently deployable, loosely coupled, and contained data stores. Using the Serverless framework on AWS. Would be great to have references for boilerplates that have worked well and realize these principles such that deployment order shouldn't matter.
I came across https://github.com/trilom/sls-microservice but this has makefiles. Don't like the idea of having to use them.
I found this to be just what would serve the purpose right:
https://github.com/zotoio/generator-mono-serverless

Microservices in app with low load should I use?

My situation is as following:
We have a complex app, and I would like to break it into multiple development teams that can work in parallel. Microservices concept handles it well, but since the app doesn't have high load it's an overkill to host many different microservices. Thus the question: should I use microservies, or it will involve extra cost in Infrastructure?
Can I run microservices on the same machine in separate processes or I need Docker for each?
Every microserivce provide Web Services/REST, can they even be bound to one IIS or Docker is the only option? how will they resolve to the main app? Will I need API gateway?
If not Microservices, anything else I could use to avoid large monolithic application?
BTW, with Microservices - how do they share the same data in one db?
Usually there are main 3 benefits for adapting microservices:
Scalability, which isn't your interest.
Maintainability, in which each microservice has a clear usecase which result in a small amount of code, which result maintainability easier.
Fault-tolerance, if some microservice fail, others still functioning.
If you care only about complexity, Domain Driven Design can really help here, by dividing your monolith into different domains that can be distributed to different teams. Regarding the architecture, you can adopt normal SOA architecture. If you have a well defined domains, SOA or Microservices is just a deployment architecture then.
how do they share the same data in one db?
That is a very abstract question, thus the answer will be a bit abstract. Usually they don't share data in same db, in most cases each microservice will have its own db, some cases a cluster of microservices can share one db.
That's a lot of fundamental questions, which definitely need good answers before you proceed with your project. I recommend reading "Building microservices" from Sam Newman.

What is the difference between microservices and webservices?

The closest I got to finding the actual difference is this article.
But I didn't understand what would make me choose one over the other and if microservices can also use a REST API and communicate via http.
I mainly didn't understand what a microservice is and if it can come instead of a webservice, other than the purpose of
breaking large software applications into loosely coupled modules
A microservice is a software architecture, which can be implemented with webservices.
A webservice is just a technology (one of many) for providing services over "web" or HTTP.
The main point is: a web service is (as the name announces) something that you would expect to "deal" with HTTP - in other words it does something in the context of the world wide web.
Whereas a microservice is not subject to the WWW context. At its core a microservice is supposed to provide one specific service - but there is no restriction to the http protocol for example.
Often a microservice implements a restful "web service" - but it doesn't have to be that way!
Beyond that, microservices are often meant as counter model to a huge monolithic application that serves many different kind of requests.
I got simple answer here that says :
Microservices is a new software architecture. It is based on web services. But it can be any service implemented as an independent feature that has its own database and can be deployed independently.
Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually.
Microservices are the extension of web services.
Web services are typically vertical in nature(Provider-Consumer communication) whereas microservices are horizontal in nature
Microservices are seen as architecture due to the following.
microservices have belonged to one specific application.
microservices are addressing specific concern so that can be said as lightweight.
Changes are isolated in nature because the change in one microservice doesn't affect other (Ex. Changes done in login microservice does not affect the payment microservice)
Scaling individual microservices are easy.
Microservice usually has its own database.
Microservices : -
Microservice is a software architecture that can be used alongside web services. This method involves the splitting of large software applications into decoupled modules where microservices run unique processes and communicate through APIs. Its development can be through the use of either messaging, event-driven APIs, or using non-HTTP backed RPC mechanisms.
Microservices architecture saves the day when large applications fail or are down. If a particular service fails in communication, the overall application cannot be affected by the failure of a single module. The combination of microservices in Java, C#, Python, and mobile software development languages is possible. It can be independently deployed in service models for a business domain.
Web Services :-
A web service is just one of several technologies that can provide services over “web” or HTTP. As a specific type of service-oriented architecture (SOA), web services represent a web application’s functionality.
It defines a mechanisms interaction between an API and the main code by using standard HTTP protocol and universal formats of data representation such as XML, JSON, and so on. This allows software applications developed by different technologies to communicate with each other.
Web services are not involved with frontend development. They are not connected to any development languages or user device software platforms. The combination of different web services into a single one is also possible if written in different languages and for separate operating systems, just like in microservices.
Microservice is a subset of web services. Also used to name Architectures like "Architecture based on microservices"
Microservice is an artifact, not an architecture. Several world class companies know that
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb-shared.html
Before the microservice artifact, we had the classic web service or rest api. Even before this we had the Soap web services with XML.
So, as a summary when someone talk about microservice, he means a subset of web service with some characteristics that differentiate it from classic web services or rest api.
One main characteristic is a unique database or Database per Service
Here another characteristics from the goods like AWS. Some of them apply to rest apis or soap services. I will mark with bold some very specific for microservices.
https://aws.amazon.com/microservices/
Agility
Flexible Scaling
Easy Deployment
Technological Freedom
Reusable Code
Resilience
https://microservices.io/
Highly maintainable and testable
Loosely coupled
Independently deployable
Organized around business capabilities
Owned by a small team
https://www.baeldung.com/cs/microservices-db-design
Database per Service
CQRS
https://learn.microsoft.com/en-us/azure/architecture/microservices/design/data-considerations
Microservice is a piece of autonomous application that performs for a larger application architecture.
Web service is an approach to make the application available to other applications by web ui.

What is the difference between a web service and application layer of code in an application server

Hello I am a newbie to n-tier architecture and was trying to find out the difference between what an application server hosting application layer of code does, and what a web service does?
So I'll tell you people my understanding of the whole n-tier concept, we have the UI -> Web Server -> business logic/application logic on an Application server -> Database Server. (Of course load balancers and multiple server instances would also be existent to fasten and store the state of processes)
But to be specific, the business logic layer would not be tied to a UI, so it is more or less independent and can be reused.
A web service on an other hand too provides functionality similar to the business logic, where it is not tied to a UI, and can be reused for different cases.
Could anybody explain if what I just explained above is right? And as I did mention earlier, I am a newbie to this, so if this sounds stupid or naive please do not bash me :)
Here's a quick, dirty, and very general explanation of a 4-tier architecture, which I'm assuming may best apply to your application:
Presentation Layer : The interface to the outside world (web site)
Application Layer : The mechanics necessary to create the interface(s) to the outside world (web application frameworks, web services)
Business Logic Layer : The actual logic that embodies/simulates/emulates your business's processes and workflows (algorithms, transformations, approval processes, etc.)
Database Layer : The database and the logic needed to query information from it
In general, web services are not part of the business logic layer. That layer is usually protected as much as the database layer, because there could be trade secrets or confidential ways of doing things in there, and you usually don't want anyone accessing that directly, except programatically or through approved interfaces (such as web services).
Web services, application layers, and business logic can be aptly compared to Coca-Cola and it's business. Bottles and cans are usually how Joe Blow consumes Coke's product (e.g. web site in the presentation layer), but other businesses want to be able to serve Coca-Cola to their customers as well, so Coke lets them use carbonated water and Coca-Cola syrup (e.g. web services in the application layer). Coke's secret formula (e.g. business logic layer), and Coke's distribution processes to get it into the store (e.g. application layer) are all hidden from the consumer. Joe Blow doesn't care how it gets into the store, he just knows he can get Coke from a variety of sources (web site, mobile client, etc.). And Coke doesn't want people knowing its secret formula (business logic). If you want a Coke, you have to go through a store or a restaurant (approved interfaces).