Chapter 12. Organizational Effects of a Microservices-Based Architecture

It is an essential feature of the microservice-based approach that one team is responsible for each microservice. Therefore, when working with microservices, it is necessary to look not only at the architecture but also at the organization of teams and the responsibilities for the individual microservices. This chapter discusses the organizational effects of microservices.

In section 12.1 organizational advantages of microservices are described. Section 12.2 shows that collective code ownership presents an alternative to devising teams according to Conway’s Law, which states that an organization can only generate architectures that mirror its communication structures. The independence of the teams is an important consequence of microservices. Section 12.3 defines micro and macro architecture and shows how these approaches offer a high degree of autonomy to the teams and let them make independent decisions. Closely connected is the question about the role of the technical leadership (section 12.4). DevOps is an organizational approach that combines development (Dev) and operations (Ops) (section 12.5). DevOps has synergies with microservices. Since microservices focus on independent development from a domain perspective, they also influence product owners and business stakeholders—for example, the departments of the business that uses the software. Section 12.7 discusses how these groups can handle micro-services. Reusable code can only be achieved in microservice systems via organizational measures as illustrated in section 12.8. Finally, section 12.9 follows up on the question whether an introduction of microservices is possible without changing the organization.

12.1 Organizational Benefits of Microservices

Microservices are an approach for tackling large projects with small teams. As the teams are independent of each other, less coordination is necessary between them. In particular the communication overhead renders the work of large teams inefficient. Microservices are an approach on the architectural level for solving this problem. The architecture helps to reduce the need for communication and to let many small teams work in the project instead of one large one. Each domain-based team can have the ideal size: the Scrum guide1 recommends three to nine members.

1. http://www.scrumguides.org/scrum-guide.html#team

Besides, modern enterprises stress self-organization and teams that are themselves active directly at the market. Microservices support this approach because each service is in the responsibility of an individual team consistent with Conway’s Law (Section 3.2). Therefore, microservices fit well to self-organization. Each team can implement new features independently of other teams and can evaluate the success on the market by themselves.

On the other hand, there is a conflict between independence and standardization: when the teams are supposed to work on their own, they have to be independent. Standardization restricts independence. This concerns, for instance, the decision about which technologies should be used. If the project is standardized in regard to a certain technology stack, the teams cannot decide independently anymore which technology they want to use. In addition, independence conflicts with the wish to avoid redundancy: if the system is supposed to be free of redundancy, there has to be coordination between the teams in order to identify the redundancies and to eliminate them. This, in turn, limits the independence of the teams.

Technical Independence

An important aspect is the technological decoupling. Microservices can use different technologies and can have entirely different structures internally. This means that developers have less need to coordinate. Only fundamental decisions have to be made together. All other technical decisions can be made by the teams.

Separate Deployment

Each microservice can be brought into production independently of the other microservices. There is also no need to coordinate release dates or test phases across teams. Each team can choose its own speed and its own dates. A delayed release date of one team does not influence the other teams.

Separate Requirement Streams

The teams should each implement independent stories and requirements. This enables each team to pursue its own business objectives.

Three Levels of Independence

Microservices enable independence on three levels:

• Decoupling via independent releases: each team takes care of one or multiple microservices. The team can bring them into production independently of the other teams and the other microservices.

• Technological decoupling: the technical decisions made by a certain team concern, first of all, their microservices and none of the other microservices.

• Domain-based decoupling: the distribution of the domain in separate components enables each team to implement their own requirements.

For deployment monoliths, in contrast, the technical coordination and deployment concerns the entire monolith (see Figure 12.1). This necessitates such a close coordination between the developers that in the end all developers working on the monolith have to act like one team.

Image

Figure 12.1 Deployment Monolith

A prerequisite for the independence of the microservice teams is that the architecture really offers the necessary independence of the microservices. This requires, first of all, good domain architecture. This architecture also enables independent requirement streams for each team.

There are the following teams in the example from Figure 12.2:

• The team “user registration” takes care of how users can register in the e-commerce shop. A possible business objective is to achieve a high number of registrations. New features aim at optimizing this number. The components of the team are the processes that are necessary for the registration and the UI elements. The team can change and optimize them at will.

• The team “order process” addresses how the shopping cart turns into an order. Here, a possible objective is that as many shopping carts as possible turn into orders. The entire process is implemented by this team.

• The team “product search” improves the search for products. The success of this team depends on how many search processes lead to items being put into a shopping cart.

Image

Figure 12.2 Separation into Microservices

Of course, there can be additional teams with other goals. Overall this approach distributes the task of developing an e-commerce shop onto multiple teams, which all have their own objectives. The teams can largely independently pursue their objectives because the architecture of the system is distributed into microservices that each team can develop independently—without much need for coordination.

In addition, small projects have many more advantages:

• Estimations are more accurate since estimates concerning smaller efforts are easier to make.

• Small projects are easier to plan.

• The risk decreases because of the more accurate estimates and because of the better forecast reliability.

• If there still is a problem, its effects are smaller because the project is smaller.

In addition, microservices offer much more flexibility. This makes decisions faster and easier because the risk is smaller, and changes can be implemented more rapidly. This ideally supports agile software development that relies on such flexibility.

12.2 An Alternative Approach to Conway’s Law

Section 3.2 introduced Conway’s Law. According to this law, an organization can only generate architectures that mirror its communication structures. In micro-service-based architectures the teams are built according to the microservices. Each team develops one or multiple microservices. Thus each microservice is only developed by exactly one team. This ensures that the domain architecture is not only implemented by the distribution into microservices but also supported by the organizational distribution. This renders violations of the architecture practically impossible. Moreover, the teams can independently develop features when the features are limited to one microservice. For this to work the distribution of domains between the microservices has to be of very high quality.

The Challenges Associated with Conway’s Law

However, this approach also has disadvantages:

