paint-brush
IziCwangciso zokwenyani zeHlabathi zoLwahlulo lweeProjekthi ze-Fintechnge@ymatigoosa
67,452 ukufunda
67,452 ukufunda

IziCwangciso zokwenyani zeHlabathi zoLwahlulo lweeProjekthi ze-Fintech

nge Dmitrii Pakhomov
Dmitrii Pakhomov HackerNoon profile picture

Dmitrii Pakhomov

@ymatigoosa

10 yeas of experience of building mission critical Fintech system...

8 imiz read2024/06/26
Read on Terminal Reader
Read this story in a terminal
Print this story
Read this story w/o Javascript
Read this story w/o Javascript
tldt arrow
xh-flagXH
Funda eli bali ngesiXhosa!
en-flagEN
Read this story in the original language, English!
ln-flagLN
Tanga lisolo oyo na lingala!
lo-flagLO
ອ່ານເລື່ອງນີ້ເປັນພາສາລາວ!
ps-flagPS
دا کیسه په پښتو ژبه ولولئ!
lt-flagLT
Skaitykite šią istoriją lietuvių kalba!
hr-flagHR
Pročitajte ovu priču na hrvatskom!
lv-flagLV
Izlasi šo stāstu latviešu valodā!
ht-flagHT
Li istwa sa a an kreyòl ayisyen!
hu-flagHU
Olvasd el ezt a történetet magyarul!
hy-flagHY
Կարդացեք այս պատմությունը հայերեն։
uk-flagUK
Читайте цю історію українською!
mg-flagMG
Vakio amin'ny teny malagasy ity tantara ity!
More
XH

Inde kakhulu; Ukufunda

Ukomelela kwisoftware kubhekisa ekukwazini kwesicelo ukuqhubeka nokusebenza kakuhle nangokuthembekileyo, naxa kukho imiba engalindelekanga okanye ukusilela.

People Mentioned

Mention Thumbnail

Circuit Breaker

@circuitbreaker

Companies Mentioned

Mention Thumbnail
effect
Mention Thumbnail
Even
featured image - IziCwangciso zokwenyani zeHlabathi zoLwahlulo lweeProjekthi ze-Fintech
Dmitrii Pakhomov HackerNoon profile picture
Dmitrii Pakhomov

Dmitrii Pakhomov

@ymatigoosa

10 yeas of experience of building mission critical Fintech system handling extremely high load

0-item

STORY’S CREDIBILITY

Guide

Guide

Walkthroughs, tutorials, guides, and tips. This story will teach you how to do something new or how to do something better.

Ukomelela kwisoftware kubhekisa ekukwazini kwesicelo ukuqhubeka nokusebenza kakuhle nangokuthembekileyo, naxa kukho imiba engalindelekanga okanye ukusilela. Kwiiprojekthi zeFintech ukomelela kubaluleke kakhulu ngenxa yezizathu ezininzi. Okokuqala, iinkampani zibophelelekile ukuba zihlangabezane neemfuno zolawulo kwaye abalawuli bezemali bagxininisa ukomelela ekusebenzeni ukugcina uzinzo ngaphakathi kwenkqubo. Ngaphezu koko, ukwanda kwezixhobo zedijithali kunye nokuthembela kubaboneleli beenkonzo zomntu wesithathu kuveza amashishini eFintech kwizoyikiso zokhuseleko ezongeziweyo. Ukomelela kwakhona kunceda ukunciphisa umngcipheko wokungabikho okubangelwa zizinto ezahlukeneyo ezinje ngezoyikiso ze-cyber, ubhubhane, okanye iminyhadala ye-geopolitical, ukukhusela imisebenzi engundoqo yeshishini kunye nempahla ebalulekileyo.

