鐧藉珫鍏氳鎼炴噦Serverless

Posted 鍓嶇澶х彮杞?/a> 鐧藉

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鐧藉珫鍏氳鎼炴噦Serverless相关的知识,希望对你有一定的参考价值。

馃敟鐧藉珫鍏氳鎼炴噦Serverless

涓€銆?020骞寸殑鏈嶅姟绔潻鍛?/span>

浣犵煡閬撳悧鎴戜滑澶╁ぉ浣跨敤鐨勭煶澧ㄦ枃妗c€佸井鍗氥€佽姃鏋淭V閮藉湪鍏ㄩ儴鎴栭儴鍒嗕娇鐢⊿erverless鎶€鏈€?/p>

鍏跺疄鐭ヤ箮涔熸槸鐢ㄧ殑leancloud銆?/p>

鎶€鏈殑鍙戝睍浣挎垜浠湁鍙兘涓嶈姳涓€鍒嗛挶銆佷笉闆囦剑涓€涓彧寮哄ぇ鐨勫悗绔洟闃熶篃鍙互寤虹珛涓€涓缇庡ぇ鍘傜殑楂樺彲鐢ㄦ湇鍔$銆?/p>

20201105135136_13662

1. 鐭冲ⅷ鏂囨。妗堜緥

image-20201114163333099

鐭冲ⅷ鏂囨。骞朵笉鏄娇鐢ㄤ簡甯歌鎰忎箟涓婄殑鏈嶅姟鍣ㄦ垨鑰呭井鏈嶅姟鏋舵瀯鎵€鏀寔鐨勩€傝€屾槸閫氳繃Serverless鏋舵瀯鐢熼暱鍦ㄤ簯绔殑銆?/p>

闃块噷浜戝嚱鏁拌绠楋紙Function Compute锛変綔涓轰腑鍥藉彂灞曡緝鏃╃殑浜嬩欢椹卞姩鐨勫叏鎵樼璁$畻鏈嶅姟锛屽凡缁忚惤鍦颁簡鐮侀殕绉戞妧銆佸井鍗氥€佽姃鏋?TV銆佺煶澧ㄦ枃妗g瓑澶氫釜瀹㈡埛銆傛垜浠竴璧风湅鐪嬩腑鍥界殑澶撮儴浜掕仈缃戜紒涓氭槸濡備綍鍒╃敤鍑芥暟璁$畻鍔╁姏涓氬姟鍙戝睍鐨勩€?/p>

瀹㈡埛闇€姹?/strong>

澶氫綅鐭冲ⅷ鏂囨。鐨勭敤鎴峰湪鍚屼竴鏂囨。 / 琛ㄦ牸涓婂崗鍚岀紪杈戞椂锛屾湁鍙兘瀵瑰悓涓€鍐呭杩涜浜嗕慨鏀癸紝浜х敓鍐茬獊銆傜煶澧ㄦ枃妗i渶瑕佸疄鐜颁竴濂楁湇鍔℃潵瀹炴椂澶勭悊鏂囨。缂栬緫鍐茬獊锛屽苟鑳藉湪鍚堢悊鐨勬垚鏈笅骞虫粦澶勭悊宄板€艰礋杞姐€?/p>

瑙e喅鏂规

灏嗘枃妗e疄鏃跺崗浣滅瓑璁$畻瀵嗛泦鍨嬬殑閫昏緫瀹炵幇涓哄嚱鏁帮紝閫氳繃 HTTP 璇锋眰瑙﹀彂鍑芥暟鎵ц銆?/p>

浣跨敤鏁堟灉

鍊熷姪鍑芥暟璁$畻姣绾у埆鐨勮祫婧愪几缂╄兘鍔涳紝瑙e喅浜嗘棭鏅氶珮宄扮敤閲忕獊澧炵殑璁$畻璧勬簮鎵╁闂锛屽苟鑺傜渷浜?58% 鐨勬湇鍔″櫒鎴愭湰銆傜敱浜庝笉鐢ㄥ啀鑰冭檻 CPU 瀵嗛泦鍨嬭绠楃殑璐熻浇鍧囪 闂锛屽ぇ澶ф彁楂樹簡寮€鍙戞晥鐜囧拰杩涚▼绋冲畾鎬с€?/p>