• The teams have to remain stable in the long run. Especially when the microservices use different technologies, the ramp-up time for an individual micro-service is very long. Developers cannot easily switch between teams. Especially in teams containing external consultants, long-term stability is often hard to ensure. Already the usual fluctuation of personnel can turn into a challenge when working with microservices. In the worst case, if there is nobody left to maintain a specific microservice, it is still possible to rewrite the respective microservice. Microservices are easy to replace due to their limited size. Of course, this still entails some expenditure.

• Only the team understands the component. When team members quit, knowledge about one or multiple microservices can get lost. In that case the micro-service cannot be modified anymore. Such islands of knowledge need to be avoided. In such a case it will not be an option to replace the microservice since an exact knowledge of the domain is necessary for this.

• Changes are difficult whenever they require the coordinated work of multiple teams. When a team can implement all changes for a feature in its own microservices, architecture and scaling of development will work very well. However, when the feature concerns another microservice also and therefore another team, the other team needs to implement the changes to the respective microservice. This requires not only communication, but the necessary changes also have to be prioritized versus the other requirements of the team. If the teams work in sprints, a team can deliver the required changes without prematurely terminating the current sprint earliest in the following sprint—this causes a marked delay. In case of a sprint length of two weeks the delay can amount to two weeks—if the team prioritizes the change high enough so that it is taken care of in the next sprint. Otherwise the ensuing delay can be even longer.

Collective Code Ownership

When it is always only the responsible team that can introduce changes to a micro-service, a number of challenges result as described. Therefore, it is worthwhile to consider alternatives. Agile processes have led to the concept of “collective code ownership.” Here, each developer has not only the right, but even the duty to alter any code—for example when he/she considers the code quality as insufficient in a certain place. Therefore, all developers take care of code quality. Besides, technical decisions are better communicated because more developers understand them due to their reading and changing code. This leads to the critical questioning of decisions so that the overall quality of the system increases.

Collective code ownership can relate to a team and its microservices. Since the teams are relatively free in their organization, such an approach is possible without much coordination.

Advantages of Collective Code Ownership

However, in principle teams can also modify microservices that belong to other teams. This approach is used by some microservice projects to deal with the discussed challenges because it entails a number of advantages:

• Changes to a microservice of another team can be faster and more easily implemented. When a modification is necessary, the change does not to be introduced by another team. Instead the team requiring the change can implement it by itself. It is not necessary anymore to prioritize the change in regard to other changes to the component.

• Teams can be put together more flexibly. The developers are familiar with a larger part of the code—at least superficially due to changes that they have introduced in the code. This makes it easier to replace team members or even an entire team—or to enlarge a team. The developers do not have to ramp up from the very basics. A stable team is still the best option—however, often this cannot be achieved.

• The distribution in microservices is easy to change. Because of the broader knowledge of the developers it is easier to move responsibility for a microservice to a different team. This can be sensible when microservices have a lot of dependencies on each other but are in the responsibility of different teams that then have to closely and laboriously coordinate. If the responsibility for the microservices is changed so that the same team is responsible for both of the closely coupled microservices, coordination is easier than in the case where two teams were working on these microservices. Within one team the team members often sit in the same office. Therefore, they can easily and directly communicate with each other.

Disadvantages of Collective Code Ownership

However, there also disadvantages associated with this approach:

• Collective code ownerships are in contrast to technology freedom: when each team uses other technologies, it is difficult for developers outside of a team to change the respective microservices. They might not even know the technology used in the microservice.

• The teams can lose their focus. The developers acquire a larger overview of the full system. However, it might be better when the developers concentrate on their own microservices instead.

• The architecture is not as solid anymore. By knowing the code of other components developers can exploit the internals and, therefore, rapidly create dependencies that had not been intended in the architecture. Finally, the distribution of the teams according to Conway’s Law is supposed to support the architecture by turning interfaces between domain components into interfaces between teams. However, the interfaces between the teams lose importance when everybody can change the code of every other team.

Pull Requests for Coordination

Communication between teams is still necessary; in the end, the team responsible for the respective microservice has the most knowledge about the microservice. So changes should be coordinated with the respective team. This can be safeguarded technically: the changes of the external teams can initially be introduced separately from other changes and subsequently be sent to the responsible team via a pull request. Pull requests bundle changes to the source code. In the open source community they are an especially popular approach to enable external contributions without giving up control of the project. The responsible team can accept the pull request or demand fixes. This means that there is a review for each change by the responsible team. This enables the responsible team to ensure that the architecture and design of the microservice remain sound.

Since there is still the need for communication between teams, Conway’s Law is not violated by this approach. It is just a different way of playing the game. In case of a bad split among teams in a microservice-based architecture all options are associated with tremendous disadvantages. To correct the distribution is difficult as larger changes across microservices are laborious, as discussed in section 7.4. Due to the unsuitable distribution, the teams are forced to communicate a lot with each other. Therefore, productivity is lost. Also, there is no option to leave the distribution as it is. Collective code ownership can be used to limit the need for communication. The teams directly implement requirements in the code of other teams. This causes less need for communication and better productivity. To do so the technology freedom should be restricted. The changes to the microservices still have to be coordinated—at least reviews are definitely necessary. However, if the architecture had been set up appropriately from the start, this measure would not be necessary as a workaround at all.


Try and Experiment

• Did you already encounter collective code ownership? Which experiences did you have with it?

• Which restrictions are there in your current project when a developer wants to change some code that has been written by another developer in the same team or by a developer from another team? Are changes to the code of other teams not meant to occur? In that case, how is it still possible to implement the necessary changes? Which problems are associated with this course of action?


12.3 Micro and Macro Architecture

Microservices enable you to largely avoid overarching architecture decisions. Each team can choose the optimal type of architecture for its microservices.

The basis for this is the microservices architecture. It provides a large degree of technical freedom. While normally due to technical reasons, uniform technologies are mandatory, microservices do not have these restrictions. However, there can be other reasons for uniformity. The question is which decision is made by whom. There are two layers of decision making:

• Macro architecture comprises the decisions that concern the overall system. These are at least the decisions presented in Chapter 7, “Architecture of Microservice-Based Systems,” regarding the domain architecture and basic technologies, which have to be used by all microservices, as well as communication protocols (Chapter 8, “Integration and Communication”). The properties and technologies of individual microservices can also be preset (Chapter 9, “Architecture of Individual Microservices”). However, this does not have to be the case. Decisions about the internals of the individual microservices do not have to be made in the macro architecture.

• The micro architecture deals with decisions each team can make by itself. These should address topics that concern only the microservices developed by the respective team. Among these topics can be all aspects presented in Chapter 9 as long as they have not already been defined as part of the macro architecture.

The macro architecture cannot be defined once and for all but has to undergo continuous development. New features can require a different domain architecture or new technologies. Optimizing the macro architecture is a permanent process.

Decision = Responsibility

The question is, who defines macro and micro architecture and takes care of their optimization? It is important to keep in mind that each decision is linked to responsibility. Whoever makes a decision is responsible for its consequences—good or bad. In turn the responsibility for a microservice entails the necessity to make the required decisions for its architecture. When the macro architecture defines a certain technology stack, the responsibility for this stack rests with the persons responsible for the macro architecture—not with the teams that use them in the microservices and might later have problems with this technology stack. Therefore, a strong restriction of the technology freedom of the individual microservices by the macro architecture is often not helpful. It only shifts decisions and responsibility to a level that does not have much to do with the individual microservices. This can lead to an ivory-tower architecture that is not based on the real requirements. In the best case it is ignored. In the worst case it causes serious problems in the application. Microservices enable you to largely do without macro architecture decisions in order to avoid such an ivory-tower architecture.

Who Creates the Macro Architecture?

For defining the macro architecture, decisions have to be made that affect all micro-services. Such decisions cannot be made by a single team since the teams only carry responsibility for their respective microservices. Macro architecture decisions go beyond individual microservices.

The macro architecture can be defined by a team that is composed from members of each individual team. This approach seems to be obvious at first glance: It enables all teams to voice their perspectives. Nobody dictates certain approaches. The teams are not left out of the decision process. There are many microservice projects that very successfully employ this approach.

However, this approach has also disadvantages:

• For decisions at the macro architecture level, an overview of the overall system and an interest to develop the system in its entirety are necessary. Members of the individual teams often have a strong focus on their own microservices. That is, of course, very sensible since the development of these microservices is their primary task. However, this can make it hard for them to make overarching decisions since those require a different perspective.

• The group can be too large. Effective teams normally have five to ten members at maximum. If there are many teams and each is supposed to participate with at least one member, the macro architecture team will get too large and thus cannot work effectively anymore. Large teams are hardly able to define and maintain the macro architecture.

The alternative is to have a single architect or an architecture team that is exclusively responsible for shaping the macro architecture. For larger projects this task is so demanding that an entire architecture team certainly is needed to work on it. This architecture team takes the perspective of the overall project. However, there is a danger that the architecture team distances itself too much from the real work of the other teams and consequently makes ivory-tower decisions or solves problems the teams do not actually have. Therefore, the architecture team should mainly moderate the process of decision making and make sure that the viewpoints of the different teams are all considered. It should not set a certain direction all by itself. In the end the different microservices teams will have to live with the consequences of the architecture team’s decisions.

Extent of the Macro Architecture

There is no one and only way to divide the architecture into micro and macro architecture. The company culture, the degree of self-organization, and other organizational criteria play a prominent role. A highly hierarchical organization will give the teams less freedom. When as many decisions as possible are made on the level of the micro architecture, the teams will gain more responsibility. This often has positive effects because the teams really feel responsible and will act accordingly.

The NUMMI car factory2 in the United States, for instance, was a very unproductive factory that was known for drug abuse and sabotage. By the company focusing more on teamwork and trust, the same workers could be turned into a very productive workforce. When teams are able to make more decisions on their own and have more freedom of choice, the work climate as well as productivity will profoundly benefit.

2. http://en.wikipedia.org/wiki/NUMMI#Background

Besides, by delegating decisions to teams, less time is spent on coordination so that the teams can work more productively. To avoid the need for communication by delegating more decisions to the teams and therefore to micro architecture is an essential point for architecture scaling.

However, when the teams are very restricted in their choices, one of the main advantages of microservices is not realized. Microservices increase the technical complexity of the system. This only makes sense if the advantages of microservices are really exploited. Consequently, when the decision for microservices has been made, there should also be a decision for having as much micro architecture and as little macro architecture as possible.

The decision for more or less macro architecture can be made for each area differently.

Technology: Macro/Micro Architecture

For the technologies the following decisions can be made concerning macro versus micro architecture:

• Uniform security (section 7.14), service discovery (section 7.11), and communication protocols (Chapter 8) are necessary to enable microservices to communicate with each other. Therefore, decisions in these areas clearly belong to macro architecture. Among these are also the decisions for the use and details of downwards compatible interfaces that are required for the independent deployment of microservices.

• Configuration and coordination (Section 7.10) do not necessarily have to be determined globally for the complete project. When each microservice is operated by its respective team, the team can also handle the configuration and use its own tool of choice for it. However, a uniform tool for all microservices has clear advantages. Besides, there is hardly any sensible reason why each team should use a different mechanism.

• The use of resilience (section 9.5) or load balancing (section 7.12) can be defined in the macro architecture. The macro architecture can either define a certain standard technology or just enforce that these points have to be addressed during the implementation of the microservices. This can, for instance, be ensured by tests (section 10.8). The tests can check whether a microservice is still available after a dependent microservice failed. In addition, they can check whether the load is distributed to multiple microservices. The decision for the use of resilience or load balancing can theoretically be left to the teams. When they are responsible for the availability and the performance of their service, they have to have the freedom to use their choice of technologies for it. When their microservices are sufficiently available without resilience and load balancing, their strategy is acceptable. However, in the real world such scenarios are hard to imagine.

