The experience and lessons of moving from ruby megalith architecture to go microservice

Jiedao jdon 2021-05-03 20:54:28
experience lessons moving ruby megalith

Niket It's a possession 9 year Web Experienced programmers ,2013 Put into use Go Language , This conversation is about its starting from Ruby Of monolithic( The rock 、 Integrity and iron ) Architecture switch to Go Language microservice( Microservices ) Lessons from the architecture process :

From a Ruby monolith to microservices in Go, lesso

It is the characteristic of microservice architecture to take the business service with single goal to solve single problem as microservice .Niket stay Beehively Work , This is a popular online platform for parent communication and credit and attendance management ,Beehively It's a Ruby application , these years , It has grown into a website with many features , Including transcripts, reports, notifications, reminders, etc , stay 2013 year , The development team decided to start with Ruby Write the Stonehenge architecture switch to Go Language and Ruby Hybrid microservice Architecture .

Ruby It's a complex language ,Ruby Beautiful on the surface , But there's a complex heart , Just like our bodies .

When they first started ,Ruby It's useful to be powerful and complex , But over time , The complexity of language permeates into Beehively In the code base , When the project is small Ruby It's a good language . They decided to switch to a new language and architecture to constrain the complexity of the code base .

This conversation is about : Why do they switch to microservice architecture ? Why? Go It's a good choice for microservice architecture ?

Ruby The pain of

There are three main reasons for them to move away Ruby It's a monolithic structure .

1. Memory consumption versus speed ; Apply a lot of data caching in memory to improve performance , however Ruby Distribution and GC Recycling takes a lot of time , Finally, it offsets the huge performance improvement brought by cache , They use UX workaround Hiding the slow , And bought bigger boxes , Although it works normally for a while , And finally it reached the tipping point .

2. Concurrent : stay Ruby Concurrency is achieved by using multiple processes , Applications need a lot of worker, Each runs in its own process , This increases their memory consumption .

3. Compatibility test : In their experience ,Ruby It's very fast development , It's a way of destroying a lot of things , Important library packages will be discarded , The frame will merge into the frame , When your product is young , So your product is still less dependent on , You can be liberated and the product is beautiful , But sometimes you need more stability ,Go Community culture is more conducive to stability , And avoid disruptive changes .

In order to achieve a better user experience and take advantage of more modern technology , After months of work , They rewrote the code , But the new system is still a little less functional than their old system , Even though the new code is better , But it can't be handed over to their customers , Because it's not functional enough , therefore , They are in an awkward dilemma , The second new system is good , But it can't completely replace the first system in function .

Migration to microservices is the solution to this problem .

Moving to a microservice doesn't mean rewriting the entire application , They can propose components as separate applications .

Three core components PDF generator , alert System , and Report card calculation grade calculator Break down into three separate microservices .

See the original text for details ....

They use Nginx Route requests to these microservices or major Ruby application ,Redis It's an effective tool to combine main application and micro service ,Go The micro service of will Ruby The application is seen as a API Client or upstream agent . You need a simple Authorization , Microservices and main applications can be expanded independently .

Go In terms of deployment, it's simple , Just build rsync And through the upstart restart .

stay 2013 After switching ,Beehively Found a clean and beautiful new architecture , Here is their experience :

1. Go Language is a process of writing Web Simple service, great language , It's especially suitable for microservices , This not only refers to GO The language itself , And some of the tools and community culture around it .

2. Instead of rewriting the entire application from scratch , You can use some components specifically Go Micro services replace , So as to reduce the workload , But it brings more benefits , up to now , They haven't reduced any of the features that customers rely on .

3. Even if the new architecture needs to deploy multiple services ,Go Make deployment simple , This is critical from a system management perspective .

For teams whose development slows down due to complexity , They highly recommend Go Language rewriting .

本文为[Jiedao jdon]所创,转载请带上原文链接,感谢

  1. Analysis of MVC
  2. [middle stage] please stay and join me in the backstage
  3. Understanding front end garbage collection
  4. [continuous update] front end special style implementation
  5. Flutter product analysis and package reduction scheme
  6. XPath positioning
  7. 前端开发css中的flex布局的使用
  8. The use of flex layout in front end development CSS
  9. JQuery核心函数和静态方法
  10. JQuery core functions and static methods
  11. Node family - understanding of blocking and non blocking
  12. 热点微前端Microfrontend的讨论:谷歌AdWords是真实的微前端
  13. Vue source code analysis (2) initproxy initialization proxy
  14. What's TM called react diff
  15. Summary of common front end data structure
  16. Useeffect in hooks
  17. [encapsulation 02 design pattern] Command pattern, share meta pattern, combination pattern, proxy pattern, strategy pattern
  18. Front end notes: virtual Dom and diff of vue2. X
  19. The best code scanning plug-in of flutter
  20. The simplest plug-in for rights management of flutter
  21. 21. Object oriented foundation "problems and solutions of object traversal"
  22. Discussion on hot micro front end: Google AdWords is a real micro front end
  23. Usecallback and usememo for real performance optimization
  24. 【前端圭臬】十一:从规范看 JavaScript 执行上下文(下)
  25. [front end standard] 11: Javascript execution context from the perspective of specification (2)
  26. Hexagonal六角形架构ReactJS的实现方式 - Janos Pasztor
  27. Transaction of spring's reactive / imperative relational database
  28. The implementation of hexagonal hexagonal reactjs Janos pasztor
  29. HTTP状态码:402 Payment Required需要付款 - mozilla
  30. HTTP status code: 402 payment required - Mozilla
  31. Factory mode, constructor mode and prototype mode
  32. Build the scaffold of react project from scratch (Series 1: encapsulating a request method with cache function based on Axios)
  33. Cocos Quick Start Guide
  34. Comparison of three default configurations of webpack5 modes
  35. A case study of the combination of flutter WebView and Vue
  36. CSS: BFC and IFC
  37. A common error report and solution in Vue combat
  38. JS: this point
  39. JS: prototype chain
  40. JavaScript series -- promise, generator, async and await
  41. JS: event flow
  42. Front end performance optimization: rearrangement and redrawing
  43. JS - deep and shallow copy
  44. JavaScript异步编程3——Promise的链式使用
  45. JavaScript asynchronous programming 3 -- chain use of promise
  46. Vue.js组件的使用
  47. The use of vue.js component
  48. How to judge whether a linked list has links
  49. Element UI custom theme configuration
  50. Text image parallax effect HTML + CSS + JS
  51. Spring的nohttp宣言:消灭http://
  52. Vue3 intermediate guide - composition API
  53. Analysis of URL
  54. These 10 widgets that every developer must know
  55. Spring's nohttp Manifesto: eliminate http://
  56. Learn more about JS prototypes
  57. Refer to await to JS to write an await error handling
  58. A short article will directly let you understand what the event loop mechanism is
  59. Vue3 uses mitt for component communication
  60. Characteristics and thinking of ES6 symbol