2. Nodersurvey骞村害鎶ュ憡

Nodersurvey鏄敱闃块噷宸村反銆佽吘璁瓑鍏徃棰嗗厛鐨凬ode骞村害瓒嬪娍鎶ュ憡銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114163806906

https://nodersurvey.github.io/reporters/

鍦ㄦ湭鏉ュ叧閿瘝涓璖erverless鎴愪负鏈€琚叧娉ㄧ殑璇濋銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114163949004

浜屻€佷粈涔堟槸Serverless

鏈嶅姟鍣ㄧ鏈嶅姟灏辨槸涓烘垜浠彁渚涚ǔ瀹氬彲闈犵殑鏈嶅姟锛?/p>

鍙﹀杩樿鍑忎綆鎴愭湰锛屾彁楂樻晥鐜囥€?/p>

姣斿锛?/p>

  • 鍔ㄦ€佹墿瀹?- 涓嶉渶瑕佺殑鏈哄櫒鍙婃椂鍏虫帀
  • 鍑忎綆鎴愭湰 - 浜哄憳瓒婂皯瓒婂ソ 鑳界鐨勫氨涓嶈涔?

涓轰簡杈惧埌杩欎釜鐩殑锛屽悗绔殑鐩殑涓嶆柇鐨勫崌绾ф紨杩涖€?/p>

1. 浜掕仈缃戞灦鏋勬紨杩?/span>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201113195038838

浜掕仈缃戞灦鏋勭殑婕旇繘澶ф鍒嗕负浠ヤ笅涓変釜闃舵锛?/p>

  • 鍗曚綋鏃朵唬
  • 寰湇鍔℃椂浠?
  • Serverless

1.1 鍗曚綋鏃朵唬

鐩稿綋浜庢墍鏈夊簲鐢ㄩ兘瀹夎鍦ㄤ竴鍙版湇鍔″櫒涓瘮濡傛渶鏃╃殑缃戞槗鍜屾悳鐙愪篃璁搁兘鏄粠涓€鍙癠nix涓绘満寮€濮嬬殑銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114175637281
鐧藉珫鍏氳鎼炴噦Serverless
image-20201114175653255

杩欎釜鏈夌偣鍍忔渶鍘熷鐨勮鏈烘父鎴?浠庣‖浠?+ 杞欢 + 鎿嶄綔绯荤粺閮芥槸涓€涓叕鍙稿仛鐨勩€?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114180342761

1.2 寰湇鍔℃椂浠?/span>

寰湇鍔℃灦鏋勬槸涓€绉嶆灦鏋勬蹇碉紝鏃ㄥ湪閫氳繃灏嗗姛鑳藉垎瑙e埌鍚勪釜绂绘暎鐨勬湇鍔′腑浠ュ疄鐜板瑙e喅鏂规鐨勮В鑰︺€傚畠鐨勪富瑕佷綔鐢ㄦ槸灏嗗姛鑳藉垎瑙e埌绂绘暎鐨勫悇涓湇鍔″綋涓紝浠庤€岄檷浣庣郴缁熺殑鑰﹀悎鎬э紝骞舵彁渚涙洿鍔犵伒娲荤殑鏈嶅姟鏀寔銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114175756417

绠€鍗曠殑璁插氨鏄皢澶嶆潅鐨勪簨鎯呮媶寮€鍋氥€傞渶瑕佹湁搴炲ぇ鐨勫洟闃熴€?/p>

杩欎釜鏈夌偣鍍忚吘璁殑鐜嬭€呰崳鑰€鍥㈤槦銆備粠骞寸粓濂栫殑鏁伴浣犲氨鍙互鐪嬪埌浠栦滑缁勭粐鏋舵瀯鐨勫簽澶?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114181335817
鐧藉珫鍏氳鎼炴噦Serverless
image-20201114180648947
鐧藉珫鍏氳鎼炴噦Serverless
image-20201114181005637

1.3 Serverless

鏃犳湇鍔″櫒鏋舵瀯锛屽苟涓嶆槸璇翠笉闇€瑕佹湇鍔″櫒锛岃€屾槸鎸囩敱绗笁鏂逛簯璁$畻渚涘簲鍟嗕互鏈嶅姟鐨勬柟寮忎负寮€鍙戣€呮彁渚涙墍闇€鍔熻兘锛屼緥濡傛暟鎹簱銆佹秷鎭紝浠ュ強韬唤楠岃瘉绛夈€傚畠鐨勬牳蹇冩€濇兂鏄寮€鍙戣€呬笓娉ㄦ瀯寤哄拰杩愯搴旂敤锛岃€屾棤闇€绠$悊鏈嶅姟鍣ㄣ€?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201113201539279