• In regard to platform and programming language the decision can be made at the level of macro or micro architecture. The decision might not only influence the teams but also operations, since operations needs to understand the technologies and to be able to deal with failures. It is not necessarily required to prescribe a programming language. Alternatively, the technology can be restricted, for example, to the JVM (Java Virtual Machine) that supports a number of programming languages. In regard to the platform a potential compromise is that a certain database is provided by operations, but the teams can also use and operate different ones. Whether the macro architecture defines platform and programming language depends also on whether developers need to be able to change between teams. A shared platform facilitates transferring the responsibility for a microservice from one team to another team.

Figure 12.3 shows which decisions are part of the macro architecture—they are on the right side. The micro architecture parts are on the left side. The areas in the middle can be either part of the macro or micro architecture. Each project can handle them differently.

Image

Figure 12.3 Technology: Macro and Micro Architecture

Operations

In the area of operations (see Figure 12.4) there is control (section 11.6), monitoring (section 11.3), logging (section 11.2), and deployment (section 11.4). To reduce the complexity of the environment and to enable a uniform operations solution, these areas have to be defined by macro architecture. The same holds true for platform and programming language. However, standardizing is not obligatory; when the entire operations of the microservices rests with the teams, theoretically each team can use a different technology for each of the mentioned areas. But while this scenario does not generate many advantages, it creates a huge technological complexity. However, it is, for example, possible that the teams use their own special solution for certain tasks. When, for instance, the revenue is supposed to be transferred in a different way into the monitoring for the business stakeholders, this is certainly doable.

Image

Figure 12.4 Operations: Macro and Micro Architecture

Domain Architecture

In the context of domain architecture (see Figure 12.5) the distribution of domains to teams is part of the macro architecture (section 7.1). It not only influences the architecture but also decides which teams are responsible for which domains. Therefore, this task cannot be moved into the micro architecture. However, the domain architecture of the individual microservices has to be left to the teams (sections 9.19.4). To dictate the domain architecture of the individual microservices to the teams would be equivalent to treating microservices at the organizational level like monoliths because the entire architecture is centrally coordinated. In that case one could as well develop a deployment monolith, which is technically easier. Such a decision would not make sense.

Image

Figure 12.5 Architecture: Macro and Micro Architecture

Tests

In the area of testing (see Figure 12.6) integration tests (section 10.4) belong to the macro architecture. In practice whether there should be an integration test for a certain domain and who should implement it has to be decided. Integration tests only make sense when they concern functionalities across teams. The respective teams can test all other functionalities on their own. Therefore, integration tests have to be globally coordinated across teams. Technical tests (section 10.8) can be dictated to the teams by the macro architecture. They are a good option to enforce and control global standards and technical areas of macro architecture. Consumer-driven contract tests (CDC) (section 10.7) and stubs (section 10.6) can be coordinated between the teams themselves. A shared technological foundation as part of macro architecture can profoundly facilitate development. Uniform technologies are especially sensible in this area since teams have to use the CDCs and stubs of other teams. When only one technology is used, work is markedly easier. However, it is not obligatory that technologies are rigidly prescribed by the macro architecture.

Image

Figure 12.6 Test: Macro and Micro Architecture

How to test the respective microservices should be up to the individual teams as they have the responsibility for the quality of the microservices.

In many areas decisions can be made either at the level of macro or at the level of micro architecture. It is a central objective of microservice-based architectures to give the individual teams as much independence as possible. Therefore, as many decisions as possible should be made on the level of micro architecture and therefore by the individual teams. However, in regard to operations the question arises whether the teams really profit from the freedom to use their own distinct tools. It seems more likely that the technology zoo just gets bigger without real advantages. In this area there is a connection to DevOps (section 12.5). Depending on the degree of cooperation between developers and operations there can be different degrees of freedom. In case of a clear division between development and operations, operations will define many standards in macro architecture. In the end operations will have to take care of the microservices in production. When all microservices employ a uniform technology, this task is easier.

When defining programming language and platform, one should likewise weigh the advantages of specialized technology stacks versus the disadvantages of having heterogeneous technologies in the overall system. Depending on the circumstances the decision to prescribe a technology stack might be as sensible as the decision to leave the technology choice to the individual teams. A uniform technology stack can facilitate operations and make it easier for developers to change between microservices and teams. Specialized technology stacks make it easier to handle special challenges and motivate employees who thus have the possibility to use cutting-edge technologies.

Whether a microservice really conforms to the macro architecture can be evaluated by a test (see section 10.8). This test can be an artifact that is likewise part of the macro architecture. The group responsible for the macro architecture can use this artifact to unambiguously define the macro architecture. This enables you to check whether all microservices are in line with macro architecture.

12.4 Technical Leadership

The division in micro and macro architecture completely changes the technical leadership teams and is an essential advantage of microservices. The macro architecture defines technical duties and freedom. The freedom of choice entails also the responsibility for the respective decisions.

For example, a database can be prescribed. In that case the team can delegate the responsibility for the database to the technical leadership team. If the database decision were part of the micro architecture, the database would be run by the team since it made the decision for the technology. No other team would need to deal with potential consequences of this decision (see section 7.9). Whoever makes the decision also has the responsibility. The technical leadership team certainly can make such decisions, but by doing so it takes away responsibility from the microservices teams and therefore independence.

A larger degree of freedom entails more responsibility. The teams have to be able to deal with this and also have to want this freedom. Unfortunately, this is not always the case. This can either argue for more macro architecture or for organizational improvements that in the end lead to more self-organization and thus less macro architecture. It is one of the objectives of the technical leadership team to enable less macro architecture and to lead the way to more self-organization.

Developer Anarchy

The approach Developer3 Anarchy4 is even more radical in regards to the freedom of the teams. It confers the entire responsibility to the developers. They cannot only freely choose technologies but even rewrite code if they deem it necessary. Besides, they communicate directly with the stakeholders. This approach is employed in very fast growing enterprises and works very well there. Behind this idea is Fred George, who has collected more than 40 years of experience while working in many different companies. In a model like this, macro architecture and deployment monoliths are abolished so that the developers can do what they think is best. This approach is very radical and shows how far the idea can be extended.