Ngeepateni zokomelela, siqonda isethi yeendlela ezilungileyo kunye nezicwangciso eziyilelwe ukuqinisekisa ukuba isoftware inokumelana nokuphazamiseka kwaye igcine imisebenzi yayo. Ezi patheni zisebenza njengeminatha yokhuseleko, ibonelela ngeendlela zokusingatha iimpazamo, ukulawula umthwalo, kunye nokubuyisela ekuphumeleleni, ngaloo ndlela iqinisekisa ukuba izicelo zihlala zomelele kwaye zixhomekeke phantsi kweemeko ezimbi.


Ezona zicwangciso zixhaphakileyo zokomelela zibandakanya i-bulkhead, i-cache, i-fallback, ukuzama kwakhona, kunye ne-circuit breaker. Kweli nqaku, ndiza kuxoxa ngazo ngokubanzi, kunye nemizekelo yeengxaki ezinokunceda ukuzisombulula.

Bulkhead

image


Makhe siqwalasele le setingi ingasentla. Sinesicelo esiqhelekileyo esinee-backends ezininzi emva kwethu ukuze sifumane idatha evela. Kukho abaxhasi abaninzi beHTTP abaqhagamshelwe kwezi mva. Kuyavela ukuba bonke babelana ngedama lonxibelelwano olufanayo! Kwaye nezinye izixhobo ezifana ne-CPU kunye ne-RAM.


Kuya kwenzeka ntoni, ukuba omnye wababuyela ngasemva ufumana uhlobo lweengxaki ezikhokelela kwisicelo esiphezulu sokubambezeleka? Ngenxa yexesha eliphezulu lokuphendula, yonke indawo yokudibanisa iya kuhlala ngokupheleleyo ngezicelo ezilindele iimpendulo ezivela kwi-backend1. Ngenxa yoko, izicelo ezijoliswe kwi-backend2 enempilo kunye ne-backend3 aziyi kukwazi ukuqhubeka ngenxa yokuba i-pool iphelile. Oku kuthetha ukuba ukusilela kwenye yee-backends zethu kunokubangela ukusilela kulo lonke usetyenziso. Ngokufanelekileyo, sifuna kuphela usebenziso oluyanyaniswa ne-backend engaphumeleliyo ukufumana ukuthotywa, ngelixa sonke isicelo siqhubeka nokusebenza ngokwesiqhelo.


Yintoni iPatheni yeBulkhead?


Igama elithi, ipateni yeBulkhead, lisuka kulwakhiwo lweenqanawa, libandakanya ukwenza amacandelo ahlukeneyo abucala ngaphakathi kwenqanawa. Ukuba ukuvuza kwenzeka kwelinye igumbi, lizalisa ngamanzi, kodwa amanye amacandelo ahlala engachaphazeleki. Oku kwahlula kuthintela inqanawa yonke ekuzikeni ngenxa yokwaphuka okukodwa.

Singayisebenzisa njani iPatheni yeBulkhead ukulungisa le Ngxaki?

image