杩欑浉褰撲簬寮€鍙戞父鎴忔垜浠彧闇€瑕佷笓娉ㄤ簬绋嬪簭閫昏緫灏卞ソ浜嗐€傚叾浠栧叏閮ㄥ鍖呫€?/p>

璁╂垜鎯宠捣浜嗚摑娲炲紑鍙戝悆楦$殑鏃跺€欙紝鍩烘湰涓?D妯″瀷銆佹父鎴忓紩鎿庛€侀兘鏄粠娓告垙甯傚満璐拱鐒跺悗缁勮銆傛暣涓摑娲炵殑缁勭粐瑙勬ā骞朵笉澶с€?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114181442630

2. 浜戞湇鍔℃灦鏋勬紨杩?/span>

涓轰簡杈惧埌璁╂垜浠殑鏈嶅姟璧勬簮鍙互杈惧埌鑷姩浼哥缉鐨勭洰鐨勶紝鐩墠缁濆ぇ澶氭暟鏁板簲鐢ㄩ兘鏄娇鐢ㄤ簯鎶€鏈畬鎴愮殑銆?/p>

![image-20201114184313929](/Users/xiaran/Library/Application Support/typora-user-images/image-20201114184313929.png)

澶у鐭ラ亾鍚楋紵鍏跺疄鍚庣绋嬪簭鍛樼紪鍐欎唬鐮佺殑姣斾緥涓嶈冻鐧惧垎涔嬩笁鍗侀偅涔堝叾浣欐椂闂撮兘鍦ㄥ共浠€涔堬紵

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114184459573

闅忕潃浜戣绠楁椂浠g殑鍒版潵浼犵粺鐨処T鏋舵瀯鍜岃繍缁存柟寮忓甫鏉ヤ簡寰堝鏂扮殑鎶€鏈€佸叾涓寘鎷櫄鎷熸満銆佸鍣ㄣ€佸井鏈嶅姟銆?/p>

杩欎簺鎶€鏈负浜嗕竴涓嬬洰鐨勶細

  • 鍑忎綆鎴愭湰
  • 鎻愰珮鏁堢巼
鐧藉珫鍏氳鎼炴噦Serverless
image-20201114164756709

濡備綍鑳借揪鍒拌繖涓洰鐨勫憿锛熺瓟妗堝簲璇ユ槸灏介噺鍑忓皯涓氬姟鐢ㄦ埛鐨勮繍缁村拰IT鏋舵瀯宸ヤ綔閲忥紝涓撴敞鏋勫缓鑷繁鐨勪笟鍔″簲鐢紝

鍓╀笅鐨勪氦缁欎簯鏈嶅姟鍟嗐€?/p>

鍓嶇寮€鍙?+ 鍚庣寮€鍙?        =>         浜戝紑鍙?  +   绔紑鍙?/p>

2.1 BareMetal 瑁搁噾灞炴湇鍔″櫒

鍙互璁や负涓撳睘鐗╃悊鏈嶅姟鍣ㄧ璧佷笟鍔°€傝繖鏍峰氨涓嶉渶瑕佺璧佹満鎴裤€佹媺鍏夌紗銆佽鏈嶅姟鍣ㄤ簡銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114170000055

2.2 Virtual machines  铏氭嫙鏈烘湇鍔?/span>

鐢ㄨ櫄鎷熸満浠f浛瀹炰綋鏈轰富瑕佹槸鍏嶅幓浜嗗畨瑁呮搷浣滅郴缁熷拰鍩虹杞欢鐨勭儲鎭笺€?/p>

鎴戜滑鍙渶瑕佺璧佽櫄鎷熸満灏卞彲浠ヤ簡銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114170159930

2.3 Container 瀹瑰櫒鍖栭儴缃?/span>

鐩稿綋浜庤交閲忓寲铏氭嫙鏈猴紝涓昏鏄互Docker鎶€鏈负浠h〃銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114170358770