3. http://www.infoq.com/news/2012/02/programmer-anarchy

4. https://www.youtube.com/watch?v=uk-CF7klLdA


Try and Experiment

• In Figures 12.312.5 areas are marked that can belong to either micro or macro architecture. These are the elements that are depicted in the center of the respective figures. Look through these elements and decide whether you would place them in micro or macro architecture. Most important is your reasoning for the one or the other alternative. Take into consideration that making decisions at the level of the micro architecture rather than the level of the macro architecture corresponds to the microservice idea of independent teams.


12.5 DevOps

DevOps denotes the concept that development (Dev) and operations (Ops) merge into one team (DevOps). This is an organizational change: each team has developers and operations experts. They work together in order to develop and operate a micro-service. This requires a different mindset, since operations-associated topics are often unfamiliar to developers while people working in operations often do not work in projects but usually run systems independently of projects. Ultimately, the technical skills become very similar: operations works more on automation and associated suitable tests—and this is, in the end, software development. At the same time monitoring, log analysis, or deployment also turn more and more into topics for developers.

DevOps and Microservices

DevOps and microservices ideally complement each other:

• The teams cannot only take care of the development but also of the operations of the microservices. This requires that the teams have knowledge in the areas of operations and development.

• Orienting the teams in line with features and microservices represents a sensible organizational alternative to the division into operations and development.

• Communication between operations and development gets easier when members of both areas work together in one team. Communication within a team is easier than between teams. This is in line with the aim of microservices to reduce the need for coordination and communication.

DevOps and microservices fit very well together. In fact, the aim that teams deploy microservices up to production and keep taking care of them in production can only be achieved with DevOps teams. This is the only way to ensure that teams have the necessary knowledge about both areas.

Do Microservices Necessitate DevOps?

DevOps is such a profound change in organization that many enterprises are still reluctant to take this step. Therefore the question arises whether microservices can also be implemented without introducing DevOps. In fact, this is possible:

• Via the macro versus micro architecture division, operations can define standards. Then technical elements like logging, monitoring, or deployment belong to the macro architecture. When these standards are conformed to, operations can take over the software and make it part of the standard operations processes.

• In addition, platform and programming language can be defined as much as needed for operations. When staff from operations only feels comfortable running Java applications on a Tomcat, this can be prescribed as the platform in the macro architecture. The same holds true for infrastructure elements like databases or messaging systems.

• Moreover, there can be organizational requirements. For example, operations can ask that members of the microservices teams are available at certain times so that problems arising in production can be referred to the teams. To put it concretely, whoever wants to deploy on his/her own has to provide a phone number and will be called at night in case of problems. If the call is not answered, the manager for that developer can be called next. This increases the likelihood that developers actually answer such calls.

In such a context the teams cannot be responsible anymore for bringing all microservices up to production. Access and responsibility rest with operations. There has to be a point in the continuous delivery pipeline where the microservices are passed on to operations and then are rolled out in production. At this point the microservice passes into the responsibility of operations that has to coordinate with the respective team about their microservices. A typical point for the transfer to operations is immediately after the test phases, prior to possible explorative tests. Operations is at least responsible for the last phase, that is, the rollout in production. Operations can turn into a bottleneck if a high number of modified microservices have to be brought into production.

Overall, DevOps and microservices have synergies; however, it is not necessarily required to also introduce DevOps when deciding for microservices.

12.6 When Microservices Meet Classical IT Organizations (Alexander Heusingfeld)

by Alexander Heusingfeld, innoQ

The “microservices” topic has meanwhile reached numerous IT departments and is discussed there. Interestingly, initiatives for introducing microservices are often started by middle management. However, frequently too little thought is spent on the effect a microservice architecture has on the (IT) organization of enterprises. Because of this I would like to tell of a number of “surprises” that I experienced during the introduction of such an architecture approach.

Pets versus Cattle

“Pets vs. cattle”5 is a slogan that reached a certain fame at the outset of the DevOps movement. Its basic message is that in times of Cloud and virtualization, servers should not be treated like pets but rather like a herd of cattle. If a pet gets sick, the owner will likely nurse it back to health. Sick cattle, on the other hand, are killed immediately in order not to endanger the health of the entire herd.

5. http://www.slideshare.net/randybias/architectures-for-open-and-scalable-clouds

Thus the point is to avoid the personification of servers—for example, by giving them names (like Leviathan, Pollux, Berlin, or Lorsch). If you assign such “pet” names to servers, there will be a tendency to care for them like pets and thus provide individual updates, scripts, adjustments, or other specific modifications. However, it is well known that this has negative consequences for the reproducibility of installations and server state. Especially considering auto-scaling and failover features as they are required for microservice-based architectures, this is a deal breaker.

One of my projects addressed this problem in a very interesting manner. The server and virtual machines still had names. However, the administration of these systems was completely automated via Puppet. Puppet downloaded the respective scripts from an SVN repository. In this repository individual scripts for each server were stored. This scenario could be called “Puppets for automated pet care.” The advantage is that crashed servers can quickly be replaced by exact copies.

However, requirements for scalability are not taken into consideration at all, since there can always only be one instance of a “pet server” named Leviathan. An alternative is to switch to parameterized scripts and to use templates like “production VM for app XYZ.” At the same time this also enables more flexible deployment scenarios like Blue/Deployments. In that case it is not relevant anymore whether the VM app-xyz-prod08.zone1.company.com or app-xyz-prod045.zone1.company.com gets the job done. The only relevant point is that eight instances of this service are constantly available, and at times of high load additional instances can be started. How these instances are named does not matter.

Us versus Them

“Monitoring is our concern!”

“You shouldn’t care about that!”

“That is none of your business; it’s our area!”

