Skip to main content
Request ေတြကိုကိုင္တြယ္တဲ႔အခါ Multithreading ကိုအသံုးျပဳထားေသာ web server ေတြဟာ CPU, Memory, I/O ေတြကိုစနစ္တက် အသံုးမျပဳ႔တဲ႔အတြက္ ေနွးေကြးျပီး users ေတြအမ်ားျကီး သံုးတာကို ထိထိေရာက္ေရာက္ မကိုင္တြယ္နိုင္ပါ။ ဥပမာ Microsoft IIS, Apache, Tomcat တို႔လို ေရွးဦးေပၚခဲ႔တဲ႔ web server မ်ိဳးေတြ။ ဒီျပသနာေတြကို server ေတြထက္တိုးျပီး ေျဖရွင္းေလ႔ရွိတယ္။
ေနာက္ပိုငး္မွာ server တခုထဲမွာပဲ hardware resources ေတြကိုကို ထိထိေရာက္ေရာက္သံုးနိုင္ဖို႔
single threaded asynchronous, event loop ကိုအသံုးျပဳထားတဲ႔ NGINX တို႔ Node.JS တို႔ေပၚလာတယ္။
အသံုးမမ်ားတဲ႔ web sites ေတြအတြက္ ဘယ္လို web server ေတြေပၚမွာhost လုပ္လုပ္ အဆင္ေျပေသာ္လည္း လူသံုးမ်ားျပီး ျမန္နွုန္းကို ဦးစားေပးတဲ႔ site ေတြအတြက္အဆင္မေျပဘူး။
IIS, Apache တို႔လို web server ေတြဟာ features ေတြအမ်ားျကီးေပးထားတဲ႔အတြက္ ကိုယ္အတြက္အသံုးမ၀င္တာေတြ အမ်ားျကီးပါနိုင္တယ္။ ကိုယ္လိုခ်င္သလို customize လုပ္ဖုိ႔ခက္တယ္။
Node.js ဟာ runtime environment ျဖစ္ျပီး ကိုယ္လိုခ်င္တဲ႔အပိုင္းကို ကိုင္တြက္လို႔ရတယ္။ ရွုိးရွင္းတဲ႔ html response အတြက္ view engine မသံုးပဲ ကိုယ္နညး္ကိုယ္ဟန္နဲ႔ response လုပ္လို႔ရတယ္။ တတ္နိုင္ရင္ asp.net razor view engine လိုမ်ိဳး ကိုယ္ပိုင္ render engine ဖန္တီးျပီးေတာင္သံုးလို႔ရတယ္။ CPU core တခုခ်င္စီအတြကိ process ေတြကို fork လုပ္ျပီး request ေတြကိုကိုင္တြက္လို႔ရပါတယ္။ Socket level နဲ႔ပိုျပီးနီးစပ္တယ္ဆိုရမွာေပါ႔။ Sever တခုကို Port တခုမွာ listen လုပ္ဖို႔ code ၄ ၅ ေျကာင္းေလာက္နဲ႔တင္ျပီးတယ္။ ေနာက္ပိုငး္မွာ web sites/API ေတြကိုလြယ္လြယ္ကူကူနဲ႔ ဖန္တီးနိုင္ဖို႔ Express လိုမ်ိဳး middleware ေတြေပၚလာတယ္။
Node.js နဲ႔အားမရဘူးဆိုရင္ ကိုယ္ပိုင္ http server တခုကို TCP/IP stack ေပၚမွာ ဖန္တီးနုိင္ပါတယ္။
asynchronous I/O ျဖစ္ဖို႔တြက္ Node.js ဟာ libuv သံုးျပီးဖန္တီးထားတာပါ။ စိတ္၀င္စားရင္ libuv ကုိသံုးျပီး idea အသစ္ေတြနဲ႔ ေနာက္ထက္ web server တခုကို ကိုယ္တိုင္ ဖန္တီးနိုင္ပါတယ္။ အေရးျကီးတာ အခုပဲရွိတယ္။ အဲ႔ဒါက ရွိျပီးသားေတြကို အခ်ိန္ကုန္ဖန္တီးျပီး reinvent the wheel မျဖစ္ဖို႔႔ပဲလိုပါတယ္။ :)

--NSA

Comments

Popular posts from this blog

Privacy policy of Photo Hidden Data

  NAING SOE AUNG built the Photo Hidden Data app as a Freemium app. This SERVICE is provided by NAING SOE AUNG at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Photo Hidden Data unless otherwise defined in this Privacy Policy. Information Collection and Use ...

Privacy policy of WoW Photo Gallery

NAING SOE AUNG built the WoW Photo Gallery app as a Freemium app. This SERVICE is provided by NAING SOE AUNG at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at WoW Photo Gallery unless otherwise defined in this Privacy Policy. Information Collection and Use For ...
Smart Shooter Description This game will help you to improve your alternative problem solving skills. Shoot the ball and hit the target. If you can not shoot straight to the target, guess the good angle, bounce off the wall and hit the target. Player needs to clear the targets in time. -Features *Option to choose image or color of ball. *24 challenging levels. *Lightweight application. https://play.google.com/store/apps/details?id=com.nsoeaung.bouncingmaster