Ipatheni yeBulkhead ingasetyenziselwa ukwahlula iindidi ezahlukeneyo zezibonelelo ngaphakathi kwesicelo, ukuthintela ukungaphumeleli kwinxalenye enye ekuchaphazeleni inkqubo yonke. Nantsi indlela esinokuyisebenzisa ngayo kwingxaki yethu:


  1. Ukwahlula amachibi oQhagamshelwano Sinokwenza amachibi okudibanisa ahlukeneyo kwi-backend nganye (i-backend1, i-backend2, i-backend3). Oku kuqinisekisa ukuba ukuba i-backend1 ihlangabezana namaxesha aphezulu okuphendula okanye ukungaphumeleli, i-pool yayo yokudibanisa iya kuphelelwa ngokuzimeleyo, ishiya amachibi okudibanisa i-backend2 kunye ne-backend3 engathintekiyo. Oku kwahlula kuvumela abasemva abasempilweni ukuba baqhubeke nokuqhuba izicelo ngokuqhelekileyo.
  2. Ukunciphisa izibonelelo zeMisebenzi yaseMvalweni Ngokusebenzisa i-Bulkheads, sinokubeka izibonelelo ezithile zemisebenzi yangasemva, njengokusetyenzwa kwebhetshi okanye imisebenzi ecwangcisiweyo. Oku kuthintela le misebenzi ekusebenziseni izixhobo eziyimfuneko kwimisebenzi yexesha lokwenyani. Umzekelo, sinokulinciphisa inani lemisonto okanye ukusetyenziswa kwe-CPU enikezelwe kwimisebenzi yangasemva, siqinisekisa ukuba izixhobo ezaneleyo zihlala zikhona ukuze kusingathwe izicelo ezingenayo.
  3. Ukumisela izithintelo kwizicelo ezingenayo i-Bulkheads nayo ingasetyenziselwa ukunciphisa inani lezicelo ezingenayo kwiindawo ezahlukeneyo zesicelo. Umzekelo, sinokubeka umda omkhulu kwinani lezicelo ezinokusetyenzwa ngaxeshanye kwinkonzo nganye enyukayo. Oku kuthintela nayiphi na i-backend enye ekugqithiseni inkqubo kwaye iqinisekisa ukuba ezinye ii-backends zingaqhubeka nokusebenza nokuba umntu uphantsi komthwalo onzima.

Сache

image


Masithi iisistim zethu zasemva zinethuba eliphantsi lokudibana neempazamo nganye. Nangona kunjalo, xa usebenziso lubandakanya ukubuza zonke ezi zinto zingasemva ngokunxuseneyo, nganye inokubuyisela impazamo ngokuzimeleyo. Ngenxa yokuba ezi mpazamo zisenzeka ngokuzimeleyo, amathuba eempazamo kwisicelo sethu angaphezulu kwempazamo yaso nasiphi na isiphene esinye. Imposiso eyongezelekayo inokubalwa kusetyenziswa ifomula P_total=1−(1−p)^n, apho u-n linani leenkqubo zomva.


Umzekelo, ukuba sinama-backend alishumi, nganye inemposiso enokwenzeka ye-p=0.001 (ehambelana ne-SLA ka-99.9%), imposiso enokwenzeka enokwenzeka yile:


P_itotali=1−(1−0.001)^10=0.009955


Oku kuthetha ukuba i-SLA yethu edibeneyo yehla ukuya malunga ne-99%, ebonisa ukuba ukuthembeka kukonke kuncipha njani xa ubuza ii-backends ezininzi ngaxeshanye. Ukunciphisa lo mba, sinokusebenzisa i-cache ekwimemori.

Singayisombulula njani nge-cache ekwimemori

image


I-cache ekwimemori isebenza njengesithinteli sedatha esinesantya esiphezulu, igcina idatha efikelelwa rhoqo kwaye isusa imfuneko yokuyilanda kwimithombo enokucotha ngalo lonke ixesha. Ekubeni ii-cache ezigcinwe kwi-memory zine-0% ithuba lempazamo xa kuthelekiswa nokulanda idatha kwinethiwekhi, zonyusa kakhulu ukuthembeka kwesicelo sethu. Ngaphezu koko, i-caching inciphisa itrafikhi yenethiwekhi, inciphisa ngakumbi ithuba leempazamo. Ngenxa yoko, ngokusebenzisa i-cache yememori, sinokufikelela nakwinqanaba lempazamo elisezantsi kwisicelo sethu xa kuthelekiswa neenkqubo zethu zangasemva. Ukongezelela, ii-cache ze-memory zinika ukubuyiswa kwedatha ngokukhawuleza kunokulanda okusekwe kwinethiwekhi, ngaloo ndlela kuncitshiswe i-latency yesicelo-inzuzo ephawulekayo.

I-cache yememori: Ii-cache ezenzelwe wena