Unfortunately, I frequently hear sentences like these in so-called cross-functional teams. These are teams composed of architects, developers, testers, and administrators. Especially if the members previously worked in other, purely functional teams within the same company, old trench wars and prejudices are carried along into the new team—often subconsciously. Therefore, it is important to be aware of the social aspects right from the start and to counter these proactively. For example, in my experience letting newly set-up teams work in the same office for the first two to four weeks has very positive effects. This enables the new teammates to get to know each other’s human side and to directly experience the colleague’s body language, character, and humor. This will markedly facilitate communication during the later course of the project, and misunderstandings can be avoided.

In addition, team-building measures during the first weeks that require that the team members rely on each other can help to break the ice, to get an idea of the strengths and weaknesses of the individual members, and to build up and strengthen trust within the team. If these points are neglected, there will be noticeable adverse consequences throughout the run time of the project. People who do not like each other or do not trust each other will not rely on each other, even if only subconsciously. And this means that they will not be able to work 100 percent as a team.

Development versus Test versus Operations: Change of Perspective

In many companies there are initiatives for a change of perspective. For example, employees from sales may work in the purchasing department for a day to get to know the people and the processes there. The expectation is that the employees will develop a better understanding for their colleagues and to let that become part of their daily work so that cross-department processes harmonize better. The motto is: “On ‘the other side’ you get to know a new perspective!”

Such a change of perspective can also be advantageous in IT. A developer could, for instance, get a new perspective with regard to the use cases or test cases. This might motivate them to enforce a modularization in the development, which is easier to test. Or they might consider early in development which criteria will be needed later on to better monitor the software in production or to more easily find errors. A deeper insight into the internal processes of the application can help an administrator to develop a better understanding for implementing a more specific and more efficient monitoring. Each perspective that deviates from one’s own perspective can raise questions that previously were not considered in this section of the application life cycle. These questions will help the team to evolve as a whole and deliver better software.

For Operations There Is Never an “Entirely Green Field”

Certainly, microservices are a topical subject and bring along new technologies, concepts, and organizational changes. However, one should always consider that enterprises introducing microservices hardly ever start from scratch! There are always some kinds of legacy systems or entire IT environments that already exist and might better not be replaced in a Big Bang approach. Usually these legacy systems have to be integrated into the brave new world of microservices; at least they will have to coexist.

For this reason, it is important to take these systems into consideration when planning a microservices-based architecture, especially in regards to IT costs. Can the existing hardware infrastructure really be restructured for the microservices or is there a legacy system that relies exactly on this infrastructure? These are often questions that get caught on the infrastructure or operations team—if there is such an organizational unit in the company. Otherwise it might happen that these questions first arise when a deployment to the system test or production environment is supposed to be done. To recognize these questions early on, I recommend dealing with the deployment pipeline as early as possible in the reorganization project. The deployment pipeline should already be in place before the first business functionality is implemented by the teams. A simple “Hello World” program will often be sufficient, which then is brought towards production by the combined forces of the entire team. While doing so, the team will almost always encounter open questions, which in the worst case will have effects on the design of the systems. However, as not much is implemented at this stage early on during the project, such changes are still comparably cost-efficient to implement.

Conclusion

Up to now the organizational changes with regard to Conway’s Law that accompany the introduction of microservices are often underestimated. Old habits, prejudices, and maybe even trench wars are often deep-rooted, especially if the new teammates were previously assigned to different departments. However, “one team” has to be more than just a buzzword. If the team manages to bury their prejudices and put their different experiences to good use, it can advance together. Everyone has to understand that all of them now share the task and responsibility to bring a stable software into production for the customer. Everybody can profit from the experiences of the others when everybody acts on the premise: “Everybody voices their concerns, and we will solve it jointly.”

12.7 Interface to the Customer

To ensure that the development can really be scaled to multiple teams and micro-services, each team needs to have its own product owner. In line with Scrum approaches, he/she is responsible for the further development of the microservice. For this purpose, he/she defines stories that are implemented in the microservice. The product owner is the source of all requirements and prioritizes them. This is especially easy when a microservice only comprises features that are within the responsibility of a single department at the business level (see Figure 12.7). Usually this objective is achieved by adjusting microservices and teams to the organization of departments. Each department gets its product owner and therefore its team and its microservices.

Image

Figure 12.7 Department, Product Owner, and Microservices

When the microservices have a good domain architecture, they can be independently developed. Ultimately, each domain should be implemented in one or many microservices, and the domain should only be of interest to one department. The architecture has to take the organization of the departments into consideration when distributing the domains into microservices. This ensures that each department has its own microservices that are not shared with other domains or departments.

Unfortunately, the architecture often is not perfect. Besides, microservices have interfaces—an indication that functionalities might span multiple micro-services. When multiple functionalities concern one microservice and therefore multiple departments want to influence the development of a microservice, the product owner has to ensure a prioritization that is coordinated with the different departments. This can be a challenge because departments can have different priorities. In that case the product owner has to coordinate between the concerned departments.

Let us assume that there is a department that takes care of sales campaigns in an e-commerce shop. It starts a campaign where orders containing a certain item get a rebate on the delivery cost. The required modification concerns the order team: tt has to find out whether an order contains such an item. This information has to be transmitted to the delivery microservice, which has to calculate the costs for the delivery. Accordingly, the product owners of these two teams have to prioritize these changes in regards to the changes desired by the departments in charge of delivery and orders. Unfortunately, many of these sales campaigns combine different functionalities so that such a prioritization is often required. The departments for orders and deliveries have their own microservices, while the department in charge of sales campaigns does not have its own microservices. Instead it has to introduce its features into the other microservices.

Architecture Leads to Departments

The microservice architecture can thus be a direct result of the departmental organization of the company. However, there are also cases where a new department is created around an IT system, which then takes care of this system from the business side. In such a case one can argue that the microservices architecture directly influences the organization. For instance, there might be a new Internet market place that is implemented by an IT system. If it is successful, a department can be created that takes over the further development of this marketplace. This department will continue to develop the IT system from a domain and from a business perspective. In this case the marketplace was developed first, and subsequently the department has been created. Therefore, the system architecture has defined the departmental structure of the organization.

