Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
After doing rigorous research and analysis I finally arrived to a point which is confusing me "Is Microservice a design pattern or architecture".
Some say it's a pattern evolved as a solution to monolithic applications and hence design pattern
And some confirms no doubt it's an architecture which speaks about their development, management, scalability, autonomous & full stack.
Any thoughts or suggestions I welcome to get myself clarified.
Microservices can be best described as an architectural style. Beside architectural decisions the style also includes organizational and process relevant considerations.
The architectural elements include:
Componentizing by business concern.
Strict decoupling in terms of persistence.
Well defined interfacing and communication.
Aim for smaller service sizes.
The organizational elements include:
Team organization around components (Conway's Law).
Team size limitations (two-pizza team).
The process relevant elements include:
Less centralized governance.
Smaller, more frequent releases.
Higher degree of freedom for technology decisions.
Product oriented development (agile, MVP, lean, etc).
For more details I recommend reading the articles from Martin Fowler.
I would describe it as a software architectural style that require functional decomposition of an application.
Usually, it involves a monolithic application is broken down into multiple smaller services, each deployed in its own archive, and then composed as a single application using standard lightweight communication, such as REST over HTTP or some async communication (of course, at some point micro services are written from scratch).
The term “micro” in microservices is no indication of the line of code in the service, it only indicates the scope is limited to a single functionality.
Each service is fully autonomous and full-stack. Thus changing a service implementation has no impact to other services as they communicate using well-defined interfaces. There are several advantages of such an application, but its not a free lunch and requires a significant effort in NoOps.
It's important to focus on that that each service must have the properties of:
Single purpose — each service should focus on one single purpose and do it well.
Loose coupling — services know little about each other. A change to one service should not require changing the others. Communication between services should happen only through public service interfaces.
High cohesion — each service encapsulates all related behaviors and data together. If we need to build a new feature, all the changes should be localized to just one single service.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I was talking to someone recently who said they are skipping the development of HATEOAS REST endpoints completely in favor of GraphQL. So I'm curious as to what the criteria set is for deciding when to use GraphQL vs. HATEOAS or is GraphQL just a better choice in general for an API Gateway / Edge Server architecture?
The pros and cons of each are:
GraphQL
Pro:
provides fine control of returned data in avoiding unneeded traffic
eliminates needing to go back to the well over and over for attached / "follow-on" data
following from the above, it allows the software designer to provide excellent performance by reducing latency - each query specifies all the things it needs, and the GraphQL implementation can assemble and deliver it with only one client<->server transaction
possibility of slow deprecations instead of versioned APIs
it's a query language
introspection is built-in
Con:
does not deal with caching (although there are now libraries that will take care of this)
HATEOAS / REST
Pro:
caching is a well-understood matter
relatively mature and well-understood
lots of infrastructure for eg CDNs to spread the load
very suitable for microservices
file uploads are possible
Con:
the "back to the well" problem
not as rigidly specified
each implementation of server and client(s) must make its own decisions
querying is not standard
Conclusions
One interesting comparison is that people use GraphQL as a frontend for REST APIs, but no-one in their right mind would consider doing the converse. If you go for a federated / microservices design, so one GraphQL server fronts for others, they can use a common specification of the API between the frontend and the microservices; this is less certainly true if the microservices are REST.
I think that so long as you have in mind the right questions to ask, GraphQL is going to be an important part of a well-designed system. Whether to skip HATEOAS entirely is unfortunately, "it depends".
Sources
My own experience, plus Phil Sturgeon's GraphQL vs REST: Overview
I love that Ed posted a link to my overview, but there's another article that I believe to be more relevant than that one.
The representation of state is completely different between the two.
https://blog.apisyouwonthate.com/representing-state-in-rest-and-graphql-9194b291d127
GraphQL is entirely unable to offer a series of "next steps" in a meaningful and standardized way, other than maybe shoving an array of strings containing potentially relevant mutations that you should try to hit up.
Even if you do that, it certainly cannot help you communicate with other HTTP APIs, which is a real shame.
Anyway, it's all that article! :)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm learning Spring Framework. So I want to build the application which architecture will be good enough. For example my application will be some kind of a social network. I'm using Spring Boot container for this web application.
Is this architecture is correct? I mean scalability, future code support, etc. What are advantages and disadvantages? I want to use REST api and microservices. 1 page = 1 controller = 1 service.
1 service, 1 controller, 1 page is not a good thing to limit yourself to. You'll find a page may use a whole bunch of different services. Imagine if your facebook profile was one controller. It would be gigantically large, impossible to maintain. Just break downs things as logically as you can. Sometimes it may make sense to have a page which uses multiple controllers, sometimes you could have a controller which handles multiple pages so you don't have 30 really small controllers. I would say if you have a complex page you'll need multiple controllers, if you have allot of very simple pages one controller may handle many of them.
Can I also suggest you don't break things up when you don't need to. All your micro services your planing can just be components in your application. Otherwise you will find you have a massive overhead of maintaining code which just forwards and receives HTTP requests. This could also cost you an extremely valuable tool: Transactions! You will lose transactions, and this could lead to inconsistencies in maintaining data. Keep in mind your just one person. I have been trying to finish a webapp I have been working on which is 95% done and I'm spending 8 hours a day after work, working on it till 2am. Do your self a favor and don't create more work for yourself.
I agree with most points of Snickers3192's answer. Microservices is not something you should plan up front, your application should exist first, a monolith is fine for the beginning. Martin Fowler has written a good piece about the Microservices yes or no question. Once your app grows and you see the need for either parts of your application being scaled separately or teams needing to be able to develop independently, then you've got a business case for Microservices (and as you'll see from Fowler's article, you must also be ready to support such an architecture). Right now it's overengineering.
That said: If you start with a monolith and plan to evolve to Microservices later, then you need to pay attention to your dependency tree. Different parts of your application will need to access each other, and that's fine, but make sure you don't introduce circular dependencies, otherwise extracting Microservices later will be a nightmare. Ideally, you can identify service interfaces that you will use, and you implement them locally now, but may later implement them by calling a Rest API.
The pattern you suggest (1 service for 1 controller) maps to the Backends for Frontends pattern, which can be a good idea, depending on how complex your web site is. If you have many UI components that are shared between controllers, then you'll probably want to embrace another approach, e.g. Big Pipe. But it does make sense to have one controller that bundles everything a given page needs to know and delegates it to the upstream services, independent of whether all of this is on the same machine or in a Microservice architecture.
Lastly: if you do go with Microservices, pay attention to resilience. Use a circuit breaker like Hystrix or an event-driven architecture, otherwise one dying service can take down the entire architecture.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I work in a small organization (50 employees), and we need to manage business processes. Now we use mail, and it is terrible.
We can buy a big system like an IBM BPM or Pega, or try to use Redmine. I have extensive experience in Redmine, but I can not understand what is the-the IBM BPM or Pega.
That will be more effective?
May you suggest the pros and cons of each solution?
I know that is a project management application, not BPM, but maybe sometimes it can be used as very simple BPM system?
A business process typically involves multiple people (participants / roles) and systems. The BPMS for instance:
manages the task lists of the process particpants
orchestrates the control flow between the different manual and system tasks
manages the process context information throughout the process (data. documents, persistence, versioning - ideally all ootb without coding)
provides rollback, error compensation features
creates an audit trail which is important for compliance / processes that need to be auditable (QA, regulators)
provides dashboards for operational monitoring
and reports for analysis and reporting of KPIs like averages process execution times or volumes grouped by different business data
allows you to model your business process in a graphical way, preferably in a standard notation (BPMN), which is much more user-friendly and a good basis for the communication between business and IT.
supports the evaluation of simple or complex business rules to determine process flow and work assignment with user-friendly means
allows versioning of the process definitions
may help wit generation correspondence from process data and collection of required documents
...
If Redmine's basic workflow and integration features are sufficient to cover your requirements then you could (ab)use it as a WfMS. It will certainly ease the pain you currently have with just unstructured email communication. However, the list above may give you an idea of the actual extent of the usual business requirements. The Redmine approach is rather limited. I would use a more comprehensive tool from the start so you don't have to switch systems again after the expectations and requirements have increased.
If your motivation to use Redmine is only driven by cost then you can as well consider one of the open-source BPMS such as Camunda BPM.
Some of these BPMS are also offered cloud-based, fully managed, available in minutes and with flexible consumption-based pricing and subscription models.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Improve this question
What are advantages and disadvantages of microservices and monolithic architecture?
When to chose microservice architecture or monolithic architecture?
This is a very important question because a few people get lured by all the buzz around microservices, and there are tradeoffs to consider. So, what are the benefits and challenges of microservices (when compared with the monolithic model)?
Benefits
Deployability: more agility to roll out new versions of a service due to shorter build+test+deploy cycles. Also, flexibility to employ service-specific security, replication, persistence, and monitoring configurations.
Reliability: a microservice fault affects that microservice alone and its consumers, whereas in the monolithic model a service fault may bring down the entire monolith.
Availability: rolling out a new version of a microservice requires little downtime, whereas rolling out a new version of a service in the monolith requires a typically slower restart of the entire monolith.
Scalability: each microservice can be scaled independently using pools, clusters, grids. The deployment characteristics make microservices a great match for the elasticity of the cloud.
Modifiability: more flexibility to use new frameworks, libraries, datasources, and other resources. Also, microservices are loosely-coupled, modular components only accessible via their contracts, and hence less prone to turn into a big ball of mud.
Management: the application development effort is divided across teams that are smaller and work more independently.
Design autonomy: the team has freedom to employ different technologies, frameworks, and patterns to design and implement each microservice, and can change and redeploy each microservice independently
Challenges
Deployability: there are far more deployment units, so there are more complex jobs, scripts, transfer areas, and config files to oversee for deployment. (For that reason, continuous delivery and DevOps are highly desirable for microservice projects.)
Performance: services more likely need to communicate over the network, whereas services within the monolith may benefit from local calls. (For that reason, the design should avoid "chatty" microservices.)
Modifiability: changes to the contract are more likely to impact consumers deployed elsewhere, whereas in the monolithic model consumers are more likely to be within the monolith and will be rolled out in lockstep with the service. Also, mechanisms to improve autonomy, such as eventual consistency and asynchronous calls, add complexity to microservices.
Testability: integration tests are harder to setup and run because they may span different microservices on different runtime environments.
Management: the effort to manage operations increases because there are more runtime components, log files, and point-to-point interactions to oversee.
Memory use: several classes and libraries are often replicated in each microservice bundle and the overall memory footprint increases.
Runtime autonomy: in the monolith the overall business logic is collocated. With microservices the logic is spread across microservices. So, all else being equal, it's more likely that a microservice will interact with other microservices over the network--that interaction decreases autonomy. If the interaction between microservices involves changing data, the need for a transactional boundary further compromises autonomy. The good news is that to avoid runtime autonomy issues, we can employ techniques such as eventual consistency, event-driven architecture, CQRS, cache (data replication), and aligning microservices with DDD bounded contexts. These techniques are not inherent to microservices, but have been suggested by virtually every author I've read.
Once we understand these tradeoffs, there's one more thing we need to know to answer the other question: which is better, microservices or monolith? We need to know the non-functional requirements (quality attribute requirements) of the application. Once you understand how important is performance vs scalability, for example, you can weigh the tradeoffs and make an educated design decision.
While I'm relatively new to the microservices world, I'll try to answer your question as complete as possible.
When you use the microservices architecture, you will have increased decoupling and separation of concerns. Since you are litteraly splitting up your application.
This results into that your codebase will be easier to manage (each application is independent of the other applications to stay up and running). Therefore, if you do this right, it will be easier in the future to add new features to your application. Whereas with a monolithic architecture, it might become a very hard thing to do if your application is big (and you can assume at some point in time it will be).
Also deploying the application is easier, since you are building the independent microservices separately and deploying them on separate servers. This means that you can build and deploy services whenever you like without having to rebuild the rest of your application.
Since the different services are small and deployed separately, it's obvious easier to scale them, with the advantage that you can scale specific services of your application (with a monolithic you scale the complete "thing", even if it's just a specific part within the application that is getting an excessive load).
However, for applications that are not intended to become too big to manage in the future. It is better to keep it at the monolithic architecture. Since the microservices architecture has some serious difficulties involved. I stated that it is easier to deploy microservices, but this is only true in comparison with big monoliths. Using microservices you have the added complexity of distributing the services to different servers at different locations and you need to find a way to manage all of that. Building microservices will help you in the long-run if your application gets big, but for smaller applications, it is just easier to stay monolithic.
#Luxo is spot on. I'd just like to offer a slight variation and bring about the organizational perspective of it. Not only does microservices allow the applications to be decoupled but it may also help on an organizational level. The organization for example would be able to divide into multiple teams where each may develop on a set of microservices that the team may provide.
For example, in larger shops like Amazon, you might have a personalization team, ecommerce team, infrastructure services team, etc. If you'd like to get into microservices, Amazon is a very good example of it. Jeff Bezos made it a mandate for teams to communicate to another team's services if they needed access to a shared functionality. See here for a brief description.
In addition, engineers from Etsy and Netflix also had a small debate back in the day of microservices vs monolith on Twitter. The debate is a little less technical but can offer a few insights as well.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What would be a good way for Microservices .NET to communicate with each other? Would a peer to peer communication be better (for performance) using NETMQ (port of ZeroMQ) or would it be better via a Bus (NServiceBus or RhinoBus)?
Also would you break up your data access layer into microservices too?
-Indu
A Service Bus-based design allows your application to leverage the decoupling middleware design pattern. You have explicit control in terms of how each Microservice communicates. You can also throttle traffic. However, it really depends on your requirements. Please refer to this tutorial on building and testing Microservices in .NET (C#).
We are starting down this same path. Like all new hot new methodologies, you must be careful that you are actually achieving the benefits of using a Microservices approach.
We have evaluated Azure Service Fabric as one possibility. As a place to host your applications it seems quite promising. There is also an impressive API if you want your applications to tightly integrate with the environment. This integration could likely answer your questions. The caveat is that the API is still in flux (it's improving) and documentation is scarce. It also feels a bit like "vendor lock".
To keep things simple, we have started out by letting our microservices be simple stateless applications that communicate via REST. The endpoints are well-documented and contain a contract version number as part of the URI. We intend to introduce more sophisticated ways of interaction later as the need arises (ie, performance).
To answer your question about "data access layer", my opinion would be that each microservice should persist state in whatever way is best for that service to do so. The actual storage is private to the microservices and other services may only use that data through its public API.
We've recently open sourced our .NET microservices framework, that covers a couple of the needed patterns for microservices. I recommend at least taking a look to understand what is needed when you go into this kind of architecture.
https://github.com/gigya/microdot