Kwidatha eyenzelwe wena, efana neeprofayili zabasebenzisi okanye iingcebiso, ukusebenzisa i-cache yememori kunokusebenza kakhulu. Kodwa kufuneka siqinisekise ukuba zonke izicelo ezisuka kumsebenzisi zisoloko zisiya kumzekelo wesicelo ofanayo ukuze sisebenzise idatha egcinwe kuyo, nto leyo efuna iiseshini ezincangathi. Ukuphumeza iiseshini ezincangathi kunokuba ngumngeni, kodwa kule meko, asidingi zixhobo zintsonkothileyo. Ukulungelelaniswa kwakhona kwetrafikhi encinci kwamkelekile, ngoko ke i-algorithm ezinzileyo yokulinganisa umthwalo njenge-hashing engaguqukiyo iya kwanela.


Ngaphezu koko, xa kukho ukungaphumeleli kwe-node, i-hashing engaguqukiyo iqinisekisa ukuba kuphela abasebenzisi abanxulumene ne-node engaphumeleliyo baphinde balungelelanise, ukunciphisa ukuphazamiseka kwinkqubo. Le ndlela yokwenza lula ulawulo lwee-cache ezenzelwe wena kwaye yongeza uzinzo kunye nokusebenza kosetyenziso lwethu.

I-cache yememori: ukuphindaphindwa kwedatha yendawo


image


Ukuba idatha esizimisele ukuyigcina ibalulekile kwaye isetyenziswa kwisicelo ngasinye esiphathwa yinkqubo yethu, njengemigaqo-nkqubo yofikelelo, izicwangciso zobhaliso, okanye amanye amaziko abalulekileyo kwindawo yethu—umthombo wale datha unokubangela ukusilela kwinkqubo yethu. Ukujongana nalo mngeni, enye indlela kukuphinda-phinda ngokupheleleyo le datha kwinkumbulo yesicelo sethu.


Kule meko, ukuba umthamo wedatha kumthombo uyalawuleka, sinokuqalisa inkqubo ngokukhuphela i-snapshot yale datha ekuqaleni kwesicelo sethu. Emva koko, sinokufumana uhlaziyo lweziganeko zokuqinisekisa ukuba idatha egciniweyo ihlala ilungelelaniswa nomthombo. Ngokwamkela le ndlela, sikhulisa ukuthembeka kokufikelela kule datha ibalulekileyo, njengoko ukufunyanwa ngalunye kwenzeka ngokuthe ngqo kwimemori nge-0% yempazamo enokwenzeka. Ukongeza, ukubuyisela idatha kwimemori kukhawuleza kakhulu, ngaloo ndlela kunyuswa ukusebenza kwesicelo sethu. Esi sicwangciso-qhinga sithomalalisa umngcipheko onxulumene nokuxhomekeka kumthombo wedatha wangaphandle, ukuqinisekisa ukufikelela okungaguqukiyo nokuthembekileyo kulwazi olubalulekileyo ekusebenzeni kwesicelo sethu.

Uqwalaselo olulayishekayo kwakhona

Nangona kunjalo, imfuno yokukhuphela idatha ekuqalisweni kwesicelo, ngaloo ndlela ilibazisa inkqubo yokuqalisa, iphula enye yemigaqo 'yesicelo se-12-factor' ekhuthaza ukuqaliswa ngokukhawuleza kwesicelo. Kodwa, asifuni kuphulukana nezibonelelo zokusebenzisa i-caching. Ukuhlangabezana nale ngxaki, makhe sijonge izisombululo ezinokubakho.


Ukuqalisa ngokukhawuleza kubalulekile, ngakumbi kumaqonga afana ne-Kubernetes, axhomekeke kwisicelo esikhawulezayo sokufudukela kwiindawo ezahlukeneyo zomzimba. Ngethamsanqa, i-Kubernetes inokulawula usetyenziso oluqala kancinci isebenzisa iimpawu ezinje ngeeprobe zokuqalisa.


