最近由于一些原因,一直在研究serverless及相关的技术实现和原理。
从传统SOA架构到容器架构,再到serverless,里面的架构演进历史对于一个亲历者来说感触颇多,下面我们就来简单聊聊传统SOA和面向服务的架构演进,帮助大家更好的理解其中的概念,本人水平有限,如有错误烦请各位大佬指正。
当我们提到SOA(Service-Oriented Architecture)架构的时候想到的是什么?松耦合(Loosely Coupled)?服务拆解?面向服务?
其实个人觉得相对于单机架构来讲,SOA架构解决的是业务可用性,相关服务的水平扩展,以及资源再利用,管制,流程审核等等等。这点其实和当今很火的微服务概念很像,都是以服务作为单位,都比较在意服务的治理和服务复用,微服务其实也是在SOA上做的改进,当然微服务更多强调的是“业务需要彻底的组件化和服务化”,其实本人多Spring Cloud等一些JAVA系的产物并没有什么好感,如果希望拿到一个高性能的RPC框架,可以尝试 TARS 。
那么一个完整的SOA架构体系是怎么样的呢?
如上图所示,SOA架构就是这样的,通过各个服务模块,将较为复杂的业务拆分治理,它的特点是服务是无状态的,即服务在被调用前后本身没有变化,且同一个服务允许同时在多台计算机上运行。那么正是因为如此,就诞生了一系列的中间件产品比如服务总线(service bus),API 网关(API Gateway),消息队列(MQ/kafka)
消息队列在SOA/微服务架构的示意图
这就是传统SOA和中间件的相关说明。
那么我们再来聊聊容器把,众所周知,容器这个概念也是最近才火起来的,依赖与Kubernetes (K8s)的容器编排工具,容器由于其低廉的使用成本,高可用的扩展性,持续交付能力等等,越来越多的企业开始使用并大规模部署容器,最典型的应该是斗鱼,虎牙等一些系列老SOA架构上容器的业务改造。
但是大多数的企业其实对容器的玩法是有误解的,容器单位其实本质是为了方便单个服务的拆解, 看到有很多企业拿容器当KVM那种虚拟化的主机使用,所以吐槽下。
容器和普通KVM,Xen等虚拟化的区别我想大家应该都差不多略有了解,这块就不在展开叙述了。我们来重点说说Kubernetes容器编排对于传统SOA架构的意义和价值。
Kubernetes属于主从分布式架构,主要由Master Node和Worker Node组成,以及包括客户端命令行工具kubectl和其它附加项。Master Node:作为控制节点,对集群进行调度管理;Master Node由API Server、Scheduler、Cluster State Store和Controller-Manger Server所组成;
Worker Node:作为真正的工作节点,运行业务应用的容器;Worker Node包含kubelet、kube proxy和Container Runtime;kubectl:用于通过命令行与API Server进行交互,而对Kubernetes进行操作,实现在集群中进行各种资源的增删改查等操作;
Add-on:是对Kubernetes核心功能的扩展,例如增加网络和网络策略等能力。
那么从上面可知,Kubernetes更多的意义在于对传统SOA的服务器层级做改造,实现自动化部署容器,水平扩容,负载均衡等等分布式的部署环境,这样一方面实现了所谓的“高内聚,松耦合”,另一方面简化了传统SOA的服务器层级的管理。由于集群的特性,可以将业务模型拆分为更细颗粒度的面向服务。
总的来说,不论是Docker,Dubbo还是上升到Kubernetes,他们实现的更多替代的是对服务器层级的集群调度,分布式方面的改造,更多的意义是基于传统SOA做的优化和改进。
那么我们再来看看今天的重头戏,Serverless 。
AWS 的 AWS Lambda 在 Serverless 界是有统治地位的,但是由于各种原因,AWS Lambda 在中国国内鲜为人知,它的理念更多是提倡弱后端,弱运维,以最小的成本来实现业务功能。来用一个很短的视频看下把
它所提倡的更多是函数的概念,可以理解为将K8S的Worker Node封装成简一的单个函数,从而实现单任务,无状态的函数工作流。当然,每家的Serverless架构实现都不尽相同,所以不太可能都依赖于K8s实现,但是不论BaaS或者FaaS基础能力和特性都是一样的。
除了AWS Lambda 还有腾讯云的 SCF,阿里云的函数计算等等,其实Serverless更多看的还是基于Serverless所做的产品附加功能,比如 AWS DynamoDB,AWS API Gateway等等一系列的附加功能,来实现Serverless的易用化与独立性。最近腾讯云出了 SCF (HTTP)版的云函数,可以直接通过HTTP访问请求,感兴趣的童鞋可以去看看。
所以 Serverless 相对于容器,传统SOA不论从设计架构,纬度,和应用方法上都不尽相同,Serverless将SOA的服务概念,容器的工作节点概念,拆分到函数,这就代表如果使用Serverless必须实现业务的云原生,最简单的例子就是如果要把一个单体应用拆分成10个容器,100个函数,并且每个都具有独立的部署周期以及复杂的依赖图,配合成熟健壮的CI/CD以及自动化的系统。把这些和Serverlss一起使用的时候,将会大幅提升敏捷性和创新性,但是如果仅仅只有其中一个,那么带来的损失远大于收益。
Serverless 的使用是有门槛的,尤其对于一些现在还在沿用单体架构的企业来说,如果没有任何Docker/Kubernetes的实施经历。那么就不该从Serverless开始。
如上,就是我对SOA,容器,Serverless的一些思考,最后的最后,如果自己想架构一个独立的Serverless框架应该如何实现呢?
给大家介绍一个Serverless开源框架——Fission
它的架构如下:
简单来说就是一个Web应用,Go语言编写,使用gorilla框架。不过它的模板引擎替换成了Kubernetes中的Service。使用k8s.io/client-go/kubernetes接口来操控。
感谢大佬们来看我的长篇大论,本人水平有限,如有错误,烦请务必指正~~
Can I just say what a reduction to search out someone who actually is aware of what theyre talking about on the internet. You definitely know the best way to deliver a problem to mild and make it important. More people need to learn this and understand this facet of the story. I cant consider youre not more standard since you definitely have the gift.
Ulan Beni neden stalklarsınız anlamış değilim
şok üstüne şok yaşıyorum, neler varmış da haberimiz yokmuş 😎
hello!,I like your writing so much! share we communicate more about your article on AOL? I require a specialist on this area to solve my problem. Maybe that’s you! Looking forward to see you.
bugün de gizli hayranlarımızı öğrendik…
Arkadaşlar uygulama cidden çalışıyor şok geçiriyorum şu an😰
Çok Güzel bir uygulama
Öğrendiğimiz iyi oldu 🙂
Çok Güzel bir uygulama
Hello, i think that i saw you visited my web site so i got here to ?go back the want?.I am trying to in finding issues to enhance my website!I suppose its adequate to use a few of your concepts!!
whoah this weblog is wonderful i like reading your articles. Stay up the good work! You understand, many people are searching round for this info, you can help them greatly.
Very nice post. I just stumbled upon your blog and wished to say that I’ve truly enjoyed surfing around your blog posts. After all I will be subscribing to your rss feed and I hope you write again very soon!
It?s laborious to search out knowledgeable people on this subject, however you sound like you already know what you?re talking about! Thanks
of course like your website but you have to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I to find it very troublesome to tell the truth on the other hand I will definitely come again again.
[url=http://levothyroxine.best/]price of synthroid in canada[/url]
Another issue is that video gaming has become one of the all-time biggest forms of recreation for people spanning various ages. Kids enjoy video games, and also adults do, too. The particular XBox 360 is among the favorite video games systems for people who love to have hundreds of activities available to them, along with who like to experiment with live with other folks all over the world. Thanks for sharing your thinking.
Thank you for the sensible critique. Me and my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more from this post. I am very glad to see such excellent information being shared freely out there.
I have observed that online education is getting well-liked because getting your degree online has turned into a popular choice for many people. Many people have not really had a chance to attend a traditional college or university although seek the increased earning potential and a better job that a Bachelor’s Degree gives. Still other people might have a degree in one training but would like to pursue a thing they now have an interest in.
Thank you, I’ve recently been searching for information approximately this subject for a long time and yours is the greatest I have found out till now. But, what about the bottom line? Are you certain concerning the supply?
It?s arduous to find knowledgeable folks on this topic, however you sound like you understand what you?re speaking about! Thanks
Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
You ought to take part in a contest for one of the finest websites online. I’m going to recommend this web site!
I have been absent for a while, but now I remember why I used to love this website. Thanks , I will try and check back more frequently. How frequently you update your web site?
I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.
I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.
I appreciate you sharing this blog post. Thanks Again. Cool.
I believe that is one of the such a lot vital info for me. And i’m glad reading your article. However wanna remark on some general things, The website style is ideal, the articles is actually excellent : D. Excellent job, cheers
Try to slowly read the articles on this website, don’t just comment, I think the posts on this page are very helpful, because I understand the intent of the author of this article.
[url=http://zithromax.company/]azithromycin 500mg buy online[/url]
Pretty! This has been a really wonderful post. Many thanks for providing these details.
This was beautiful Admin. Thank you for your reflections.
An interesting dialogue is worth comment. I feel that you must write more on this matter, it won’t be a taboo topic but typically persons are not enough to speak on such topics. To the next. Cheers
In these days of austerity as well as relative panic about running into debt, many individuals balk contrary to the idea of having a credit card to make acquisition of merchandise and also pay for any occasion, preferring, instead to rely on a tried and also trusted way of making transaction – hard cash. However, in case you have the cash available to make the purchase in full, then, paradoxically, that is the best time to be able to use the credit card for several reasons.
Pretty! This has been a really wonderful post. Many thanks for providing these details.
Excellent website. Plenty of helpful info here. I?m sending it to a few friends ans additionally sharing in delicious. And obviously, thank you in your effort!
Thanks for the tips you have contributed here. Yet another thing I would like to mention is that pc memory needs generally rise along with other advances in the engineering. For instance, if new generations of processors are made in the market, there is certainly usually an equivalent increase in the dimensions calls for of all computer memory and also hard drive space. This is because the application operated by simply these processors will inevitably boost in power to use the new engineering.
I will right away snatch your rss as I can’t in finding your email subscription link or e-newsletter service. Do you’ve any? Please allow me recognise in order that I may just subscribe. Thanks.
Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely wonderful. I really like what you’ve acquired here, certainly like what you’re stating and the way in which you say it. You make it entertaining and you still take care of to keep it sensible. I can not wait to read much more from you. This is really a wonderful website.
One thing I have actually noticed is the fact that there are plenty of fallacies regarding the lenders intentions while talking about foreclosed. One misconception in particular would be the fact the bank would like your house. The financial institution wants your hard earned dollars, not the house. They want the funds they gave you having interest. Staying away from the bank will draw a foreclosed realization. Thanks for your post.
you’re actually a just right webmaster. The website loading velocity is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterwork. you have done a wonderful activity in this topic!
Thanks for the sensible critique. Me & my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post. I am very glad to see such magnificent information being shared freely out there.
[url=https://clonidine.foundation/]clonidine tablets uk[/url]
One other important area is that if you are an elderly person, travel insurance pertaining to pensioners is something that is important to really think about. The more aged you are, the harder at risk you happen to be for getting something poor happen to you while in another country. If you are not necessarily covered by a few comprehensive insurance policy, you could have many serious complications. Thanks for sharing your good tips on this weblog.
[url=https://sildalis.lol/]sildalis tablets[/url]
After examine just a few of the weblog posts on your web site now, and I truly like your manner of blogging. I bookmarked it to my bookmark website listing and can be checking back soon. Pls try my website as well and let me know what you think.
There are some attention-grabbing deadlines in this article however I don?t know if I see all of them heart to heart. There’s some validity but I’ll take maintain opinion until I look into it further. Good article , thanks and we wish extra! Added to FeedBurner as properly
[url=https://finpecia.company/]propecia 5 mg[/url]
I’ve come across that right now, more and more people will be attracted to video cameras and the field of images. However, really being a photographer, you have to first invest so much time period deciding the exact model of camera to buy and moving store to store just so you may buy the most economical camera of the trademark you have decided to pick out. But it isn’t going to end right now there. You also have to contemplate whether you should purchase a digital dslr camera extended warranty. Thanks a bunch for the good suggestions I gathered from your site.
Together with almost everything that seems to be developing throughout this specific area, a significant percentage of points of view happen to be relatively radical. Having said that, I beg your pardon, because I can not give credence to your entire strategy, all be it stimulating none the less. It would seem to me that your comments are not entirely rationalized and in reality you are generally your self not entirely convinced of the argument. In any event I did appreciate reading through it.
It is indeed my belief that mesothelioma can be the most dangerous cancer. It’s got unusual qualities. The more I look at it the greater I am persuaded it does not work like a true solid tissues cancer. When mesothelioma is actually a rogue virus-like infection, then there is the chance of developing a vaccine plus offering vaccination for asbestos exposed people who are at high risk regarding developing long term asbestos relevant malignancies. Thanks for expressing your ideas about this important health issue.