github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/docs/blog/_posts/2016-06-21-microservices-in-organisations.md (about)

     1  ---
     2  layout: post
     3  title:  Why Companies Adopt Microservices and How They Succeed
     4  date:   2016-06-21 00:00:00
     5  ---
     6  <br>
     7  As a change of pace, this post will mostly be a high level discussion on the non-technical aspects of adopting microservices 
     8  within a company.
     9  
    10  The transition towards a microservice architecture is usually thought of as a process driven by technical 
    11  limitations of an existing system. While that's true in most cases, many of the other reasons for moving 
    12  in that direction are led by higher level requirements related to the business and team dynamics.
    13  
    14  The post will cover motivations, the migration path, what success may actually look like and the tradeoffs 
    15  which are made in such a transition.
    16   
    17  Much of what's discussed will be familiar for people who've gone through this journey themselves. 
    18  It's important to share those experiences so others can learn from them and avoid potential pitfalls, but 
    19  also make informed decisions about whether migrating to microservices is right for them.
    20  
    21  Before we get into that, just a little bit about what microservices are.
    22  
    23  ### What Are Microservices
    24  
    25  > Loosely coupled service oriented architecture with a bounded context <br/>
    26  > <sub>Adrian Cockcroft</sub>
    27  
    28  Microservices in a nutshell is a software architecture pattern used to decompose monolithic applications into smaller services
    29  that do one thing well, interact over the network and are built and managed independently.
    30  
    31  In the introductory blog [post]({{ site.baseurl }}/2016/03/17/introduction.html) we discussed what microservices are, their benefits and 
    32  how [Micro](https://m3o.com) plays a role. This blog post assumes a basic understanding of microservices so if you're 
    33  interested in learning about them first check out the introductory post [here]({{ site.baseurl }}/2016/03/17/introduction.html).
    34  
    35  If you want to read more about the technical aspects of migrating to microservices check out the blog post by 
    36  Matt Heath on Hailo's [Journey Into Microservices](https://sudo.hailoapp.com/services/2015/03/09/journey-into-a-microservice-world-part-1/).
    37  
    38  There's also a great article by Martin Fowler that covers the fundamental ideas behind microservices which can be found 
    39  [here](http://martinfowler.com/articles/microservices.html).
    40  
    41  <p align="center">
    42    <img src="{{ site.baseurl }}/blog/images/mono-to-micro.png" style="max-width: 600px; height: auto;" />
    43  </p>
    44  
    45  Let's dive into the motivations for adopting microservices. 
    46  
    47  ### The Motivations
    48  
    49  > Speed, Scale, Agility
    50  
    51  Have you ever heard a company speak the words:
    52  
    53  <i>"We need to move slower"</i>
    54  
    55  Most likely not.
    56  
    57  Usually the goal is to deliver a quality product in the shortest time possible. It sounds pretty straight forward but it's not
    58  quite that simple.
    59  
    60  A product is constantly evolving and "feature complete" is most likely a moving target. We're defining new requirements, 
    61  integrating with additional partners, navigating the intricacies of business in various regions of the world. The business is 
    62  continuously growing and evolving.
    63  
    64  In the early days, the total number of team members is still low, the codebase has a small footprint and the product is 
    65  focused on doing one thing really well. It's fairly common to see extremely fast product cycles in the first couple years of a 
    66  business and it's the most common trait identified with startups.
    67  
    68  As things pick up the company adds more people to fuel growth, the focus starts to shift into new markets, there's a need to scale 
    69  with the growing demand internally and externally. All the while the underlying system, which worked great in the early days, is now starting 
    70  to show signs of wear and tear.
    71  
    72  What used to take a few days is now taking weeks if not longer. Teams are struggling to execute in parallel. There's a lot of cross coordination 
    73  overhead and people are stepping on each others work in a monolithic codebase.
    74  
    75  Developers dread pushing software to production, the entire system occassionally falls over because of traffic spikes. Teams 
    76  start pushing Q1 deadlines to Q2 or even Q3, and the inevitable slow down begins.
    77  
    78  The company is no longer executing effectively. Something has to be done.
    79  
    80  The technical team may decide to iteratively break out pieces of the system. This can somewhat help but 6-12 months down the line there's a realisation that it's still a mess with most of the previous issues still in existence. 
    81  
    82  It's become impossible to add anything new without causing more problems.
    83  
    84  <center><p>...</p></center>
    85  
    86  These are issues faced by many companies at some point in their lifetime. From a business standpoint it becomes clear that the current organisational
    87  structure and technical architecture will mostly likely hinder the progress of the company in the long term. 
    88  
    89  The day 1 goal of the company still stands true. To deliver a quality product in the shortest space of time possible. However the company is now 
    90  being limited moreso by itself than the market or it's competitors.
    91  
    92  At this point it becomes clear that there's a need to address these issues so the company can be structured in a way that will enable it to execute and scale.
    93  
    94  ### The Road To Re-architecture
    95  
    96  > It's not about technology, it's about people
    97  
    98  The motivations are clear but before pursuing any path it's important to begin by discussing the existing issues with those directly 
    99  affected. The team.
   100  
   101  Jumping too quickly into architecting a new system without understanding the existing problems could not only result in building the wrong solution 
   102  but also wasting a significant amount of time and money.
   103  
   104  Every part of the organisation will be affected differently. Many of the problems you'll hear are not specifically technical
   105  but moreso about cross team collaboration, prioritisation of goals, etc.
   106  
   107  Technology may be at the core of the product offering but the day to day operation of the company is focused on people and how 
   108  they work together.
   109  
   110  ###### Seek Out Expertise
   111  
   112  While discussing the company problems and potential solutions amongst the team is imperative it's also worthwhile 
   113  seeking an outside perspective. The experience of those who may have seen these problems before can be immensely valuable.
   114  
   115  This doesn't necessarily mean looking to consulting firms. The road to re-architecture is nothing new. There are many 
   116  experienced teams or individuals from other companies who've already been down this path and can offer great insight. 
   117  
   118  Ask someone to spend a few days talking to people at the company and looking at the technology, so they can 
   119  provide a well formed opinion about how you should proceed. By seeking out a number of outside experts you'll be able 
   120  to make an informed decision about what the next steps should be.
   121  
   122  In some cases, microservices may not actually be the needed solution. A lot of deficiencies may be process related and 
   123  can be rectified by focusing on product lifecycle management with additional minor technical changes.
   124  
   125  You may receive contrasting views about what the right approach is. This will be because of past experiences with 
   126  specific elements in place such as strong growth and revenue, senior engineers with past architecture experience, etc. 
   127  
   128  It's important to listen to the various experiences and opinions, however at the end of the day your team needs to make a
   129  judgement call about what your collective priorities and the approach that's best suited to you.
   130  
   131  ###### Existing Models
   132  
   133  If you do decide that re-architecture is the path to take, again seek out the experts in the field who've done this before 
   134  and identify models that already work.
   135  
   136  The things you really want to know are:
   137  
   138  1. What team structures and dynamics work
   139  2. Which technologies make sense for you
   140  3. How the architecture is built and scaled
   141  4. What the migration path is from the legacy system
   142  
   143  The patterns for microservice platforms have emerged in recent years with the likes of 
   144  [Netflix](http://www.slideshare.net/adrianco/high-availability-architecture-at-netflix) being one of first to 
   145  actively speak about their journey. This process of re-architecture included a move to the public cloud leveraging 
   146  Amazon Web Services.
   147  
   148  Others like Spotify have discussed engineering culture and structural practices that worked for them. There's a wealth 
   149  of information on the successes of squads, tribes, guilds, mission teams and so on. 
   150  
   151  ###### Prototyping
   152  
   153  With all that in mind, diving head first into a complete rewrite is unadvisable. The best way to begin is with some rapid prototyping. 
   154  
   155  In this phase a group of engineers should be given time to identify and test potential technologies and architecture 
   156  patterns. This is ideally a 2-4 week period that results in sample solutions, demo platforms and a summary that can be presented to 
   157  the rest of the company.
   158  
   159  It's important to discuss what will and won't work as a team rather than making decisions in a silo. The entire company will 
   160  inherently be users of the new platform and they should have a say in what they'll be using day to day.
   161  
   162  A lot will be learned during this phase. Whether the team has the existing skills and experience to build a better system than before. 
   163  What timelines potentially look like in building the first version of said system. And whether it's actually going to 
   164  solve the problems you're facing as an organisation.
   165  
   166  If it looks like any of these issues are going to arise in the next phases of the process it's ideal that they're surfaced now 
   167  in this low risk low cost setting.
   168  
   169  Do not be afraid to take a step back to reassess if it no longer makes sense.
   170  
   171  If the prototyping phase was successful, it's time to move on to the next step. Building the new platform and validating that it actually works.
   172  
   173  ###### A New Architecture
   174  
   175  Looking back, it may become clear that the existing system was cobbled together manually and formed a unique architecture which 
   176  was only fully understood by a few engineers within the company.
   177  
   178  Is there a disaster recovery plan? Is there automated failover? How long would it take to rebuild from scratch? Is it scalable? 
   179  Is it secure?
   180  
   181  The answer to these questions probably wasn't met with a confident "yes". This is the time at which many take the opportunity 
   182  to address the above questions along with all the other problems discussed before.
   183  
   184  So what's needed? 
   185  
   186  A clean slate. A fully automated highly available cloud native platform.
   187  
   188  As mentioned before, the pattern and tools to develop a globally scalable microservice platform already exist. Along with the results of the 
   189  prototyping phase, the team should be able to produce a repeatable model that becomes the basis of the new system.
   190  
   191  As this is a mostly non-technical post, we'll leave out the details of how that's actually achieved. Reach out if you would like to 
   192  discuss it further.
   193  
   194  <p align="center">
   195    <img src="{{ site.baseurl }}/blog/images/regions.png" style="width: 80%; height: auto;" />
   196  </p>
   197  
   198  ### The Migration Path
   199  
   200  If you're providing a service to customers then you know business continuity is absolutely critical. Any disruptions in your service 
   201  affects the customer experience and ultimately the company's revenue.
   202  
   203  A Service Level Agreement (SLA) is common practice and you want to ensure this is maintained throughout the migration process. 
   204  It's key to remember that the business is first priority but maintaining this SLA during a migration process is a tradeoff between 
   205  uptime and developement time.
   206  
   207  If teams are spending a significant amount of time migrating from the legacy system to the new system, the company is essentially 
   208  unable to execute on other important aspects of the business. It's something everyone must be wary of before even beginning 
   209  this journey.
   210  
   211  With that said, no matter which way you cut it, the migration path will take time. The tried and tested method is to take an existing 
   212  function of the legacy system, build a new version as a microservice on the new platform and gradually shift request traffic over.
   213  
   214  There's a few important points to keep in mind here.
   215  
   216  1. **The entire company does not need to focus on the migration**. A single team, ideally the team which built the prototype, 
   217  should take on this task. This allows the majority of teams to continue work on their existing projects and minimises any further disruption.
   218  
   219  2. **Pick a well understood function of the system**. It's important that the team migrating over the first feature has a deep understanding 
   220  of that feature, how it will be architected in the new system and how to rollback if there are any significant issues.
   221  
   222  3. **Set achievable milestones**. A couple weeks is likely not long enough to migrate that first feature but if you're still working 
   223  on it after 6 months, something is clearly going wrong. 3 months is a good timeframe in which to develop a plan, write the software, and by the end,
   224  serving production traffic on the new platform. 
   225  
   226  After successfully migrating over the first few features/services a pattern will emerge in terms of the technical approach, timelines and 
   227  team requirements.
   228  
   229  The process is one that can take many months or even years depending on how you prioritise the migration. Everyone should understand 
   230  that this is not an overnight transition and the rearchitecture path must be as much a part of the roadmap as any new feature 
   231  or product development.
   232  
   233  ### Platform as a service
   234  
   235  > Your developers are customers
   236  
   237  As the migration is underway, patterns emerge and a playbook is formed for how this process should continue on successfully. The "platform" 
   238  team will have developed a deep understanding of all that's involved.
   239  
   240  The rest of the company should be kept in the loop about the progress of the migration and will have accrued some knowledge 
   241  of how the new platform works during the journey. 
   242  
   243  Further effort now needs to be made to engage them in increasing this understanding 
   244  and opening the platform up to them so they can participate in the migration of services themselves or build new products on the platform.
   245  
   246  This is where we really start to address the need for Platform as a Service.
   247  
   248  ###### The Need For A Platform Team
   249  
   250  You'll have heard of PaaS as some form of hosted offering for running applications. The benefit of such a system is that it allows you to 
   251  focus primarily on product development and less on infrastructure management.
   252  
   253  When running a microservice platform internally you wan't this same advantage. Teams should be focused on delivering business value 
   254  rather than on the complexities of automating and managing distributed systems. 
   255  
   256  A platform team's primary objective would be to deliver platform as a service internally via APIs, dashboards and developer tools while 
   257  maintaining a highly available and scalable system.
   258  
   259  There are varying opinions on this methodology. Spotify for instance have opted for a polygot architecture in which every team chooses their 
   260  own technologies and manages their own infrastructure.
   261  
   262  The likes of Google, Facebook, Twitter, Netflix and Hailo have opted for the alternative model where a set of services are provided to the 
   263  company much like a cloud provider. 
   264  
   265  As with any choice, it's a tradeoff. In this case time versus flexibility. By allowing teams to manage their own infrastructure, much 
   266  of the time is spent there. If platform as a service is provided instead, that time is recouped but a more opinionated service is offered.
   267  
   268  Companies have to rationalise these decisions internally based on their skills, experiences and what they deem to be most important to 
   269  them. An argument can be made for either methodology.
   270  
   271  <img src="{{ site.baseurl }}/blog/images/org.png" style="max-width: 600px; height: auto;" />
   272  
   273  ###### Self Organising Teams
   274  
   275  With the power of a microservices platform, feature development and testing new ideas should be quick. If anything 24-48 hour 
   276  hackathons can become a regular occurrence and originate new products.
   277  
   278  One method of really harnessing this power is around the idea of self organising teams. For the most part you will have mission 
   279  teams or product teams which operate autonomously and focus on key long term objectives. Self organising teams are a way 
   280  of augmenting this structure.
   281  
   282  An example scenario. A group of 3-4 employees with complementary skills from various teams identify a problem that needs to be 
   283  solved or they have an idea for a new feature which they feel strongly about developing.
   284  
   285  With the approval of their managers, they form a temporary team for a two week sprint to build out a solution. They're able to reuse 
   286  existing micro services on the platform and make use of all the self serve tools which really accelerates the process.
   287  
   288  By the end of the sprint they ship a new set of services to production without having to coordinate with any other teams and also 
   289  more importantly without having to modify a single line of code in any existing applications.
   290  
   291  If the solution proves successful they make the case for creating a permanent team to further product development.
   292  
   293  Self organising teams are a really great organisational enhancement driven by the advantages for microservices.
   294  
   295  Another common name for self organising teams is Guilds. It's a term popularised by Spotify as part of their organisation structuring 
   296  methods. 
   297  
   298  Learn more about Spotify's model [here](https://ucvox.files.wordpress.com/2012/11/113617905-scaling-agile-spotify-11.pdf).
   299  
   300  <img src="{{ site.baseurl }}/blog/images/guild.png" style="max-width: 600px; height: auto;" />
   301  
   302  ### What Success Looks Like
   303  
   304  > Zero to production in hours or days, not weeks or months
   305  
   306  Migrating a running business from one platform to another can be a long and arduous process. The measure of success 
   307  should not solely be judged on reaching the end of that process but the goals achieved incrementally along the way. 
   308  
   309  Revisiting the problems discussed earlier on.
   310  
   311  1. Slow development process
   312  2. Cross team coordination
   313  3. Brittle monolithic software
   314  
   315  Even while working on the migration, all of these issues should more than likely be solved. Microservices offer a form 
   316  organisational speed, scale and agility via distributed systems technical architecture.
   317  
   318  The monolith application is decomposed into a number of smaller applications that can be worked on and released
   319   independently by teams. They do not have to be aware of technical details of services developed by other teams but 
   320  can consume them via strongly defined APIs. 
   321  
   322  Teams are likely to have faster product development cycles because of this and are able to operate autonomously. Where 
   323  cross team collaboration does need to occur, it can be done in a self organising fashion or by simply consuming APIs 
   324  of their services.
   325  
   326  Further to that, the platform should now offer a highly available and globally scaling system which product teams can leverage without 
   327  having to think about the details of building distributed systems.
   328  
   329  Success is still measured as the ability to deliver a quality product in the shortest time possible but now 
   330  with an ability to scale the organisation and technology.
   331  
   332  <center><p>...</p></center>
   333  
   334  While undergoing this process a lot will have changed, some of which is under your control and a lot of which is not. The market 
   335  may have evolved, the company grown in size, priorities perhaps shifted.
   336  
   337  It's important to evolve and adapt with the shifting lanscape. Do not be afraid to try restructuring teams, launching new features, 
   338  etc. 
   339  
   340  The platform is a strong foundation which should allow you to move fast, launch new initiatives and 
   341  iteratively reshape the business in any way imaginable. Think of it as a competitive advantage.
   342  
   343  ### The Big Bang
   344  
   345  > Big bang is the death of a company
   346  
   347  No post on re-archicture is complete without a few words on the big bang. 
   348  
   349  Big bang product development is a process by which the product is only launched once completed. The entire endeavour 
   350  can range from anywhere between 6-12 months at the very least but is likely significantly longer.
   351  
   352  Following this method in a re-architecture process would essentially involve rebuilding the entirety of the existing 
   353  product and then cutting over to the new platform when complete. You can already picture the countless ways 
   354  in which this could possibly go wrong.
   355  
   356  Building with a big bang methodology can be a conscious decision but in most cases it's a slow growing beast that 
   357  no one sees coming. What's deemed feature complete is a boundless list. The product needs some
   358  tweaking and then a little more and then just a little bit more. It's never quite ready to be launched.
   359  
   360  There is a high failure rate associated with this form of development and rightfully so. Significant time and money 
   361  can be lost to big bang development. 
   362  
   363  How does the team know what they're building is actually still viable in the market today? The opportunity could be lost 
   364  and without feedback along the way it's hard to tell whether you're still going down the right path.
   365  
   366  When taking on the process of re-architecture we know what the end goal is but the task of getting there should be broken 
   367  down into smaller deliverables that can be achieved in short spaces of time.
   368  
   369  Avoid the big bang at all costs. Aim for two week sprint deliverables with quarterly milestones for larger chunks of work. 
   370  Each cycle moves you closer to the end goal while producing tangible results in the interim.
   371  
   372  <img src="{{ site.baseurl }}/blog/images/big-bang.jpg" style="max-width: 600px; height: auto;" />
   373  
   374  ### The Tradeoffs
   375  
   376  > Microservices are not a panacea
   377  
   378  When it comes to scaling technology and teams, there's no silver bullet. 
   379  Success is a moving target. What works in a team of 10 will not work for 100 will not work for 1000 and so on. The same 
   380  could be said for most choices within a company, whether their technology related or not.
   381  
   382  Everything is a tradeoff. Managing a microservices architecture can require significantly more operational work but the 
   383  benefits of such a system are seen in the increased speed of execution and scalability.
   384  
   385  We see a natural path towards the adoption of microservices within organisations. At a certain scale it becomes 
   386  more difficult to manage monolithic systems and the tradeoffs in decentralising both people and technology are worth 
   387  making for the benefits they provide.
   388  
   389  Many companies have undergone these learnings by trial and error, in the days before we learned of microservices, before 
   390  GitHub and open source software became popular, back when it was deemed a competitive advantage to keep all things a secret.
   391  
   392  Google is a prime example. They were really forced to learn, iterate and evolve due to the scaling requirements and their need 
   393  to compete with the giants of their era like Microsoft and Yahoo.
   394  
   395  Most of us will never quite reach the scale of Google but their experiences and knowledge of scale is incredibly valuable 
   396  and we can leverage those to our advantage.
   397  
   398  More and more companies are choosing to adopt microservices at some point in their journey, whether it be a conscious 
   399  effort with large scale R&D or a more iterative and methodical approach.
   400  
   401  It's clear that their are tradeoffs in adopting microservices and many challenges along the way. There's no one path to 
   402  success but we're now seeing patterns and processes emerge that may result in microservices being the ideal way forward
   403  for a number of companies.
   404  
   405  <center><p>...</p></center>
   406  
   407  If you want to learn more about the services we offer or microservices, check out the [blog](/), the  website 
   408  [micro.mu](https://m3o.com) or the github [repo](https://github.com/tickoalcantara12/micro).
   409  
   410  Follow us on Twitter at [@MicroHQ](https://twitter.com/m3ocloud) or join the [Slack](https://slack.m3o.com) 
   411  community [here](http://slack.m3o.com).