Omnye umngeni esinokujongana nawo kukuhlaziya ulungelelwaniso ngelixa usetyenziso lusaqhuba. Rhoqo, ukulungelelanisa amaxesha e-cache okanye ukucela ukuphelelwa lixesha kuyafuneka ukusombulula imiba yemveliso. Nokuba sinokuthumela ngokukhawuleza iifayile zoqwalaselo ezihlaziyiweyo kwisicelo sethu, ukusebenzisa olu tshintsho kufuna ukuqaliswa kwakhona. Ngexesha elongeziweyo lokuqalisa kwesicelo ngasinye, ukuqalisa ngokutsha kunokulibazisa kakhulu ukusasaza izilungiso kubasebenzisi bethu.


Ukujongana noku, isisombululo esinye kukugcina uqwalaselo kuguqulo oluhambelanayo kwaye ube nomsonto ongasemva uwuhlaziya rhoqo. Nangona kunjalo, iiparamitha ezithile, ezifana nokuphuma kwexesha lesicelo se-HTTP, kunokufuna ukuqaliswa kwakhona kwe-HTTP okanye abathengi bedatabase xa ulungelelwaniso oluhambelanayo lutshintsha, lubeka umngeni onokubakho. Nangona kunjalo, abanye abathengi, njengomqhubi weCassandra weJava, baxhasa ukulayishwa kwakhona ngokuzenzekelayo koqwalaselo, ukwenza lula le nkqubo.


Ukuphumeza ulungelelwaniso oluphinda lulayisheke kunokunciphisa ifuthe elibi lamaxesha amade okuqalisa kwesicelo kwaye kubonelele ngezibonelelo ezongezelelweyo, ezifana nokuququzelela ukuphunyezwa kweflegi. Le ndlela isenza sikwazi ukugcina ukuthembeka kwesicelo kunye nokuphendula ngelixa silawula ngokufanelekileyo ukuhlaziywa kobumbeko.

Ubuyela kundalashe

Ngoku makhe sijonge enye ingxaki: kwinkqubo yethu, xa isicelo somsebenzisi sifunyenwe kwaye siqhutywe ngokuthumela umbuzo kwi-backend okanye i-database, ngamanye amaxesha, impendulo yephutha ifunyenwe endaweni yedatha elindelekileyo. Emva koko, inkqubo yethu iphendula kumsebenzisi 'ngempazamo'.


Nangona kunjalo, kwiimeko ezininzi, kunokukhethwa ngakumbi ukubonisa idatha ephelelwe lixesha kunye nomyalezo obonisa ukuba kukho ukulibaziseka kokuhlaziywa kwedatha, kunokushiya umsebenzisi nomyalezo omkhulu wephutha obomvu.


image


Ukulungisa lo mba kunye nokuphucula indlela yokuziphatha kwesixokelelwano sethu, singasebenzisa ipateni yokubuyela umva. Ingcinga esemva kwale pateni ibandakanya ukuba nomthombo wedatha wesibini, onokuqulatha idatha yomgangatho ophantsi okanye ubutsha xa kuthelekiswa nomthombo wokuqala. Ukuba umthombo wedatha osisiseko awufumaneki okanye ubuyisela impazamo, inkqubo inokubuyela umva ekufumaneni idatha evela kulo mthombo wesibini, iqinisekisa ukuba uhlobo oluthile lolwazi lunikezelwe kumsebenzisi endaweni yokubonisa umyalezo wemposiso.

Zama kwakhona

image


Ukuba ujonga lo mfanekiso ungasentla, uya kuqaphela ukufana phakathi komba esijongene nawo ngoku kunye nalowo sidibene nomzekelo we-cache.