12.8 Reusable Code

At first sight the reuse of code is a technical problem. Section 7.3 already described the challenges that arise when two microservices use the same library. When the microservices use the library in such a way that a new release of the library necessitates a new deployment of the microservices, the result is a deployment dependency. This has to be avoided to enable an independent deployment of the microservices. There is additional expenditure because the teams responsible for the microservices have to coordinate their changes to the library. New features for the different microservices have to be prioritized and developed. These also represent dependencies between the teams, which should be avoided.

Client Libraries

Client libraries that encapsulate calls from a microservice can be acceptable. When the interfaces of the microservices are downwards compatible, the client library does not have to be replaced in case of a new version of the microservice. In such a scenario client libraries do not cause problems because a new deployment of the called microservices does not lead to an update of the client library or a new deployment of the calling microservice.

However, when the client library also contains domain objects, problems can occur. When a microservice wants to change the domain model, the team has to coordinate this change with the other users of the client library and therefore cannot develop independently anymore. The boundaries between a simplified use of the interface, which can be sensible, and a shared implementation of logic or other deployment dependencies, which can be problematic, is not clear cut. One option is to entirely forbid shared code.

Reuse Anyhow?

However, obviously, projects can reuse code. Hardly any project nowadays manages without some open source library. Using this code is obviously easy and thus facilitates work. Problems like the ones arising upon reusing code between microservices are unlikely for a number of reasons:

• Open source projects in general are of high quality. Developers working in different companies use the code and therefore spot errors. Often they even remove the errors so that the quality permanently increases. To publish source code and therefore provide insight into internals is often already motivation enough to increase the quality.

• The documentation enables you to immediately start to use the code without a need to directly communicate with the developers. Without good documentation open source projects hardly find enough users or additional developers since getting started would be too hard.

• There is a coordinated development with a bug tracker and a process for accepting code changes introduced by external developers. Therefore, errors and their fixes can be tracked. In addition, it is clear how changes from the outside can be incorporated into the code basis.

• Moreover, in case of a new version of the open source library it is not necessary for all users to use the new version. The dependencies in regard to the library are not so pronounced that a deployment dependency ensues.

• Finally, there are clear rules how one’s own supplements can be incorporated into the open source library.

In the end the difference between a shared library and an open source project is mainly a higher quality in regard to different aspects. Besides, there is also an organizational aspect: there is a team that takes care of the open source project. It directs the project and keeps developing it. This team does not necessarily make all changes, but it coordinates them. Ideally, the team has members from different organizations and projects so that the open source project is developed under different viewpoints and in the context of different use cases.

Reuse as Open Source

With open source projects as role models in mind there are different options for reusable code in a microservices project:

• The organization around reusable libraries is structured like in an open source project. There are employees responsible for the continued code development, the consolidation of requirements and for incorporating the changes of other employees. The team members ideally come from different microservice teams.

• The reusable code turns into a real open source project. Developers outside of the organization can use and extend the project.

Both decisions can result into a significant investment since markedly more effort has to go into quality and documentation, etc. Besides, the employees working on the project have to get enough freedom to do so in their teams. The teams can control the prioritization in the open source project by only making their members available for certain tasks. Due to the large investment and potential problems with prioritization the decision to establish an open source project should be well considered. The idea itself is not new—experiences6 in this area have already been collected for quite some time.

6. http://dirkriehle.com/2015/05/20/inner-source-in-platform-based-product-engineering/

If the investment is very high, it means that the code is hardly reusable for the moment, and using the code in its current state causes quite some effort. Probably the code is not only hard to reuse, but hard to use at all. The question is why team members would accept such a bad code quality. Investing into code quality in order to make the code reusable can pay off already by reusing it just once.

At first glance it does not appear very sensible to make code available to external developers. This requires that code quality and documentation are of high enough quality for external developers to be able to use the code without direct contact to the developers of the open source project. Only the external developers seem to profit from this approach as they get good code for free.

However, a real open source project has a number of advantages:

• External developers find weak spots by using the code. Besides, they will use the code in different projects so that it gets more generalized. This will improve quality as well as documentation.

• Maybe external developers contribute to the further development of the code. However, this is the exception rather than the norm. But having external feedback via bug reports and requests for new features can already represent a significant advantage.

• Running open source projects is great marketing for technical competence. This can be useful for attracting employees as well as customers. Important is the extent of the project. If it is only a simple supplement of an existing open source project, the investment can be manageable. An entirely new open source framework is a very different topic.

Blueprints such as documentation for certain approaches, represent elements that are fairly easy to reuse. This can be elements of macro architecture, like a document detailing the correct approach for logging. Likewise, there can be templates that contain all necessary components of a microservice including a code skeleton, a build script and a continuous delivery pipeline. Such artifacts can rapidly be written and are immediately useful.


Try and Experiment

• Maybe you have already previously used your own technical libraries in projects or even developed some yourself. Try to estimate how large the expenditure would be to turn these libraries into real open source libraries. Apart from a good code quality this also necessitates documentation about the use and the extension of the code. Besides, there has to be a bug tracker and forums. How easy would it be to reuse it in the project itself? How high would be the quality of the library?


12.9 Microservices without Changing the Organization?

Microservices are more than just an approach for software architecture. They have pronounced effects on organization. Changes to the organization are often very difficult. Therefore, the question arises whether microservices can be implemented without changing the organization.

Microservices without Changing the Organization

Microservices make independent teams possible. The domain-focused teams are responsible for one or multiple microservices—this ideally includes their development as well as operations. Theoretically it is possible to implement microservices without dividing developers into domain-focused teams. In that case the developers could modify each microservice—an extension of the ideas presented in section 12.2. It would even be possible that technically focused teams work on microservices that are split according to domain-based criteria. In this scenario there would be a UI, a middle tier, and a database team that work on domain microservices such as order process or registration. However, a number of advantages usually associated with microservices cannot be exploited anymore in that case. First, it is not possible anymore to scale the agile processes via microservices. Second, it will be necessary to restrict the technology freedom since the teams will not be able to handle the different microservices if they all employ different technologies. Besides, each team can modify each microservice. This entails the danger that though a distributed system is created, there are dependencies that prevent the independent development of individual microservices. The necessity for independent microservices is obliterated because a team can change multiple microservices together and therefore also can handle microservices having numerous dependencies. However, even under these conditions sustainable development, an easier start with continuous delivery, independent scaling of individual microservices, or a simple handling of legacy systems can still be implemented because the deployment units are smaller.