2.4 Serverless

鏃犳湇鍔″櫒鏋舵瀯锛屽苟涓嶆槸璇翠笉闇€瑕佹湇鍔″櫒锛岃€屾槸鎸囩敱绗笁鏂逛簯璁$畻渚涘簲鍟嗕互鏈嶅姟鐨勬柟寮忎负寮€鍙戣€呮彁渚涙墍闇€鍔熻兘锛屼緥濡傛暟鎹簱銆佹秷鎭紝浠ュ強韬唤楠岃瘉绛夈€傚畠鐨勬牳蹇冩€濇兂鏄寮€鍙戣€呬笓娉ㄦ瀯寤哄拰杩愯搴旂敤锛岃€屾棤闇€绠$悊鏈嶅姟鍣ㄣ€?/p>

绠€鍗曠殑璇村彧闇€瑕佷笂浼犱唬鐮佸氨濂戒簡銆?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201114170559361

鏈€缁堢殑缁撹灏辨槸



BareMetal Virtual machines Container Serverless
鍑芥暟 涓氬姟浠g爜 鉁?/td> 鉁?/td> 鉁?/td> 鉁?/td>
Layer eggjs/spring 鉁?/td> 鉁?/td> 鉁?/td> 鉁?/td>
杩愯鏃?/td> Node/Java/Python 鉁?/td> 鉁?/td> 鉁?/td>
鍩虹璁炬柦 Kubeless 鉁?/td> 鉁?/td>

纭欢璁惧 缃戠粶銆佺‖浠?/td> 鉁?/td>


鍙互鐪嬪埌鐩墠涓烘鐨勬渶浼樿В灏辨槸Serverless銆?/p>

涓夈€丼erverless鏋舵瀯

鏈変汉璇达紝

缂栫▼ = 绠楁硶 + 鏁版嵁缁撴瀯

閭d箞锛?/p>

搴旂敤 = 閫昏緫 + 瀛樺偍 锛?/p>

鎴戜滑鍙互灏嗗簲鐢ㄥ垎涓烘棤鐘舵€佺殑涓氬姟閫昏緫 鍜?鐘舵€佹湇鍔$粍鎴愩€?/p>

Serverless(搴旂敤) =  Faas锛堜笟鍔¢€昏緫锛?+ Baas 锛堢姸鎬佷繚鎸侊級

濡傛灉鎯宠鍦⊿erverless涓婇潰鏋勫缓涓€涓畬鏁寸殑鏈嶅姟鎴戜滑灏遍渶瑕佸皢绋嬪簭鍒嗚В涓鸿繖涓や釜閮ㄥ垎銆?/p>

鎴戜滑浠ュ皬绋嬪簭涓轰緥

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115121039062

1. Faas

Faas鍗矲unction as a service 锛屾垜浠竴鑸細鍙仛鍑芥暟璁$畻锛屾垨鑰呮槸鍑芥暟杩愯鏈嶅姟銆傚叾瀹炲氨鏄皢浜戝钩鍙颁笂鐨勮绠楅噺鎵撳寘杞崠銆傚彧闇€瑕佺敤鎴蜂笂浼犲嚱鏁板氨濂姐€?/p>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115101824421

鐗圭偣

  • Stateless 鏃犵姸鎬?/p>

  • 浠g爜 + 渚濊禆閰嶇疆

妗堜緥

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115101904379
  • 浜氶┈閫?AWS lamabda

  • 璋锋瓕 Google Cloud Functions

  • 闃块噷浜?Aliyun FC

  • 鑵捐浜?SCF - Serverless Cloud Function https://serverless.cloud.tencent.com/start?c=ft

鍙﹀濡傛灉瑕佸嚱鏁板彲浠ラ€氳繃Http璇锋眰璋冪敤杩橀渶瑕佺綉鍏?/p>

  • AWS API缃戝叧

2. Baas

Bass鍗矪ackend as a Service, 鍚庣鍗虫湇鍔$殑鎰忔€濇槸璇存垜浠彲浠ョ鐢ㄨ繙绋嬬殑鍚庣鏈嶅姟鑰屾棤闇€鑷繁缂栧啓銆傝繖閲岄潰鐢ㄧ殑姣旇緝澶氱殑灏辨槸鐘舵€佷繚鎸佹湇鍔★紝姣斿绫籑ongoDB杩欐牱鐨勫瓨鍌ㄦ湇鍔°€侀壌鏉冩湇鍔$瓑銆?/p>

鐗圭偣

  • 鏈夌姸鎬?
  • 鎻愪緵鏈嶅姟API

鏈嶅姟鍟?/span>

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115102026641
- LeanCloud
  • Firebase

鍥涖€佸簲鐢ㄥ満鏅?/span>

鏈€鍚庢垜浠璇磗erverless鐨勫簲鐢ㄥ満鏅€?/p>

棣栧厛鎴戣涓烘墍鏈夋兂鍒涗笟鐨勬湅鍙嬪彲浠ヨ€冭檻鐩存帴灏嗛」鐩斁鍦⊿erverless涓婇潰銆?/p>

1. 鍒涗笟椤圭洰

浠ヤ竴涓猼oC鐨勯」鐩负浜嗗湪鑾峰緱铻嶈祫鍓嶄綘鐨勯」鐩敤鎴锋暟閲忎笉浼氬緢澶氥€傚強鏃舵湁绐佸彂鎬х殑鍦烘櫙涔熷彲浠ュ緢瀹规槗鍔ㄦ€佹墿瀹广€傚叧閿槸鍙互鏈夋晥鐨勫墿涓嬩竴绗斿悗绔汉鍛樼殑璐圭敤銆傝鐭ラ亾濡傛灉鎵句竴涓兘澶熷畬鏁存惌寤哄井鏈嶅姟鏋舵瀯鐨勫悗绔洟闃熶竴瀹氭槸涓€涓笉鑿茬殑鏁板瓧銆傝€屼笖鍥㈤槦鏄惁闈犺氨鍜岄珮鏁堜篃鏄竴涓棶棰橈紝缁欓」鐩殑鎺ㄨ繘甯︽潵寰堝涓嶇‘瀹氬洜绱犮€?/p>

绛夋湁浜嗘姇璧勶紝鍐嶈銆?/p>

鐢氳嚦浣犻兘涓嶇敤鑺遍挶

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115132011266

閾炬帴鍦ㄦ

https://cloud.tencent.com/act/pro/serverless-newuser?from=12888

鐧藉珫鍏氳鎼炴噦Serverless
image-20201115132131455

2. 浜嬩欢璇锋眰鍦烘櫙

  • 瀹氬埗鍥剧墖
  • 鐗╄仈缃?
  • 鍩嬬偣璁板綍
  • 瀹氭椂鑴氭湰

3. 楂樿繍缁存垚鏈満鏅?/span>

  • 缃戦〉鎴浘 - pupteer鎴浘 + SSR娓叉煋
  • 澶ф暟鎹绠?

4.娴侀噺绐佸彂鍦烘櫙

  • 娲诲姩銆佸ぇ淇?
  • 瑙勫緥鍦烘櫙 锛堝鍗?姣忓ぉ鏈夋槑鏄剧殑宄拌胺锛?

骞磋交浜鸿璁叉寰凤紒锛侊紒鐐硅禐銆?code>鍏虫敞銆?code>鏀惰棌閮借瀹夋帓璧锋潵锛侊紒锛?/span>

鎴睆2020-11-14 涓嬪崍10.38.43

img
  • 杩欐槸鎴戜滑鑺辨灉灞卞墠绔洟闃熺殑寮€婧愰」鐩?element3
  • 涓€涓敮鎸?vue3 鐨勫墠绔粍浠跺簱


以上是关于鐧藉珫鍏氳鎼炴噦Serverless的主要内容,如果未能解决你的问题,请参考以下文章

瓒呰缁嗛粦鑻规灉瀹夎鏁欑▼锛屽皬鐧藉彲鐢紒

銆愬皬鐧藉涔燙++ 鏁欑▼銆戜笁銆丆++鐢ㄦ埛杈撳叆銆佸垽鏂鍙ュ拰switch

Java浠庡皬鐧藉埌鍏ラ棬锛孌ay4锛堟暟缁勶級

銆愬皬鐧藉涔燙++ 鏁欑▼銆戝叚銆丆++鍐呯疆鍑芥暟鍜屽嚱鏁颁紶鍙?/h1>

一行代码秒上云Serverless六步构建全栈网站