Ukuyicombulula, sinokuqwalasela ukuphumeza ipateni eyaziwa ngokuba yizama kwakhona. Esikhundleni sokuxhomekeka kwii-cache, inkqubo inokuthi yenziwe ukuba ithumele ngokuzenzekelayo isicelo xa kukho impazamo. Le pateni uzame kwakhona inika enye indlela elula kwaye inokunciphisa ngokusebenzayo ukubakho kweempazamo kwisicelo sethu. Ngokungafaniyo ne-caching, ehlala ifuna iindlela ezintsonkothileyo zokunganyaniseki kwe-cache yokusingatha utshintsho lwedatha, ukuzama kwakhona izicelo ezisileleyo kulula kakhulu ukuphumeza. Njengoko ukungasebenzi kwe-cache kuthathwa ngokubanzi njengowona msebenzi ucela umngeni kubunjineli besoftware, ukwamkela isicwangciso sokuphinda sizame kunokulungelelanisa ukuphatha iimpazamo nokuphucula ukomelela kwenkqubo.

Umephuli wojikelezo

image


Nangona kunjalo, ukwamkela isicwangciso-qhinga sokuphinda uzame ngaphandle kokuqwalasela iziphumo ezinokubakho kunokukhokelela kwezinye iingxaki.


Makhe sicinge ukuba omnye wabasemva bethu ufumana ukusilela. Kwimeko enjalo, ukuqalisa ukuzama kwakhona kwi-backend engaphumeleliyo kunokukhokelela ekunyuseni okukhulu komthamo wezithuthi. Oku kunyuka ngesiquphe kwetrafikhi kunokongamela umva, kwenze mandundu ukusilela kwaye kunokubangela isiphumo se-cascade kuyo yonke inkqubo.


Ukuhlangabezana nalo mngeni, kubalulekile ukuzalisekisa ipateni yokuphinda uzame kunye nepateni ye-circuit breaker. I-breaker circuit isebenza njengendlela yokukhusela ebeka esweni izinga lempazamo kwiinkonzo ezisezantsi. Xa izinga lephutha lidlula umda ochazwe ngaphambili, i-breaker circuit iphazamisa izicelo kwinkonzo echaphazelekayo kwixesha elichaziweyo. Ngeli xesha, inkqubo iyayeka ukuthumela izicelo ezongezelelweyo ukuvumela ixesha lenkonzo engaphumeleli ukuba libuyiselwe. Emva kwexesha elimiselweyo, i-circuit breaker ivumela ngokukhawuleza inani elincinci lezicelo ukuba lidlule, liqinisekisa ukuba inkonzo izinzile. Ukuba inkonzo ibuyiselwe, i-traffic eqhelekileyo ibuyiselwa ngokuthe ngcembe; ngaphandle koko, isekethe ihlala ivulekile, iqhubeka ivimbela izicelo de inkonzo iphinde iqalise ukusebenza okuqhelekileyo. Ngokudibanisa ipateni ye-breaker circuit ecaleni kwe-logic yokuzama kwakhona, sinokulawula ngokufanelekileyo iimeko zempazamo kwaye sithintele ukugqithiswa kwenkqubo ngexesha lokungaphumeleli kwe-backend.

Ukusonga

Ukuqukumbela, ngokuphumeza ezi patheni zokomelela, sinokomeleza izicelo zethu ngokuchasene neemeko ezingxamisekileyo, sigcine ukufumaneka okuphezulu, nokuhambisa amava angenamthungo kubasebenzisi. Ukongeza, ndingathanda ukugxininisa ukuba i-telemetry sesinye isixhobo esingafanelanga singahoywa xa sibonelela ngeprojekthi ukomelela. Iilogi ezilungileyo kunye neemetrics zinokuphucula kakhulu umgangatho weenkonzo kwaye zibonelele ngengqiqo ebalulekileyo ekusebenzeni kwazo, ukunceda ukwenza izigqibo ezinolwazi ukuziphucula ngakumbi.

L O A D I N G
. . . comments & more!

About Author

Dmitrii Pakhomov HackerNoon profile picture
Dmitrii Pakhomov@ymatigoosa
10 yeas of experience of building mission critical Fintech system handling extremely high load

ZIJONGE IIMPAWU

ELI NQAKU LINIKEZELWE KU...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite

Mentioned in this story

companies
profiles