Microservices

blov · · 2437 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all<br/> Can someone please explain me, what are microservices?<br/> Can I use for communication with web browser like with REST/API.<br/> I am imaging a microservice like: a web server that waiting for incoming requests. When a request comes in, I will call a session service(microservice) that validate, if the request is valid. After then I will pass the request to the next microservice for processing continue work. Usually session service will be placed as a middleware in http handler, negroni framework provide it.<br/> What are the microservices and how can I use for the web backend server? </p> <hr/>**评论:**<br/><br/>klaaax: <pre><p>here is the canonical definition. This has however nothing to do with Go directly , you should post these kind of questions on <a href="/r/programming" rel="nofollow">/r/programming</a></p> <p><a href="http://martinfowler.com/articles/microservices.html" rel="nofollow">http://martinfowler.com/articles/microservices.html</a></p></pre>TotesMessenger: <pre><p>This thread has been linked to from another place on reddit.</p> <ul> <li>[<a href="/r/programming" rel="nofollow">/r/programming</a>] <a href="https://np.reddit.com/r/programming/comments/36afhe/microservices/" rel="nofollow">Microservices</a></li> </ul> <p><a href="#footer" rel="nofollow"></a><em><sup>If you follow any of the above links, respect the rules of reddit and don&#39;t vote.</sup> <sup>(<a href="/r/TotesMessenger/wiki/" rel="nofollow">Info</a></sup> <sup>/</sup> <sup><a href="/message/compose/?to=/r/TotesMessenger" rel="nofollow">Contact</a>)</sup></em></p> <p><a href="#bot" rel="nofollow"></a></p></pre>btomashvili: <pre><p>here is good web page with good articles . </p> <p><a href="http://microservices.io/" rel="nofollow">http://microservices.io/</a></p></pre>kortemy: <pre><p>There are some good replies here, so I&#39;m gonna do a TLDR version.</p> <ul> <li><p><strong>Microservices</strong> architecture means that you do not deploy single application (like SOA), but you deploy many standalone &#34;micro&#34; applications. Micro services.</p></li> <li><p>Microservice should be <strong>single responsibility</strong> service. Determine every action in your app. Each of them is a separately deployable service. For example, user logging in is a separate service. User logging out is a separate service. Max 100 lines of code.</p></li> <li><p>How is that better than deploying everything as a single app? </p></li> <li><ol> <li><strong>Scalability</strong>. When your application needs scaling, you scale only services that are critical, and you replicate only services that need to scale, instead of replicating whole app. For example service for serving landing pages needs to scale more than a service for editing users profile.</li> </ol></li> <li><ol> <li><strong>Availability</strong>. When you need to redeploy or update some of your code, you only update/redeploy single service, instead of your whole app. You deployed a bug by accident? You don&#39;t need to rollback whole application, just the affected service.</li> </ol></li> <li><p>How do they <strong>communicate</strong>? This is the biggest bottleneck of microservices. General rule is &#34;clean endpoints, dirty pipes&#34;. Meaning that your exposed API is your priority, and how microservices communicate is up to you. Microservices should generally be as decoupled as possible. </p></li> <li><ol> <li>In order for your cluster to know the availability of certain service you need a <strong>service discovery</strong> system. This is basically a registry of all deployed services and their availability. There are a lot of premade solutions for this, like Consul, etcd, ZooKeeper, Serf.</li> </ol></li> <li><ol> <li>In terms of inter-services communication, most popular approach is <strong>central bus microservice</strong>, that serves as pub/sub system, and other microservices use it to publis messages and subscribe to others. A lot of service discovery systems have this built-in as well, through different event systems.</li> </ol></li> <li><p>When are microservices useful? When your app requires high scalability and high availability. If SOA approach is good enough for you, its probably a better pick since managing microservices cluster is hard and not worthwhile if you don&#39;t require 30 instances of one service and only 2 instance of other.</p></li> </ul></pre>chuhnk: <pre><p>Microservices is an architecture pattern used to breakdown large monolithic apps into a number of smaller services. Adrian Cockcroft describes them as, &#34;loosely coupled service oriented architecture with a bounded context&#34;.</p> <p>Chris Richardson has a great website on <a href="http://microservices.io/" rel="nofollow">Microservices</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

2437 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传