Evaluation

To put it clearly, introducing microservices without creating domain-focused teams does not lead to the main benefits meant to be derived from microservices. It is always problematic to implement only some parts of a certain approach as only the synergies between the different parts will generate the overall value. Although implementing microservices without domain-focused teams is a possible option—it is certainly not recommended.

Departments

As already discussed in section 12.7, the microservice structure should ideally extend to the departments. However, in reality this is sometimes hard to achieve since the microservice architecture often deviates too much from the organizational structure of the departments. It is unlikely that the organization of the departments will adapt to the distribution into microservices. When the distribution of the microservice cannot be adjusted, the respective product owners have to take care of prioritization and coordinate the wishes of the departments that concern multiple microservices in such a way that all requirements are unambiguously prioritized for the teams. If this is not possible, a collective code ownership approach (section 12.2) can limit the problem. In this case the product owner and his/her team can also modify microservices that do not really belong to their sphere of influence. This can be the better alternative in contrast to a coordination across teams—however, both solutions are not optimal.

Operations

In many organizations there is a separate team for operations. The teams responsible for the microservices should also take care of the operations of their microservices following the principle of DevOps. However, as discussed in section 12.5, it is not a strict requirement for microservices to introduce DevOps. If the separation between operations and development is supposed to be maintained, operations has to define the necessary standards for the microservices in the macro architecture to ensure a smooth operations of the system.

Architecture

Often architecture and development are likewise kept separated. In a microservices environment there is the area of macro architecture where architects make global decisions for all teams. Alternatively, the architects can be distributed to the different teams and work together with the teams. In addition, they can found an overarching committee that defines topics for macro architecture. In that case it has to be ensured that the architects really have time for this task and are not completely busy with work in their team.


Try and Experiment

• What does the organization of a project you know look like?

Is there a special organizational unit that takes care of architecture? How would they fit into a microservices-based architecture?

How is operations organized? How can the organization of operations best support microservices?

How well does the domain-based division fit to the departments? How could it be optimized?

Can a product owner with fitting task area be assigned to each team?


12.10 Conclusion

Microservices enable the independence of teams in regard to technical decisions and deployments (section 12.1). This enables the teams to independently implement requirements. In the end this makes it possible for numerous small teams to work together on a large project. This reduces the communication overhead between the teams. Since the teams can deploy independently, the overall risk of the project is reduced.

Ideally the teams should be put together in a way that enables them to work separately on different domain aspects. If this is not possible or requires too much coordination between the teams, collective code ownership can be an alternative (section 12.2). In that case each developer can change all of the code. Still, one team has the responsibility for each microservice. Changes to this microservice have to be coordinated with the responsible team.

Section 12.3 described that microservices have a macro architecture that comprises decisions that concern all microservices. In addition, there is the micro architecture, which can be different for each microservice. In the areas of technology, operations, domain architecture, and testing there are decisions that can either be attributed to micro or macro architecture. Each project has the choice to delegate them to teams (micro architecture) or to centrally define them (macro architecture). Delegating into teams is in line with the objective to achieve a large degree of independence and is therefore often the better option. A separate architecture team can define the macro architecture; alternatively, the responsible team is assembled from members of the different microservice teams.

Responsibility for the macro architecture is closely linked to a concept for technical leadership (section 12.4). Less macro architecture means more responsibility for the microservice teams and less responsibility for the central architecture team.

Though microservices profit from merging operations and development to DevOps (section 12.5), it is not strictly required to introduce DevOps to do micro-services. If DevOps is not possible or desired, operations can define guidelines in the context of macro architecture to unify certain aspects in order to ensure a smooth operation of the microservice-based system.

Microservices should always implement their own separate requirements. Therefore, it is best when each microservice can be assigned to a certain department on the business side (section 12.7). If this is not possible, the product owners have to coordinate the requirements coming from different departments in such a way that each microservice has clearly prioritized requirements. When collective code ownership is used, a product owner and his/her team can also change microservices of other teams, which can limit the communication overhead. Instead of coordinating priorities, a team will introduce the changes that are necessary for a new feature by itself—even if they concern different microservices. The team responsible for the modified microservice can review the introduced changes and adjust them if necessary.

Code can be reused in a microservices project if the code is treated like an open source project (section 12.8). An internal project can be handled like an internal open source project—or can in fact be turned into a public open source project. The effort for a real open source project is high, which has to be considered. Therefore, it can be more efficient not to reuse code. Besides, the developers of the open source project have to prioritize domain requirements versus changes to the open source project, which can be a difficult decision at times.

Section 12.9 discussed that an introduction of microservices without changes to the organizational structure at the development level does not work in real life. When there are no domain-focused teams that can develop certain domain aspects independently of other teams, it is practically impossible to develop multiple features in parallel and thus to bring more features to the market within the same time. However, this is just what microservices were meant to achieve. Sustainable development, an easy introduction of continuous delivery, independent scaling of individual micro-services, or a simple handling of legacy systems are still possible. Operations and an architecture team can define the macro architecture so that changes to the organizational structure in this area are not strictly required. Ideally, the requirements of the departments are always reflected by one microservice. If that is not possible, the product owners have to coordinate and prioritize the required changes.

Essential Points

• Microservices have significant effects on the organization. Independent small teams that work together on a large project are an important advantage of microservices.

• Viewing the organization as part of the architecture is an essential innovation of microservices.

• A combination of DevOps and microservices is advantageous but not obligatory.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset