Sunday, 23 July 2017

Node Js Trading ระบบ


ฉันใช้ห้องสมุดการวิเคราะห์ทางเทคนิค talib เพื่อคำนวณ MACD ฉันใช้ข้อมูล AAPL ในการคำนวณ MACD 8, 17, 9 แต่ค่า Talib จะแตกต่างจาก Google และ Yahoo Finance นี่คือ javascript ของฉันฉันคัดลอกข้อมูลล่าสุด AAPL ปิดตั้งแต่ 2015-08-21 . ค่า MACD ของปีพ. ศ. 2548-08-21 จาก Yahoo และ Google finance คือ -2 73 ค่า talib คือ 3 83 และมีข้อมูลมากขึ้น MACD ต่างกันมากสิ่งที่ฉันทำผิดฉันยังสังเกตอีกว่า talib SMA และ EMA ให้ผลลัพธ์เช่นเดียวกัน วิธีการ inverting ใน Google แผนภูมิ MACD ช้าและรวดเร็วช่วงไม่เปลี่ยนแปลงแผนภูมิ Yahoo ไม่ได้ 23 สิงหาคม 23 ที่ 17 16.Btw, คุณเห็นการสนทนานี้มีคำอธิบายต่อไปนี้เหตุผลที่ Yahoo และ Google มีค่า MACD แตกต่างกัน คือว่าพวกเขากำลังใช้ความยาวหน้าต่างที่แตกต่างกัน Yahoo และ Google don t ใช้ 34 วันทุกครั้ง - พวกเขาใช้ตลอดทางกลับไปที่ปีแรกหน้าต่างที่เติบโตขึ้นในขนาดแต่ละวันทำการคุณสามารถลอง TALib กับข้อมูลทั้งหมดตั้งแต่ปี 2015 -01-01 truf 25 ส. ค. 52 at 15 22.25 จุดข้อมูล i s ไม่เพียงพอที่จะได้รับผลดีการคำนวณของ EMA MACD ชุดขึ้นอยู่กับชุดหลายชุด EMA เป็น recursive สำหรับการคำนวณ EMA MACD id บอกว่าใช้อย่างน้อยปีของมูลค่าการปิดราคาข้อมูลการทดสอบหน้าจอขนาดใหญ่ของตัวบ่งชี้ทางเทคนิค ซอฟต์แวร์สามารถค่อนข้างลำบากเนื่องจากคุณต้องแน่ใจว่าคุณกำลังใช้ชุดเดียวกันของข้อมูลให้แน่ใจว่าคุณกำลังเริ่มต้นด้วยค่าเริ่มต้นเดียวกัน priming ฯลฯ เป็นคำนวณระบบอ้างอิง is. as เท่ารับข้อมูล yahoo เป็นหนึ่ง ตัวเลือกอย่างเห็นได้ชัด markit ยังมี api ที่อาจทำงานซึ่งส่งกลับค่าในอดีตซึ่งสิ่งที่ฉันสังเกตเห็นคือปรากฏว่าคุณกำลังป้อนข้อมูลในชุดข้อมูลที่เริ่มต้นที่จุดข้อมูลล่าสุดและย้ายไปข้างหลังนั่นคือดัชนี 0 เป็นดัชนี 21 1 คือ aug 20 ดัชนี 2 คือ aug 19 และนี่คือคำสั่งที่ talib คาดว่าความคิดของฉันเพียงอย่างเดียวคือการย้อนลำดับของชุดข้อมูลออกจากปัจจัยการผลิตอื่น ๆ ทั้งหมดและดูสิ่งที่คุณได้รับ lispHK01 25 สิงหาคม 15 ที่ 11 39. ฉันไม่ใช่ผู้เชี่ยวชาญ แต่ฉันอยู่ภายใต้ ยืนอยู่ถ้าคุณใช้ 3 ช่วงเวลาแตกต่างกัน 8, 17 และ 9 คุณจะต้องมีจำนวนอย่างน้อยสองครั้งของค่าของช่วงเวลาที่ยาวที่สุดของคุณเพื่อคำนวณมูลค่าปัจจุบันตัวอย่างเช่นสมมติว่าคุณอยู่ที่เวลา T และคุณคำนวณ 17 ระยะเวลาสำหรับค่า T-17 คุณจะต้องมีค่าอย่างน้อย 34 ค่าเพื่อให้ T-17 สามารถคำนวณได้อย่างถูกต้องและ T-16 จนกว่าจะถึงค่าปัจจุบันของคุณ . 15. 45,000 Python courses. The Top Java Tutorials. AWS ได้รับการรับรองโซลูชั่น Architect - Associate 2017 Ryan Kroonenburg 100K 180.3D ข้อมูลพื้นฐานเกี่ยวกับภาพเคลื่อนไหวเพื่อร่างกายเต็มรูปแบบและกลไกการสร้างสรรค์ Charlie Grubel 347 50. หลักสูตร iOS 10 Developer สมบูรณ์ - สร้าง 21 Apps Rob Percival 43 2K 200 ภาพ Masterclass คู่มือฉบับสมบูรณ์ของคุณเพื่อการถ่ายภาพ Phil Ebiner 1 67 6K 200.Body ภาษาสำหรับผู้ประกอบการ Vanessa Van Edwards 1 20 8K 200.Affiliate Marketing - Beginner s Guide to Earning Online Lisa Irby 5K 95. การสอนโปรแกรม Python ขั้นสูงสุด 22 5K 50. การสอน Java Spring เรียนรู้ Java's Web Framework ยอดนิยม John Purcell 23 3K 35.Microsoft Excel 2010 การฝึกอบรมขั้นสูงทักษะที่ไม่มีขีด จำกัด 73K 50.Acumen Presents การอบรมเชิงสร้างสรรค์ของเอลิซาเบ ธ กิลเบิร์ตคอร์ส Acumen 1 13 5K 100. เรียนรู้การเขียนโปรแกรม HTML5 จาก Scron Eduonix Learning Solutions 1 252 6K. Java Tutorial สำหรับผู้เริ่มต้นที่สมบูรณ์ John Purcell 668K. PLC การเขียนโปรแกรมจาก Scratch PLC I Paul Lynn 8 7 K 100 . ทำไมนรกฉันจะใช้ Case - by - Case Tutorial. JavaScript ความนิยมเพิ่มขึ้นได้นำกับมันมากการเปลี่ยนแปลงและการพัฒนาเว็บในวันนี้เป็นอย่างมากที่แตกต่างกันสิ่งที่เราสามารถทำได้บนเว็บในปัจจุบันด้วยจาวาสคริปต์ ทำงานบนเซิร์ฟเวอร์เช่นเดียวกับในเบราว์เซอร์เป็นเรื่องยากที่จะจินตนาการได้เมื่อหลายปีก่อนหรือถูกห่อหุ้มอยู่ภายในสภาพแวดล้อมแบบ sandboxed เช่น Flash หรือ Java Applets. ก่อนที่จะขุดลงไปคุณอาจต้องการอ่านเกี่ยวกับประโยชน์ของการใช้ JavaScript ในส่วนต่างๆ stack ซึ่งรวมภาษาและรูปแบบข้อมูล JSON ไว้ซึ่งช่วยให้คุณสามารถใช้แหล่งข้อมูลสำหรับนักพัฒนาซอฟต์แวร์ได้อย่างดียิ่งเนื่องจากเป็นประโยชน์มากกว่า JavaScript โดยเฉพาะเราจึงไม่ได้พูดถึงเรื่องนี้มากนัก แต่เป็นประโยชน์หลักในการรวม Node ไว้ใน stack ของคุณเช่นเดียวกับรัฐในวิกิพีเดีย เป็นชุดรวบรวมของเครื่องยนต์ JavaScript ของ Google V8 JavaScript, เลเยอร์ libuv abstraction layer และไลบรารีหลักซึ่งเป็นตัวเขียนหลักใน JavaScript นอกเหนือจากนั้นก็น่าสังเกตว่า Ryan Dahl ผู้สร้างมุ่งมั่นที่จะสร้างเว็บไซต์แบบเรียลไทม์ด้วยแรงผลักดันที่ได้รับแรงบันดาลใจจากแอ็พพลิเคชันเช่น Gmail เขาให้นักพัฒนาซอฟต์แวร์เป็นเครื่องมือสำหรับการทำงานในกระบวนทัศน์ IO ที่ไม่มีการปิดกั้นและขับเคลื่อนโดยเหตุการณ์หลังจากกว่า 20 ปีของเว็บไร้สัญชาติ กระบวนทัศน์ตอบรับไร้สัญชาติในที่สุดเรามีแอพพลิเคชันเว็บที่มีการเชื่อมต่อแบบเรียลไทม์แบบสองทางโดยในหนึ่งประโยคส่องในแอ็พพลิเคชันเว็บแบบเรียลไทม์ที่ใช้เทคโนโลยีพุชผ่าน websockets การปฏิวัติที่ดีหลังจากผ่านไป 20 ปีแล้ว เว็บไร้สัญชาติบนพื้นฐานของกระบวนทัศน์การตอบสนองคำขอไร้สัญชาติในที่สุดเราก็มีแอพพลิเคชันเว็บที่มีการเชื่อมต่อแบบเรียลไทม์แบบสองทางซึ่งไคลเอ็นต์และเซิร์ฟเวอร์สามารถเริ่มต้นการติดต่อสื่อสารเพื่อให้สามารถแลกเปลี่ยนข้อมูลได้อย่างอิสระนี่เป็นไปในทางตรงกันข้ามกับ กระบวนทัศน์การตอบสนองเว็บทั่วไปที่ลูกค้าเริ่มต้นการสื่อสารเสมอนอกจากนี้ s ทั้งหมดขึ้นอยู่กับเว็บสแต็คเปิด HTML, CSS และ JS ทำงานผ่านพอร์ตมาตรฐาน 80.One อาจยืนยันว่าเราได้มีนี้ เป็นเวลาหลายปีในรูปแบบของ Flash และ Java Applets แต่ในความเป็นจริงสภาพแวดล้อมเหล่านี้เป็นสภาพแวดล้อมแบบ sandboxed โดยใช้เว็บเป็นโปรโตคอลการขนส่งที่จะถูกส่งไปยังไคลเอ็นต์ Plus พวกเขาทำงานในการแยกและดำเนินการมากกว่าพอร์ตที่ไม่ได้มาตรฐานซึ่งอาจ ต้องมีสิทธิ์พิเศษและข้อดีดังกล่าวขณะนี้มีบทบาทสำคัญในเทคโนโลยีของ บริษัท ที่มีชื่อเสียงระดับสูงหลายแห่งซึ่งขึ้นอยู่กับผลประโยชน์ที่เป็นเอกลักษณ์มูลนิธิฯ ได้รวมความคิดที่ดีที่สุดไว้ว่าทำไมองค์กรควรพิจารณาในระยะสั้น งานนำเสนอที่สามารถพบได้ในหน้ากรณีศึกษาของมูลนิธิในบทความนี้ฉันจะพูดถึงไม่เพียง แต่ความได้เปรียบเหล่านี้ได้อย่างไร แต่ยังเป็นเหตุผลที่คุณอาจต้องการใช้เหตุผลที่ไม่ได้ใช้เว็บแอ็พพลิเคชันแบบคลาสสิกเป็นตัวอย่าง ความคิดหลักของการใช้ non-blocking, event-driven IO จะยังคงมีน้ำหนักเบาและมีประสิทธิภาพในการเผชิญกับแอพพลิเคชั่นเรียลไทม์ที่ใช้ข้อมูลเป็นจำนวนมากซึ่งทำงานบนอุปกรณ์แบบกระจาย uthful. What จริงๆหมายความว่าไม่ได้เป็นเงิน bullet แพลตฟอร์มใหม่ที่จะครองโลกการพัฒนาเว็บ แต่ก็แพลตฟอร์ม sa ที่เติมความต้องการเฉพาะสิ่งที่มันจริงๆหมายความว่าไม่ได้เป็นเงิน bullet แพลตฟอร์มใหม่ที่จะ ครองโลกการพัฒนาเว็บ แต่ก็แพลตฟอร์ม sa ที่เติมความต้องการเฉพาะและความเข้าใจนี้เป็นสิ่งสำคัญอย่างแน่นอนคุณ don t ต้องการใช้สำหรับการดำเนินงาน CPU มากในความเป็นจริงใช้มันสำหรับการคำนวณหนักจะยกเลิกเกือบทุกข้อดีของที่โหนด จริงๆส่องในการสร้างอย่างรวดเร็วและใช้งานเครือข่ายที่ปรับขนาดได้เนื่องจากสามารถจัดการกับจำนวนมากของการเชื่อมต่อพร้อมกันกับ throughput สูงซึ่งเท่ากับ scalability. How ทำงานภายใต้ฝากระโปรงจะน่าสนใจสวยเมื่อเทียบกับแบบเว็บที่ให้บริการ เทคนิคการร้องขอการเชื่อมต่อแต่ละครั้งจะสร้างเธรดใหม่เอาระบบแรมและเพิ่มจำนวนสูงสุดของ RAM ที่ใช้งานได้โดยใช้ non-blockin g IO อนุญาตให้สนับสนุนการเชื่อมต่อพร้อมกันนับหมื่นที่จัดขึ้นในลูปเหตุการณ์การคำนวณอย่างรวดเร็วโดยสมมติว่าแต่ละเธรดมีหน่วยความจำ 2 เมกะไบต์พร้อมด้วยการทำงานบนระบบที่มีแรม 8 GB ทำให้เราอยู่ที่ ทฤษฎีสูงสุดของการคำนวณการเชื่อมต่อ 4,000 พร้อมกันนำมาจากบทความของ Michael Abernethy สิ่งที่ได้รับการตีพิมพ์ใน IBM developerWorks ในปี 2011 น่าเสียดายบทความนี้ไม่พร้อมใช้งานอีกต่อไปบวกกับค่าใช้จ่ายในการเปลี่ยนบริบทระหว่างหัวข้อนั่นคือสถานการณ์ที่คุณจัดการกับแบบดั้งเดิม เทคนิคการแสดงเว็บโดยการหลีกเลี่ยงสิ่งที่ทำได้ระดับความสามารถในการปรับขยายได้มากกว่า 1M การเชื่อมต่อที่เกิดขึ้นพร้อมกันและการเชื่อมต่อเว็บบรอดคาสต์แบบ 600 กิโลวัตต์ซึ่งแน่นอนว่าคำถามเกี่ยวกับการแชร์เธรดเดียวระหว่างคำขอของลูกค้าทั้งหมดและเป็นปัญหาที่อาจเกิดขึ้นจากการเขียน โปรแกรมแรกประการแรกการคำนวณอย่างหนักอาจทำให้สำลักโหนดเดียวของโหนดและทำให้เกิดปัญหากับลูกค้าทั้งหมดเกี่ยวกับเรื่องนี้ในภายหลังเป็น incomi ng จะถูกปิดกั้นจนกว่าการคำนวณดังกล่าวจะเสร็จสมบูรณ์ประการที่สองนักพัฒนาซอฟต์แวร์ต้องระมัดระวังอย่างยิ่งที่จะไม่อนุญาตให้ข้อยกเว้นเกิดขึ้นที่ลูปของเหตุการณ์หลักซึ่งจะทำให้อินสแตนซ์สามารถยุติโปรแกรมได้อย่างมีประสิทธิภาพเทคนิคที่ใช้เพื่อหลีกเลี่ยงข้อยกเว้น bubbling ถึงพื้นผิวจะส่งข้อผิดพลาดกลับไปโทรเป็นพารามิเตอร์เรียกกลับแทนที่จะขว้างปาพวกเขาเช่นในสภาพแวดล้อมอื่น ๆ แม้ว่าบางข้อยกเว้น unhandled จัดการเพื่อฟองขึ้นเครื่องมือได้รับการพัฒนาเพื่อตรวจสอบกระบวนการและดำเนินการกู้คืนที่จำเป็นของชน ตัวอย่างเช่นแม้ว่าคุณอาจได้รับรางวัล t สามารถกู้คืนสถานะปัจจุบันของเซสชันของผู้ใช้โดยทั่วไปเป็นโมดูล Forever หรือใช้วิธีการที่แตกต่างกันกับเครื่องมือระบบภายนอกที่เพิ่งเริ่มต้นและ monit หรือแม้แต่เพียงพุ่งพรวด Npm Package Manager เมื่อคุยกัน สิ่งหนึ่งที่ควรหลีกเลี่ยงไม่ได้คือการสนับสนุนการจัดการแพคเกจโดยใช้เครื่องมือ NPM ที่มาพร้อมกับค่าเริ่มต้น กับการติดตั้งทุกความคิดของโมดูล NPM ค่อนข้างคล้ายกับที่ของ Ruby Gems ชุดของสาธารณะที่มีส่วนประกอบนำมาใช้ซ้ำได้ผ่านการติดตั้งง่ายผ่านทางพื้นที่เก็บข้อมูลออนไลน์กับรุ่นและการจัดการ dependency รายการเต็มรูปแบบของโมดูลบรรจุสามารถพบได้ใน เว็บไซต์ NPM หรือเข้าถึงได้โดยใช้เครื่องมือ NPM NPC ที่ได้รับการติดตั้งโดยอัตโนมัติพร้อมกับระบบนิเวศของโมดูลจะเปิดให้ทุกคนและทุกคนสามารถเผยแพร่โมดูลของตัวเองที่จะแสดงในที่เก็บ NPM แนะนำสั้น ๆ เพื่อ NPM สามารถพบได้ในการเริ่มต้น s คู่มือและรายละเอียดเกี่ยวกับการเผยแพร่โมดูลใน npm Publishing Tutorial หนึ่งในโมดูลของ NPM ที่มีประโยชน์มากที่สุดในวันนี้คือการอธิบาย - โครงสร้างการพัฒนาเว็บที่ได้แรงบันดาลใจจากซินาตร้าและมาตรฐาน de facto สำหรับแอพพลิเคชั่นส่วนใหญ่ที่มีอยู่ในปัจจุบัน today. hapi - a มาก modular และง่ายในการใช้กรอบการกำหนดค่าเป็นศูนย์กลางสำหรับการสร้างเว็บและบริการ applications. connect - Connect เป็นกรอบเซิร์ฟเวอร์ขยายสำหรับการให้ชุดของ h ปลั๊กอินประสิทธิภาพสูงที่รู้จักกันในชื่อ middleware ทำหน้าที่เป็นพื้นฐานสำหรับ Express และ sockjs - ส่วนประกอบฝั่งเซิร์ฟเวอร์ของคอมโพเนนต์ websockets สองชิ้นที่พบบ่อยที่สุดมีอยู่ในปัจจุบันนี้ก่อนหน้าหยก - หนึ่งในเครื่องยนต์เทมเพลตยอดนิยมแรงบันดาลใจจาก HAML ซึ่งเป็นค่าเริ่มต้นใน mongodb และ mongojs - wrapper MongoDB เพื่อจัดเตรียม API สำหรับวัตถุ MongoDB ฐานข้อมูล in. redis - ไลบรารีของ Redis ไลบรารีขีดล่าง - แถบยูทิลิตี้ของยูทิลิตี้เข็มขัดขีดล่างเริ่มเกม แต่ได้รับการโค่นล้มโดยหนึ่งในสองคู่ฉบับซึ่งส่วนใหญ่เป็นผลมาจากประสิทธิภาพที่ดีขึ้นและการใช้งานแบบแยกส่วน - อาจเป็นประโยชน์ที่สุดสำหรับการตรวจสอบ ที่ทำให้โหนดของคุณทำงานได้อย่างต่อเนื่องทำให้กระบวนการของคุณทำงานได้ดีขึ้นในขณะที่เกิดความล้มเหลวที่ไม่คาดคิดใด ๆ bluerbird - คุณลักษณะเต็มรูปแบบ Promises การใช้งานที่มีประสิทธิภาพดีเยี่ยมเป็นพิเศษ - ไลบรารีวัน JavaScript ที่มีน้ำหนักเบาสำหรับการแยกวิเคราะห์การตรวจสอบการจัดการและการจัดรูปแบบ date. The รายการไปมีตันของแพคเกจที่มีประโยชน์จริงๆออกมีที่สามารถใช้ได้กับทุกความผิดไม่ให้กับผู้ที่ฉันได้ละเว้นที่นี่ Examp les จากสถานที่ที่ควรจะใช้ Chat เป็นแอพพลิเคชันที่มีผู้ใช้หลายแบบในแบบเรียลไทม์โดยทั่วไปจาก IRC ในวันนี้ผ่านโปรโตคอลที่เป็นกรรมสิทธิ์และเปิดใช้งานบนพอร์ตที่ไม่ได้มาตรฐานเพื่อให้สามารถใช้งานได้ทุกอย่างในวันนี้ด้วย websockets ทำงานผ่านพอร์ตมาตรฐาน 80. โปรแกรมแชทเป็นจริงตัวอย่างจุดหวานสำหรับมัน sa น้ำหนักเบาการจราจรสูงข้อมูลมาก แต่การประมวลผลการประยุกต์ใช้การคำนวณต่ำที่ทำงานในอุปกรณ์กระจายนอกจากนี้ยังเป็นกรณีการใช้งานที่ดีสำหรับการเรียนรู้ด้วย, เป็นเรื่องง่าย แต่ครอบคลุมมากที่สุดของกระบวนทัศน์ที่คุณจะเคยใช้ในโปรแกรมทั่วไปลองพยายามอธิบายว่ามันทำงานอย่างไรในตัวอย่างที่ง่ายที่สุดเรามีห้องสนทนาเดียวในเว็บไซต์ของเราที่ซึ่งผู้คนมาและสามารถแลกเปลี่ยนข้อความได้ ในหนึ่งไปหลายจริงแฟชั่นทั้งหมดเช่นกล่าวว่าเรามีสามคนในเว็บไซต์ทั้งหมดที่เชื่อมต่อกับกระดานข้อความของเราในฝั่งเซิร์ฟเวอร์เรามีโปรแกรมง่ายๆที่ใช้สองสิ่ง 1 GET ขอดำเนินการที่ทำหน้าที่ เรา bpage ที่มีทั้งกระดานข้อความและปุ่ม Send เพื่อเริ่มต้นการป้อนข้อความใหม่และ 2 เซิร์ฟเวอร์ websockets ที่รับฟังข้อความใหม่ที่ส่งออกโดยไคลเอ็นต์ websocket ในฝั่งไคลเอ็นต์เรามีหน้า HTML ที่มีคู่ของตัวจัดการตั้งค่า, หนึ่งสำหรับปุ่ม Send button click ซึ่งจะเก็บข้อความป้อนเข้าและส่งลงเว็บเซิร์ฟเวอร์และอีกรายการหนึ่งที่ฟังข้อความขาเข้าใหม่บนเว็บเซิร์ฟเวอร์เช่นข้อความที่ส่งโดยผู้ใช้รายอื่นซึ่งเซิร์ฟเวอร์ต้องการให้ลูกค้าแสดงผล เมื่อลูกค้ารายหนึ่งโพสต์ข้อความนี่เป็นสิ่งที่เกิดขึ้น Browser จับคลิกปุ่มส่งผ่านตัวจัดการ JavaScript หยิบค่าจากฟิลด์ที่ป้อนเช่นข้อความและส่งข้อความ websocket โดยใช้ไคลเอ็นต์ websocket ที่เชื่อมต่อกับ เซิร์ฟเวอร์เริ่มต้นในการเริ่มต้นเว็บไซท์ส่วนประกอบฝั่งเซิร์ฟเวอร์ของการเชื่อมต่อเว็บเซิร์ฟเวอร์จะรับข้อความและส่งต่อไปยังลูกค้าที่เชื่อมต่ออื่น ๆ ทั้งหมดโดยใช้วิธีการออกอากาศลูกค้าทั้งหมดจะได้รับระเบียบใหม่ อายุเป็นข้อความแบบพุชผ่านทางส่วนฝั่งไคลเอ็นต์ของ websockets ที่เรียกใช้ภายในหน้าเว็บจากนั้นพวกเขาจะรับเนื้อหาข้อความและอัปเดตหน้าเว็บในตำแหน่งโดยการต่อท้ายข้อความใหม่เข้ากับบอร์ดนี่เป็นตัวอย่างที่ง่ายที่สุดสำหรับประสิทธิภาพยิ่งขึ้น โซลูชันที่คุณอาจใช้แคชง่ายๆตาม Store Redis หรือในทางออกที่สูงขึ้นแม้แต่คิวข้อความเพื่อจัดการเส้นทางของข้อความไปยังไคลเอ็นต์และกลไกการส่งมอบที่มีประสิทธิภาพมากขึ้นซึ่งอาจครอบคลุมถึงการสูญเสียการเชื่อมต่อชั่วคราวหรือจัดเก็บข้อความสำหรับลูกค้าที่ลงทะเบียนไว้ ขณะที่พวกเขาอยู่ในสถานะออฟไลน์ แต่ไม่ว่าคุณจะปรับปรุงอะไรก็ตามจะยังคงดำเนินงานภายใต้หลักการพื้นฐานที่เหมือนกันเพื่อตอบสนองต่อเหตุการณ์การจัดการการเชื่อมต่อที่เกิดขึ้นพร้อมกันจำนวนมากและการรักษาความคล่องตัวในการใช้งานของผู้ใช้ API บนส่วนที่สัมพันธ์กับฐานข้อมูลแม้ว่าจะส่องจริงๆ กับแอ็พพลิเคชันแบบเรียลไทม์มันค่อนข้างเป็นแบบธรรมชาติสำหรับการเปิดเผยข้อมูลจาก DBs ของวัตถุเช่น MongoDB JSON ข้อมูลที่จัดเก็บไว้ให้ทำงานได้โดยไม่ต้องมีความต้านทานไม่ตรงกันและ dat conversion. For ตัวอย่างเช่นถ้าคุณใช้ Rails คุณจะแปลงจาก JSON เป็นแบบไบนารีจากนั้นเปิดเผยให้เป็น JSON ในขณะที่ข้อมูลถูกใช้โดย etc หรือเรียกง่ายๆว่า AJAX jQuery ด้วยคุณสามารถเปิดเผยวัตถุ JSON ของคุณได้ กับ REST API สำหรับลูกค้าที่จะบริโภคนอกจากนี้คุณ don t ต้องกังวลเกี่ยวกับการแปลงระหว่าง JSON และสิ่งอื่นเมื่ออ่านหรือเขียนจากฐานข้อมูลของคุณหากคุณใช้ MongoDB รวมคุณสามารถหลีกเลี่ยงความจำเป็นในการแปลงหลายโดยใช้ รูปแบบ serialization ข้อมูลสม่ำเสมอทั่ว client, server และ database. QUEUED INPUTS หากคุณได้รับข้อมูลจำนวนมากพร้อมกันฐานข้อมูลของคุณจะกลายเป็นคอขวดตามที่อธิบายไว้ข้างต้นสามารถจัดการกับการเชื่อมต่อที่เกิดขึ้นพร้อมกันได้ด้วยตนเอง แต่เนื่องจากการเข้าถึงฐานข้อมูลเป็น การปิดกั้นการดำเนินงานในกรณีนี้เราประสบปัญหาการแก้ปัญหาคือการรับทราบพฤติกรรมของลูกค้าก่อนที่ข้อมูลจะถูกเขียนอย่างแท้จริงไปยังฐานข้อมูลด้วยวิธีการที่ระบบรักษาความรับผิดชอบของตน onsiveness ภายใต้ภาระหนักซึ่งเป็นประโยชน์อย่างยิ่งเมื่อลูกค้า doesn t ต้องการยืนยัน บริษัท ของข้อมูลที่ประสบความสำเร็จเขียนตัวอย่างทั่วไปรวมถึงการเข้าสู่ระบบหรือการเขียนข้อมูลการติดตามผู้ใช้ที่ประมวลผลเป็นชุดและไม่ได้ใช้จนในเวลาต่อมาเช่นเดียวกับ การดำเนินงานที่ don t ต้องสะท้อนทันทีเช่นการปรับปรุงการนับชอบบน Facebook ที่ความสอดคล้องในที่สุดจึงมักใช้ในโลก NoSQL เป็นที่ยอมรับได้ข้อมูลที่ได้รับการจัดคิวผ่านบางประเภทแคชหรือข้อความเข้าคิวโครงสร้างพื้นฐานเช่น RabbitMQ ZeroMQ และย่อยโดยชุดฐานข้อมูลที่แยกต่างหาก เขียนกระบวนการทำงานที่ดีขึ้นสำหรับงานดังกล่าวพฤติกรรมที่คล้ายกันสามารถนำมาใช้กับกรอบภาษาอื่น ๆ แต่ไม่ได้อยู่บนฮาร์ดแวร์เดียวกันที่มีเดียวกันสูงผ่านการบำรุงรักษาในระยะสั้นกับโหนด, คุณสามารถผลักดันฐานข้อมูลเขียนออกไปด้านข้างและจัดการกับพวกเขาในภายหลังดำเนินการราวกับว่าพวกเขาประสบความสำเร็จ DATA STREAMING. In traditi เพิ่มเติม onal แพลตฟอร์มเว็บคำขอและการตอบสนองได้รับการปฏิบัติเหมือนเหตุการณ์ที่แยกต่างหากในความเป็นจริงพวกเขาเป็นจริงสตรีมข้อสังเกตนี้สามารถใช้ในการสร้างคุณสมบัติเย็นบางตัวอย่างเช่นเป็นไปได้ในการประมวลผลไฟล์ในขณะที่พวกเขากำลังยังคงถูกอัปโหลดเป็นข้อมูลมา in ผ่านสตรีมและเราสามารถประมวลผลได้ในแบบออนไลน์ซึ่งสามารถทำได้สำหรับการเข้ารหัสและพร็อกซีเสียงและวิดีโอในแบบเรียลไทม์ระหว่างแหล่งข้อมูลต่างๆดูในส่วนถัดไป ถูกใช้อย่างง่ายดายเป็นพร็อกซีด้านเซิร์ฟเวอร์ซึ่งสามารถจัดการกับการเชื่อมต่อพร้อมกันจำนวนมากในลักษณะที่ไม่ปิดกั้นได้โดยเฉพาะอย่างยิ่งที่มีประโยชน์สำหรับการให้บริการที่แตกต่างกันโดยใช้เวลาในการตอบสนองที่แตกต่างกันหรือรวบรวมข้อมูลจากจุดแหล่งที่มาหลายแห่งตัวอย่างเช่น แอพพลิเคชันฝั่งเซิร์ฟเวอร์สื่อสารกับแหล่งข้อมูลของบุคคลที่สามการดึงข้อมูลจากแหล่งต่างๆหรือการจัดเก็บเนื้อหาเช่นภาพและวิดีโอไปยังบริการคลาวด์ของ บริษัท อื่นแม้ว่าจะมีเซิร์ฟเวอร์พร็อกซีทุ่มเท แต่การใช้โหนดแทนอาจเป็นประโยชน์หากโครงสร้างพื้นฐานพร็อกซีของคุณ ไม่มีอยู่จริงหรือถ้าคุณต้องการโซลูชันสำหรับการพัฒนาในท้องถิ่นจากนี้ผมหมายถึงว่าคุณสามารถสร้างแอพพลิเคชันฝั่งไคลเอ็นต์พร้อมกับเซิร์ฟเวอร์การพัฒนาเนื้อหาและพร็อกซีคำขอ stubbing API ขณะที่ในการผลิตคุณจะจัดการกับการโต้ตอบดังกล่าวกับพร็อกซีเฉพาะ บริการ nginx, HAProxy ฯลฯ BROKERAGE - ผู้ค้าหลักทรัพย์ S แดชบอร์ดให้กลับไปที่ระดับการใช้งานอีกตัวอย่างหนึ่งที่ซอฟต์แวร์เดสก์ท็อป dominates แต่ co. uld สามารถแทนที่ได้อย่างง่ายดายด้วยโซลูชั่นเว็บเรียลไทม์เป็นซอฟต์แวร์การซื้อขายหลักทรัพย์ที่ใช้ในการติดตามราคาหุ้นดำเนินการคำนวณการวิเคราะห์ทางเทคนิคและสร้างกราฟผังการใช้โซลูชันแบบเรียลไทม์แบบเรียลไทม์จะช่วยให้โบรกเกอร์สามารถสลับเวิร์กสเตชันหรือ สถานที่ทำงานเร็ว ๆ นี้เราอาจเริ่มมองเห็นพวกเขาบนชายหาดในฟลอริด้าหรือ Ibiza หรือ Bali. STARTATION ตรวจสอบ DASHBOARD. Another ทั่วไปกรณีการใช้งานในโหนดที่มีเว็บซ็อกเก็ตเหมาะอย่างสมบูรณ์แบบติดตามผู้เข้าชมเว็บไซต์และการมองเห็นการปฏิสัมพันธ์ของพวกเขาในเวลาจริง คุณสามารถรวบรวมสถิติเรียลไทม์จากผู้ใช้ของคุณหรือแม้แต่เลื่อนไปยังระดับถัดไปโดยการแนะนำการโต้ตอบที่กำหนดเป้าหมายกับผู้เข้าชมของคุณโดยการเปิดช่องทางการสื่อสารเมื่อเข้าถึงจุดที่เฉพาะเจาะจงในช่องทางของคุณหากคุณสนใจแนวคิดนี้ก็คือ ได้รับการเผยแพร่โดย CANDDi แล้วลองจินตนาการว่าคุณจะสามารถปรับปรุงธุรกิจของคุณได้อย่างไรหากคุณรู้ว่าผู้เข้าชมของคุณกำลังทำอะไรอยู่ในแบบเรียลไทม์หากคุณสามารถเห็นภาพการโต้ตอบของตนด้วยเรียลไทม์ ซ็อกเก็ตสองทางของตอนนี้คุณสามารถ SYSTEMS MONITORING แดชบอร์ดให้ไปที่ด้านโครงสร้างพื้นฐานของสิ่ง Imagine ตัวอย่างเช่นผู้ให้บริการ SaaS ที่ต้องการให้ผู้ใช้หน้าบริการตรวจสอบเช่นหน้าสถานะ GitHub s ด้วย event-loop เราสามารถสร้างแดชบอร์ดบนเว็บที่มีประสิทธิภาพซึ่งจะตรวจสอบสถานะการให้บริการในรูปแบบอะซิงโครนัสและผลักดันข้อมูลไปยังลูกค้าที่ใช้ websockets. Both ทั้งภายใน บริษัท และสถานะบริการสาธารณะสามารถรายงานได้แบบเรียลไทม์และใช้งานได้แบบเรียลไทม์ เทคโนโลยีผลักดันความคิดที่นิดหน่อยและลองจินตนาการถึงการใช้งานแอ็พพลิเคชันการตรวจสอบ NOC ของเครือข่ายศูนย์ปฏิบัติการผู้ให้บริการโทรคมนาคมเครือข่ายผู้ให้บริการโฮสติ้งระบบคลาวด์หรือสถาบันการเงินบางแห่งทำงานบนเว็บสแต็คแบบเปิดที่ได้รับการสนับสนุนโดย websockets แทน Java และหรือ Java Applets. Note Don t พยายามที่จะสร้างระบบเรียลไทม์ที่ยากในระบบ Node เช่นระบบที่ต้องการการตอบสนองที่สม่ำเสมอ Erlang น่าจะเป็นทางเลือกที่ดีกว่าสำหรับชั้นแอพพลิเคชันที่สามารถใช้งานได้ เว็บแอปพลิเคชัน SERVER-SIDE กับนอกจากนี้ยังสามารถใช้ในการสร้างแอ็พพลิเคชันเว็บแบบคลาสสิกบนฝั่งเซิร์ฟเวอร์อย่างไรก็ตามกระบวนทัศน์การตอบสนองคำขอนี้ซึ่งจะครอบคลุมไปทั่ว HTML ไม่ได้เป็นแบบฉบับการใช้งานทั่วไปส่วนใหญ่มีข้อโต้แย้งที่จะต้องทำและต่อต้าน นี่คือข้อเท็จจริงบางอย่างที่ต้องพิจารณาหากแอ็พพลิเคชันของคุณไม่มีการคำนวณอย่างเข้มข้นของ CPU คุณสามารถสร้างได้จากด้านบนลงล่างของ Javascript แม้จะลงไปถึงระดับฐานข้อมูลถ้าคุณใช้พื้นที่เก็บข้อมูล JSON Object DB เช่น MongoDB จะช่วยพัฒนา รวมทั้งการจ้างงานอย่างมีนัยสำคัญนักพัฒนาซอฟต์แวร์ได้รับการตอบสนอง HTML เต็มรูปแบบซึ่งเป็นมากขึ้น SEO มิตรกว่าพูดโปรแกรมประยุกต์หน้าเดียวหรือ app websockets ทำงานอยู่ด้านบนของ CPU การประมวลผลอย่างเข้มข้นอย่างใดอย่างหนึ่งจะป้องกันการตอบสนองดังนั้นแพลตฟอร์ม threaded คือ วิธีที่ดีกว่าอีกวิธีหนึ่งคุณสามารถลองคำนวณการคำนวณโดยใช้ฐานข้อมูลเชิงสัมพันธ์ยังค่อนข้างเจ็บปวดดูด้านล่างสำหรับรายละเอียดเพิ่มเติมอย่าให้ตัวเองชอบและรับสภาพแวดล้อมอื่น ๆ เช่น R ails, Django หรือ MVC หากคุณต้องการดำเนินการเชิงสัมพันธ์ ทางเลือกสำหรับการประมวลผลแบบเร่งรัดของ CPU คือการสร้างสภาพแวดล้อมที่ได้รับการสนับสนุนจาก MQ ที่มีการปรับขนาดได้อย่างมากด้วยการประมวลผลแบบ back-end เพื่อให้ Node เป็นพนักงานด้านหน้าเพื่อจัดการกับคำขอของไคลเอ็นต์แบบอะซิงโครนัสเมื่อไม่ควรใช้งานเว็บไซด์ SIDEVER WEB AP ตัวอย่างเช่นเมื่อมีการเข้าถึงข้อมูลเชิงสัมพันธ์ DB เครื่องมือฐานข้อมูลแบบเบ็ดเสร็จยังคงอยู่ในช่วงเริ่มต้นของพวกเขาค่อนข้างอ่อนแอและไม่เป็นที่พอใจในการทำงานด้วย ในทางกลับกัน Rails จะให้การตั้งค่าการเข้าถึงข้อมูลโดยอัตโนมัติจากกล่องพร้อมกับเครื่องมือสนับสนุนการย้ายข้อมูลของ DB schema และอัญมณีอื่น ๆ ที่มีจุดประสงค์ Rails และเฟิร์มแวร์ที่ใช้งานได้มีการใช้งานเลเยอร์แอ็กทีฟระเบียนหรือ Data Mapper ซึ่งใช้งานได้ พลาดอย่างมากถ้าคุณพยายามที่จะทำซ้ำพวกเขาในบริสุทธิ์ JavaScript. Still ถ้าคุณมีแนวโน้มที่จะยังคง JS ตลอดทางและพร้อมที่จะดึงออกบางส่วนของเส้นผมของคุณให้จับตาดู ใน Sequelize และ Node ORM2 ทั้งสองอย่างยังไม่บรรลุนิติภาวะ แต่ในที่สุดพวกเขาก็สามารถติดต่อได้ เป็นไปได้และไม่ใช่เรื่องแปลกที่จะใช้โหนด แต่เพียงผู้เดียวในฐานะ front-end ขณะเดียวกันก็ทำให้ Rails สิ้นเชิงและเข้าถึงได้ง่ายในการประมวลผลข้อมูลเชิงสัมพันธ์ของ DB. HEAVY SERVER-SIDE เมื่อการคำนวณที่หนักหน่วงไม่ใช่เรื่อง ดีที่สุดแพลตฟอร์มรอบไม่มีคุณมั่นเหมาะ don t ต้องการสร้างเซิร์ฟเวอร์การคำนวณ Fibonacci ในโดยทั่วไปการดำเนินการใด ๆ CPU เข้มข้น annuls ทั้งหมด throughput ประโยชน์ Node เสนอกับเหตุการณ์ที่ขับเคลื่อนด้วยแบบ IO ไม่บล็อกเนื่องจากคำขอเข้ามาจะถูกบล็อกในขณะที่ เธรดถูกครอบครองด้วยจำนวนของคุณ crunching. As กล่าวก่อนหน้านี้เป็นแบบเธรดเดียวและใช้เฉพาะแกน CPU เดียวเมื่อมาถึงการเพิ่ม concurrency บนเซิร์ฟเวอร์ multi-core มีงานที่ทำโดยทีมหลักโหนดใน รูปแบบของการอ้างอิงโมดูลคลัสเตอร์นอกจากนี้คุณยังสามารถเรียกใช้อินสแตนซ์เซิร์ฟเวอร์หลาย ๆ อันที่อยู่เบื้องหลังพร็อกซีแบบย้อนกลับผ่านทาง nginx ด้วยการจัดกลุ่มคุณควรยกเลิกการคำนวณที่หนักหน่วงทั้งหมดเพื่อให้กระบวนการพื้นหลังเขียนขึ้นในสภาพแวดล้อมที่เหมาะสมมากขึ้น ที่และมีพวกเขาสื่อสารผ่านทางเซิร์ฟเวอร์คิวข้อความเช่น RabbitMQ แม้ว่าการประมวลผลพื้นหลังของคุณอาจจะทำงานบนเซิร์ฟเวอร์เดียวกันในขั้นต้นเช่นวิธีการที่มีศักยภาพในการปรับขยายสูงมากบริการหลังการประมวลผลเหล่านั้นสามารถแจกจ่ายได้อย่างง่ายดายเพื่อแยกคนงาน เซิร์ฟเวอร์โดยไม่จำเป็นต้องกำหนดค่าโหลดของหน้าเว็บหันหน้าไปทางเซิร์ฟเวอร์แน่นอนคุณ d ใช้วิธีการเดียวกันบนแพลตฟอร์มอื่น ๆ ด้วย แต่ด้วยคุณจะได้รับที่ throughput สูง secs sec เราเคยพูดคุยเกี่ยวกับเป็นคำขอแต่ละงานขนาดเล็ก จัดการได้อย่างรวดเร็วและมีประสิทธิภาพเราได้กล่าวถึงจากทฤษฎีสู่การปฏิบัติเริ่มต้นด้วยเป้าหมายและความทะเยอทะยานและลงท้ายด้วยจุดหวานและข้อผิดพลาดเมื่อผู้คนประสบปัญหาเกี่ยวกับโหนดก็มักจะเดือดลงไปด้วยความจริงที่ว่าการปิดกั้นการดำเนินงานคือ รากของความชั่วร้าย 99 ทั้งหมดของ misuses โหนดมาเป็นผลโดยตรงในโหนดการปิดกั้นการดำเนินงานเป็นรากของความชั่วร้ายทั้งหมด 99 ของ misuses โหนดมาเป็นผลโดยตรงจำได้ว่าเป็น ไม่เคยสร้างขึ้นมาเพื่อแก้ปัญหาการคำนวณการคำนวณมันถูกสร้างขึ้นเพื่อแก้ปัญหาการปรับขนาด IO ซึ่งมันไม่ดีจริงๆการใช้งานทำไมถ้ากรณีการใช้งานของคุณไม่มีการดำเนินงานที่เข้มข้นของซีพียูหรือการเข้าถึงแหล่งข้อมูลการปิดกั้นใด ๆ คุณสามารถใช้ประโยชน์และเพลิดเพลินได้ รวดเร็วและสามารถปรับขนาดการใช้งานเครือข่ายยินดีต้อนรับสู่เว็บเรียลไทม์เกี่ยวกับผู้เขียนดูรายละเอียดเต็มรูปแบบตั้งแต่เดือนกุมภาพันธ์ 12, 2013.Tomislav เป็นวิศวกรซอฟต์แวร์ที่ปรึกษาทางเทคนิคและสถาปนิกที่มีประสบการณ์กว่า 10 ปีเขาเชี่ยวชาญในแบบ full - stack, scalable, เรียลไทม์ JavaScript และแอพพลิเคชันที่มีประสบการณ์ใน C, Java และ Ruby เขาเป็นผู้ประกอบการ Kanban ที่กระฉับกระเฉงที่รักการทำงานร่วมกันในโครงการเพื่อการพัฒนาคลิกเพื่อดำเนินการต่อสำหรับ DBs เชิงสัมพันธ์ใน Node ฉันชอบบทความที่น่าสนใจ แน่นอนฉันยอมรับว่ามีบางกรณีที่เหมาะกับการใช้งานที่ดีเยี่ยมจริงๆ แต่ฉันต้องการแสดงความคิดเห็นในบางสิ่งบางอย่างที่เป็นบิตของสัตว์เลี้ยงของฉัน peeve - ฉันต้องการคุณ wouldn t ตรงกันข้ามกับฟางคนที่ไม่มีอยู่จริง ระบบแบบดั้งเดิมในการทำงาน 1 ไม่มีเซิร์ฟเวอร์ spawns ด้ายต่อคำขอใช้สระด้ายหรือสระว่ายน้ำกระบวนการ 2 คุณว่าค่าใช้จ่ายของการเปลี่ยนบริบทเช่นถ้าใช้เฉพาะกับ OS เธรด Userspace เฟรมต้องถูกบันทึกและโหลดในทางเดียวกัน Plus OS ทำมันด้วยคำแนะนำไม่กี่ใช้ประโยชน์จากการสนับสนุนเฉพาะจากฮาร์ดแวร์ - ซึ่ง userspace สามารถ t ทำ 3 ในทำนองเดียวกัน userspace หัวข้อฉัน e เฟรมหรือ closures ถ้าคุณ don t ต้องการพูดกระทู้ใช้ทรัพยากรหน่วยความจำในหัวข้อ kernel เดียวกันทำมัน s ไม่เป็นถ้าเธรดระบบแต่ละคนมีวงเงินของมันเต็มจัดสรรจัดสรรเพื่อให้การวิเคราะห์ที่ไม่เป็นธรรมระบบปกติอย่างสม่ำเสมอมีมากกว่า 4000 โดยไม่ต้องมาที่ใดก็ได้ใกล้ที่คุณได้ตรึงไว้ 4 ปัญหา BIG กับโสดเธรดพร้อมคือการขาด ขนานแน่ใจว่าคุณสามารถจัดการหลายพันคำขอต่อวินาที แต่เพียงหนึ่ง CPU บนเซิร์ฟเวอร์หลัก 40 ของคุณกำลังจะทำ Anyways ทำงานใด ๆ Anyways ทั้งหมดข้างต้นเป็นเรื่องเกี่ยวกับย่อหน้าสวยรองในโพสต์ที่ดีเยี่ยมของคุณโหนด ISN T จริงๆผิดนี้ก็แค่ว่ามีจำนวนมาก FUD ออกมีรอบหัวข้อและกระบวนการที่คนมักจะใช้เพื่อปรับการออกแบบบ้าและหลีกเลี่ยงหัวข้อเมื่อพวกเขาจะสมบูรณ์วิธีการที่เหมาะสมสำหรับส่วนใหญ่ของ situation. All คำแนะนำของคุณเกี่ยวกับ การคำนวณปพลิเคชันหนักไม่สามารถจะผิดมากขึ้นมันเป็นความจริงอย่างแน่นอนที่พยายามคำนวณหนักแบบอินไลน์กับวงจรการร้องขอการตอบสนองเป็นความคิดที่ไม่ดี แต่เดียวกันอาจจะกล่าวว่าของสภาพแวดล้อมแบบเกลียวถ้าคุณมีการดำเนินงานที่ถูกผูกไว้ซีพียูก็ sa ความคิดที่ดีที่จะ จัดการกับกระบวนการของผู้ปฏิบัติงาน JavaScript และโหนดโดยเฉพาะอย่างยิ่งเป็นสิ่งที่เหมาะอย่างยิ่งสำหรับการจัดการการคำนวณแบบแพร่กระจายโดยเฉพาะอย่างยิ่งกับการสนับสนุนรูปแบบการทำงานที่ดีหากคุณเขียนอัลกอริทึมโดยใช้ฟังก์ชันที่บริสุทธิ์และแจกจ่ายภาระงานให้กับพนักงาน กลุ่มเครือข่ายการสนับสนุนที่ดีเยี่ยมของเครือข่ายโหนดเพื่อให้เป็นสภาพแวดล้อมที่เหมาะสำหรับการประมวลผลและการประสานงาน คำสั่งของขนาดได้เร็วกว่าทับทิมที่ทั้งสองมีประโยชน์มากขอบคุณมากคุณไม่ต้องการที่จะปิดกั้นกระบวนการที่จัดการคำขอของเซิร์ฟเวอร์ใด ๆ แต่ไม่ได้หมายความว่าคุณไม่ควรทำคำนวณหนักหลังเซิร์ฟเวอร์ตราบเท่าที่กระบวนการทำ การคำนวณที่หนักจะเกิดขึ้นแบบอะซิงโครนัสจากกระบวนการเซิร์ฟเวอร์ของคุณคุณยังคงสามารถปิดกั้นกระบวนการของคุณได้หากคุณค้างชำระ แต่นั่นก็เป็นความจริงกับเซิร์ฟเวอร์ threaded แบบดั้งเดิมซึ่งจะทำให้ฉันออกไปเป็น Noob ยักษ์ แต่คุณสามารถให้ได้ ฉันตัวอย่างของการดำเนินการ blocking ใด ๆ ระบบไฮบริดดังกล่าวฉันคิดว่าใช้ในการประมวลผลคำขอโดยเพียงแค่วางมันลงบนคิวกระบวนการเพื่อให้ส่งกลับข้อความไปยังลูกค้าที่ระบุบางอย่างเช่นการคำนวณแล้วมีอิสระที่จะดำเนินการต่อด้วยการร้องขอต่อไป คิวกระบวนการที่จะสามารถเรียกใช้ผ่าน thread ที่แตกต่างกันหรือแม้กระทั่งหลายเธรดเป็นและเมื่อเสร็จสมบูรณ์เหล่านี้พวกเขาส่งผลลัพธ์ของพวกเขาไปยังคิวซึ่งจะถ่ายทอดกลับไปยังไคลเอ็นต์เดิมแน่นอนว่า thi s หมายถึงรหัส ID บางความต้องการที่จะมาพร้อมกับแต่ละรายการในคิวนี้เพื่อให้แน่ใจว่าข้อมูลที่ถูกต้องจะถูกส่งกลับไปยังลูกค้าที่ถูกต้องอะไรเช่นนี้เป็นไปได้หรือแม้กระทั่งการใช้งานแล้วบทความที่ยิ่งใหญ่ขอบคุณทอมลาร์ขอบคุณบทความนี้เขียนได้ดีมากและรัดกุมเรา เคยใช้ MongoDB และร่วมกับ AngularJS สำหรับผู้ใช้ที่กำลังเผชิญหน้าอยู่ 2 ปีแล้วและไม่เคยคิดเลยว่าเคยเปลี่ยนกลับไปใช้ Flash หลังจากประสบการณ์ 10 ปีหรือ JEE RDMS ดังนั้นจึงทำให้ JS มีภาษาเขียนโปรแกรมเพียงภาษาเดียว , หนึ่งรูปแบบข้อมูล JSON และ paradigma โปรแกรมหนึ่ง Async, wow. That s โดยไกลคำอธิบายที่ดีที่สุดออกมีเกี่ยวกับฉันจนเข้าใจว่ามีประโยชน์มากในสถานการณ์บางอย่างและไม่เพียง hype ขอบคุณมากนี้เป็นข้อมูลมาก Node ทำงานได้ดี กับฐานข้อมูลเชิงสัมพันธ์เพียง don t ใช้ ORM SQL isn t ที่ยากที่จะเรียนรู้ แต่ที่ฉันคิดว่าเราเป็นอุตสาหกรรมได้มากกว่าความคิดในการเขียนทั้งหมด SQL ด้วยตนเองเครื่องมือที่ดีสำหรับการดำเนินงานทั่วไปเครื่องมือที่ ju st ได้รับออกจากทางเมื่อจำเป็นในการเขียนข้อมูลเฉพาะบางอย่างด้วยตนเองมิฉะนั้นลดความเป็นไปได้ของข้อผิดพลาดและปัญหาด้านความปลอดภัยที่เกิดขึ้นกับนักพัฒนารุ่นจูเนียร์มากขึ้นไม่ว่าเราต้องการหรือไม่ Hei Adin ให้ฉันแสดงความคิดเห็นกลับ 1 สถานการณ์เดียวกันเกิดขึ้นมี sa จำนวนข้อ จำกัด ของเธรดที่ให้บริการลูกค้าจำนวน จำกัด 2 3 งานนำเสนอที่อ้างถึงแสดงการวัดและตัวเลขบางอย่างคุณอาจจะค่อนข้างถูกต้องใน internals แต่ภาพรวมคร่าวๆทั่วไปยังคงยืนเป็นการเปรียบเทียบทั่วไปของวิธีการทำงานระหว่างสิ่งทั้งสองโลก 4 ตัวเลือกแบบขนาน ยังกล่าวถึงภายในบทความ - เป็นกระบวนการของผู้ทำงานเบื้องหลังหรือกระบวนการโหนดหลายหลังพร็อกซีแบบย้อนกลับหรือมี Node clustering API ซึ่งยังอยู่ใน Experimental แต่จะมีในที่สุดขอบคุณสำหรับความคิดเห็นที่ดีและความคิดเห็นที่มีคุณภาพเกี่ยวกับบทความด้วย ข้อมูลเพิ่มเติมฉันขอบคุณ it. Yes คุณสามารถมีกระบวนการของผู้ปฏิบัติงานหลายคนได้สื่อสารผ่าน Message QueQue MQ คนเหล่านี้สามารถ แยกโหนดกระบวนการเป็นโหนดเป็นแบบเธรดเดียวเว้นเสียแต่ว่าคุณทดลองใช้ clustering API - I haven t พยายามยังเป็น API เป็นอย่างมากในช่วงต้นและอาจจะไม่สมบูรณ์ แต่สามารถภาษาอื่น ๆ ฉันได้ทำงานในระบบดังกล่าวซึ่งวิ่ง C ใน Mono สำหรับการประมวลผลพื้นหลังในสถาปัตยกรรมแบบกระจาย CQRS การคำนวณใด ๆ ที่ช่วยให้ซีพียูไม่ว่างจนกว่าการคำนวณจะเสร็จสิ้นการจินตนาการถึงการดำเนินการบางอย่างที่ต้องใช้เวลา 2 วินาทีในการคำนวณ Hit ที่มี 100 เครื่อง - คุณจะได้รับความล่าช้า 200 วินาทีหมายเหตุบทความที่ฉันมี referenced, which explains the blocking of the event loop. Yes, that falls under the idea of having backend worker processes in a distributed system As the system is distributed, those workers can use any language platform, including Node. Thanks for your feedback I agree on that completely, for worker processes you could use JS when it fits, and that implies as that s what runs JS on the server, but you can also use other languages that do the particular work at hand fast. For ORMs in general, I just see them as a tool that can get something done quick for a newbie, but end up really gumming up the works later on The closest thing I use for an ORM is a PDO wrapper which I borrowed and rewrote from an old co-worker , that helps with writing PDO statements. Apologies for the wall of text Excellent discussion 1 Agreed But threads and processes are powerful tools That s why a hybrid of threads processes and event systems typically does best in the real world Like the much beloved nginx 2 3 Sorry, I may not have been clear When I said FUD regarding threads and processes, I meant the referenced presentation It s just a bunch of specifically tailored microbenchmarks designed to prove a certain point Which is fair, given that it s a lightning fair and can be a bit polemic In fact, it s a great talk But these synthetic micro-benchmarks are not the basis for a fair and through comparison To say the difference between nginx and apache benchmarks is purely beca use of context switching is an extreme oversimplification Nginx is specifically designed to serve requests really, really quickly in common circumstances IMO generally by a tight coupling with the latest OS event systems, etc You could specifically measure the overhead of context switching, and I would wager it s trivial 4 But then aren t you at the mercy of the horrible process overhead the referenced presentation talks about -- can t have it both ways To be clear, my position using threads processes or whatever is not in and of itself a problem There are way more important design factors there, the OS overhead of those entities is pretty trivial Hence I hate it when people adopt a silly design based on the idea thread-are-bad or processes-are-bad or some other such nonesense. Everything always needs to be put in the right context I have presented possible situations, to analyze each one deeply I d need a book - Still, I really appreciate your comments and insights, they are valuable a ddition to the article Thank you for those. When use as api server, and the back-end db is the bottleneck, if the clients are the other applications, not user interface, can we just let these client requests hang there waiting for db operation complete sine can handle massive concurrent connections easily Is a MQ necessary in this scenario In my opinion, is right the queue. ORM does not exist to make query languages easier , it s a tool used to encapsulate database concerns, isolating them from the application There are several benefits, but ultimately, it makes applications easier to test and maintain years down the road Excuse the tangent, nothing to do with node. Yes, you could, but Ruby would be a poor choice if your aim is performance. thank you for a great article By using the child process - would you be able to overcome the high computational blocking Fibonacci issue. any real life examples. What of the Facebook example you used When a user clicks on the like button there is an immed iate acknowledgement but the data is written later Cant that be an example of node used with relational db Anyway what makes up the message queue. Maybe go-lang is alternative choice. This article is great, except for the part where it says don t use NodeJS for computation because it doesn t have threads Since when do we need threads Run child processes The only advantage to running threads over child processes is shared memory Last time I checked, any system large enough for this entire debate to be relevant anyway is going to span multiple servers anyway, their by nullifying any benefit of threads So, get it out of your head that NodeJS can t do CPU intensive work And, if you can t, contact and we can fix all the stuff you built wrong with NodeJS. One application that few people use, but could be really fanastic, is using NodeJS to build a desktop application There s plenty of packages out there - personally, I favour Node-Webkit. Hi, nice article However I would like to point one thing, NodeJS is not running in a single thread The programmer doesn t have to spawn new threads, they are handled by node itself on event basis NodeJS is evented, each function call per event will run in a separate thread That approach encourages writing lighter functions If your function does a lot of computation, reactor it into smaller ones and they all will run in separate threads Think about the example where you process file while streaming That is possible thanks to threads. Great article BTW, what software did you use to make the images wireframes. This is very well written Thank you for this. The technique used to avoid exceptions bubbling up to the surface is passing errors back to the caller as callback parameters Excuse me, but that seems misled In my understanding, Node-style i e the pattern of passing errors as the first param to callbacks are a side-effect of the event queue returning control as soon as possible to allow for concurrency itself rather than a design to avoid inter rupting flow The fact that exceptions do not bubble are actually quite often a source of errors, especially to newcomers. Great Article Wondering who made the beautiful diagrams. Great article, thanks BTW, which tool do you use to draw the images. For those that are curious, it seems the images were created with Adobe Photoshop CC I checked this by looking at the EXIF data of one of the images File Size 61 kB File Type PNG MIME Type image png Image Width 624 Image Height 600 X Resolution 72 Y Resolution 72 Color Space sRGB Color Mode 3 Compression Deflate Inflate Orientation Horizontal normal XMP Toolkit Adobe XMP Core 5 5-c014 79 151481, 2013 03 13-12 09 15 Creator Tool Adobe Photoshop CC Macintosh. Also, the fact that javascript is not able to check type compliance introduces dificulty in expontaneous organization of huge number of coders updating the same codebase simultaneously. mmmm disagree, if you use correctly a good ORM take a look at Mature ORMs you get also a distributed cache of your Relational Database that allows you more performance for the same bucks and more scalability of your sistem ORM is not just for easing the life to newies It is non sense to use a non-blockin sistem such as if at the end you get blocked at your Database But using a ORM that way, is not for newbies. Glad you mention, most people don t mention this. I d rather keep Node decoupled from the browser and keep the flexibility of running the frontend on platforms that normally don t run Node like smartphones. For that matter, since you can do an async shell to a console application, you could easily write your worker in, for instance golang, and then use a generic pool to limit your cpu workers from there, you can shell out to a more efficient worker You can also do that for CPU intensive JS as well, I did this for my scrypt-js module there are binary modules that are more performant, but I wanted one without compiled dependencies It s not that hard to queue work to other systems, and no rea son node can t be used to orchestrate said work. Could could use an intermediate system such as TypeScript, you can also use a linter jshint and even require a level of test coverage in order for release Getting 100 test coverage is generally very easy in scripted environments Would suggest looking into Mocha, Chai, and Proxyquire If you aren t writing unit tests, type safety really doesn t give you much. I am beginning to find quite interesting However, the paradigm it appears to be promoting is hardly new to IT In the mainframe communications world we called such capabilities, re-entrant , where a single process could handle a high level of calls to it Microsoft implemented similar capabilities with its Singleton object infrastructure and I imagine the Java world has done similar implementations Oddly enough, the Microsoft recommendation for enhancing scalability across the wires to back-end services was to promote the Single Call object structure or one object instance per calling req uest Thus, the argument made for is actually contrary to the Microsoft recommendation BTW, a recommendation I never quite understood In any event, as a business developer, I am not sure if I would find any use for a implementation, though our web designer may On another note, I would like to add my own opinion on the use of ORMs ORMs are great tools when faced with an existing database structure against the requirements of a new application as the ORM can handle a lot of the mundane, repetitive coding that is usually found with any database application However, because ORMs are high-level layers, they are usually not the most efficient options to use against databases whereas direct access through native providers are In many respects, better to do the repetitive coding for efficiency over applying a heavy-weight interim layer such as an ORM. Very interesting observation I d like someone to elaborate a bit more on that I would like a more concrete example, like some piece of concrete co de calling an async heavy-computational function, and someone explaining what happens if that is run in a multicore equipment Does the thread that was sercing requests gets blocked Or another thread is used for that. Node is terrible as a web server Even the creator suggests that this is not what Node is intended for, and that it should be leveraged for it s strengths JavaScript Everything , just like worker processes, is ludicrous. This is ridiculous Node was built with the web as first class, and it excels as a web server It is rapidly replacing Ruby and PHP in many enterprise organizations because it has demonstrably boosted both application performance reduced page-load times, etc and developer productivity. You can in fact create multi-threaded servers using to offer more stable performance but it does take a lot of extra work see the built-in cluster module and the childprocess module I have created a framework which runs on multiple CPU cores and solves much of the issues discussed in this post Check it out. Connor James Leech. does something like solve the node relational database issue. Yes - see the queue pre-forked worker pool approach adopted by Summarised here. yeah, I was wondering about it too great visual awesome post. Erick Ruiz de Chavez. Just to complement what Tracker1 disqus said on his comment, JavaScript is usually criticized about the type checking and many other misunderstood features, like this , but the truth is that JavaScript is just very different to what most of the developers are used to do, and most of the developers who sadly have bad comments about it are just those who haven t had the interest or the time to understand how it really works JavaScript development is not only about the language itself but also about the tools you use to work with it, to mention some more you should really take a look at Grunt, Uglify, Yeoman, CoffeScript, etc. Erick Ruiz de Chavez. I might as well make myself a giant noob, but to put a quick example, any disk I O operation is considered a blocking operation as it has to perform a physical operation to read some data from the disk Another blocking operation example is querying a DB, where you basically have to wait for the response before doing anything else I d say, any sort of computational operation will be as blocking as the time it takes to complete In any of the above examples, you usually have your blocking request on line A and line B wont be executed until line A is completed instead is asynchronous, so line A is requested and then queued, and line B is executed no matter if line A is completed or not when line A is complete, you are notified either with a callback or with an event and then you can continue doing whatever you need to do with such result. Very helpful article. npm install felixge node-mysql That might be the most useful repository I ve seen in ages. Erick Ruiz de Chavez. I have a small example of mysql and at. How about Why the hell would I read an article without an obvio us date and time stamp. Nice article, indeed But, hfuti disqus, you re wrong in saying NodeJS is not running in a single thread each function call per event will run in a separate thread As far as I understood, the main NodeJS event loop consuming your JS code in fact runs in a single thread All potentially blocking and or long-running tasks like disk I O is delegated to and executed by libuv as part of the node runtime engine which spawns a limited number of threads made available as thread pool Said this, it s obvious that the main event loop thread is not affected or blocked by other yet again asynchronous code execution So, for example, file I O with the fs module itself is implemented in a non-blocking manner - in the end as good as the OS kernel allows non-blocking operations Of course foreign processes or threads could always be spawned by custom modules or 3rd party services worker processes And yes, there are runtime env projects handling more than one node process and their th reads on the same machine or cpu cluster But that s another story Feel free to correct me if I m wrong. This is fantastic. Very well written article You put a lot of thought into it Quick node express question I am I am adding rapid data entry, not batch, data entry to my system I have a form mfntapes that works great I have a test form joe the prompts for the number of times I want to call the mfntapes form The gist contains the code, fails to work, the after prompting for cnt attempts to call for mfntapes cnt times The question is how to call form mfntapes x number of times where x is a vairable See lines 45-55 of. ORM for real projects are useless hone. Nice article - SERVER-SIDE WEB APPLICATION W A RELATIONAL DB BEHIND I wonder why Node is not good for that You have promise based SQL libraries like Knex which enables non-blocking queries Node has no opposition with relational databases it has no interest with blocking I O drivers only Relational or not relational. I wish NodeJS was not almost systematicallty presented as THE de facto alternative to the traditional threaded webserver Async IO is not exclusive to NodeJS Most major languages out there - including Java and PHP - have async IO frameworks similar to NodeJS This wiki page lists most of them I m not saying NodeJS doesn t have its merit, but I m sick and tired of seeing people flocking to it as if it s the only async IO stack available, and the only alternative to the good ol PHP or Rails stack To be honest, we may be stuck with Javascript on the browser, and will be for a very long time except if Javascript becomes just another target platform language thanks to but I can t come up with any good reason to use it on the server side in favor to other available languages Most of the alternatives are just way better as a language, have better standard libraries, tools and resources Please stop spreading Javascript on the server, it s creepy p. Jarle Leopold Moe. How would you upload files What about Directory inte gration Active Directory, Open Directory What about communication with external services All request depending on a response from any of these types of services would block the calls is single-threaded it s only applicable for certain types of tasks. These re great examples of why Node is so much better than the competition at web services None of thee are blocking operations in Node They re asynchronous While other servers waste resources spinning off separate threads, Node fires off an event-driven asynchronous operation and keeps taking more requests in the meantime The practical upshot is that porting web services from PHP or Ruby can deliver between 2x and 10x improvements in simultaneous connections and typically 30 - 60 improvements in average response times Lots of big companies are doing web Node projects just for these reasons, including Adobe, Paypal, eBay, Walmart, Yahoo Groupon, Under, etc. very nice article and very clear thought regarding where to use and where not. Every m ajor application development platform has already had support for HTML5 for the past several years, including websockets for bi-directional communication Add to this the strong types, multi-threading and the tons of other stuff that languages such as Java have to offer and I seriously question why anyone would waste their time using this. Just want to mention that node is not the only server side option for javascript especially since oracle put the nashorn javascript engine on the jdk Now you can also use all the jvm goodness from javascript we are using vert x as the async server and nashorn to use javascript You can see some code samples in this module the project site is. This is an amazing overview Thank you. Very well written Thanks for sharing. I m with you For trivial application an ORM is fine You have to remember that most devs really only have experience with trivial applications So they will argue for an ORM because they can t learn SQL or don t have the time or staff to right stored procs And they have never heard of Memcached and so think the ORM is a cache what ever And the weirdest excuse I hear is about decoupling The ORMs I have had the misfortune of running across do the opposite They very much tightly couple the UI to the database ORM layers are large and buggy So how do you test it Yeah, good luck unit testing it which you have to do because they are buggy. If you are integrating with AD then you are probably in a Microsoft shop And if you are uploading files to a web server then your environment isn t very sophisticated So for you, you probably should just stick with IIS and. Microsoft public recommendations for architecture are a joke Microsoft is a marketing and licensing company They are not a tech company primarily. If you have a huge number of coders updating the same codebase simultaneously you have larger problems Dev teams don t scale well I would run With too many cooks in the kitchen the broth will spoil There is going to be no accountabilit y and no responsibility with that many people contributing. Why Node is different - using bar as analogy. a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href a a href here a a href here a a href a a href a. Just to let you know you have support support in How it works under-the-hood is pretty interesting Compared to traditional web-serving techniques where each connection request spawns a new thread, taking up system RAM and eventually maxing-out at the amount of RAM available, operates on a single-thread, using non-blocking I O calls, allowing it to support support tens of thousands of concurrent connections held in the event loop. Isn t it possible to get the date of posting of your article or all your posts for that matter It is really disturbing to read technical posts without dates thanks. You mention is good for a chat application because it s not CPU intensive I can t think of too many use cases that don t require much CPU For example, could Twitter be built with Node It seems there s a lot of computation required just to generate your feed uses certainly can t be so narrow. Great article Thanks There s an old joke you re not a paranoid if they re really out to get you That s the attitude that should be taken when it comes to Web application security One thing that bothers me about is that I have no insight into how secure it is When an environment like Grails, where I have Java Groovy running on Tomcat I have some confidence in Tomcat security, if for no other reason than the fact that Tomcat has been around a long time and has evolved This isn t true with I was also looking at the libraries At least for the file access, it appears to be not hing more than a thin layer over the POSIX file system calls I like the Java or even the C file abstractions more The main argument that I see for made in this post is that it has really lightweight threads and that you can have JavaScrip everywhere This last issue is an attraction for those who only know JavaScript As far as the light weight threads, this is not so much a language issue as a platform support issue It should be possible to support this kind of thread model in another language. Toptal designer did the design for them. your comment is ridiculous too, ORM is not a everyone s accepted pattern. The irony is that lambda s aka, anonymous methods are the basis of both javascript and the preferred technique for C s multiple implementation of the same callback pattern, albeit with full type safety In fact node s major characteristics 2-way, lightweight, asynchronous has effectively been implemented in C as SignalR , and there are several language features which are both asynchronou s and natively multithreaded, unlike Now I could understand if your experience with ORM s was limited to Hibernate absolutely awful, one of the worst implementations of a major concept I ve ever had the displeasure to work with or even EF, which at least is fairly powerful and expressive due to LINQ, if data nanny overkill But a micro-ORM like Dapper gives you all the flexibility and power of direct SQL with the benefits of rich data manipulation via objects, and is fast, very fast And I m sorry, but OOP is a well proven, very effective design strategy if you know what you are doing, i e you are a pro I see three major problems with the approach that no one seems to have a good answer for So you start with the premise that there are such inefficiencies in waiting for IO that there is a huge potential there So yeah, you ve got great concurrency, right until you get to the first blocking library, a database, a file server, etc, which is practically every major piece of functionality writ ten So it s just hurry up and wait for 10,000 connections instead of 100, ok that s something, but where does it get you So then you start rewriting all those services asynchronously, but that s just a snake eating its own tail, because that s hurry up and wait too Because in the end every database on earth ultimately comes to a magnetic arm skipping across a disk or reading solid state memory, and that s assuming you re on the same machine, as opposed to distributing data across a pool of far slower network connections Then you have the single threaded issue There is probably no more misused language than Javascript because the barriers of entry are so low And while early adopters might understand a bad practice when they see one, most javascript programmers simply have no idea what they are doing Thirdly, Javascript is not exactly a particularly fast language, so the advice seems to be don t do compute intensive tasks Where does that get you So you end up with an elegant solution to one category of issues, but you re trapped there, with no way out of the non-compute intensive, hurry up and wait ghetto. Wow, that is one seriously ignorant statement Uploading files to webservers is THE stated rational of s inventor for why he wanted a non-blocking library So when you fanboi s break out of the single threaded, slow dynamic world of cut and paste code with zero type safety, multithreading, and only one trick pony lambdas to match s multiple asynchronous capablities, all so that you can get 10x more users to hurry up and wait for IO , then you can lecture us about sophistication The framework has a vastly more advanced feature set than any language you can name, period, and IIS, properly configured, can beat the piss out of Apache and can readily match nginx as a reverse proxy or for static content In the end you ve got several problems which are intractable 1 Javascript is slow, and your technology of choice is single-threaded, so intensive compute tasks are off the ta ble 2 Javascript debugging and testing blows in comparison with any typed language Pro s use extensive testing, not fly by the pants hey it works 3 The everything is modular approach is not an architecture, it s an invitation to chaos, like Perl or PHP 4 Concurrency doesn t buy you crap if all you are doing is waiting for some other IO bound process, which is pretty much everything worth doing with computers 5 The quality and experience of many javascript programmers not programmers necessarily, but it s popularity will bring them is remarkably poor, as demonstrated by comments in which fanboi s prove that they have no idea how other systems that actually don t ignore any computing problem they can t solve work. ORM is just a work around for the problem of impedance mismatch, nothing else Its not big deal, about OO its a cross paradigm like AOP and its not really based in nothing else beyond encapsulation Without procedural paradigm OO does nothing, every real skilled programmer already knows that. Impedance mismatch involves all sorts of ramifications, especially in regards to maintainability, portability, extensibility and performance To quote Ethan above since my explanation obviously didn t take it s a tool used to encapsulate database concerns, isolating them from the application There are several benefits, but ultimately, it makes applications easier to test and maintain years down the road about OO its a cross paradigm like AOP and its not really based in nothing else beyond encapsulation Without procedural paradigm OO does nothing Ok, I ll be sure to spread the word that we should stop fooling around with all this esoteric OOP stuff and get back to a language that lets us do everything vis-a-vis encapsulation VB6 You d think a Javascript programmer might want to mention inheritance, if not polymorphism, since javascript has a relatively unusual mechanism for it prototypes. A singleton is an instantiable non-static object with a private constructor so that only a single instance can be created Imagine an instance class with a static property exposing an instance of itself that depends upon a private instance constructor It was actually implemented in Java before existed Perhaps what you are thinking of is a non-blocking Callback mechanism, which is handled in C via delegates, events multicast delegates and the new async and await keywords that transform standard C into a lambda to be executed at compile time It also handles multi-threaded asynchronous operations via it s Parallel extensions, which permit spreading load across multiple threads cores as long as that work is not serial in nature Also, I would encourage you to check out a micro-ORM like Dapper It s far less comprehensive than EF, but it s far more flexible and gets out of the way, plus it s significantly more efficient than Hibernate and EF about 5x faster for reads. Yes this article rocked tits Esp good for a Croat with ESL nodeboy. So after reading your article I still havent fi gured out why Node js want to reinvent the wheel I still think node js and the likes are crap. A great introduction to find out what it is JavaScript and once the answer to from a href bagaimana tips mengatasi wanita frigid a. Noob questions Um, isn t the ease with which you can move request data i e untrusted data into database where data is assumed to be trusted a big hazard How do you ensure that you never forget to inspect every piece of incoming data when it arrives, before you start trusting it Generally, I would assume something as popular as would have thought of this, but I remember back when Rails had blanket model update That changed real quick when Github s use of this feature was exploited fortunately, by a whitehat Also, of course, just because you add a conversion speed bump does not mean that people won t make mistakes, but at least they re more likely to give it some thought, which probably means they re going to make less mistakes. I don t understand the angst against us ing an ORM Were you in a proper environment where concerns were separated The ones bashing ORM just sound like they don t know what they re doing or how to engineer proper software Why on earth would I want to go from writing software in Java C whatever to drop into SQL where it is hard to version, properly test, and can apparently cause severe brain damage Everything is a double edged sword - an implementation or a convention like using an ORM over raw SQL really doesn t matter Depending on the situation raw SQL might be best it might be better to use a NoSQL store maybe an ORM is fine Usually, from my experience, I can tell you that an ORM is better for a lot of reasons, and they have been relayed by M I spent the time to write my own libraries to abstract vendor specific implementations and you need to create your own mappings You can easily spawn from a certain state or use existing data structures It took time to write my libraries and it was not easy at all to do it but it was we ll worth my time to do it since I can now reuse my libraries Is it the BEST I don t know I like it but I certainly won t go around to arbitrary technical articles that have nothing to do about SQL and post something like Yes this technology is good but stay away from raw SQL I just don t see a need to be bashing anything here, especially an ORM when the article is exclusively about JS and NodeJS. Probably one of the main points of this article, that gives Node is supposed scalability, is the offloading to a Queue or Service Bus that leads to asynchronous processing That is a well proven architectural pattern, available in many languages, is especially used in CQRS Command Query Responsibility Segregation with Event Sourcing, is very well suited to be used by technologies such Reactive Extensions that provide considerably greater functionality and flexibility than Node Asynchronous programming and handling its pitfalls has been around without Node for years, if you had knowledge of enter prise development As for the hate against ORMs you guys crticising it seem to be moving from front-end development into an area where you have no knowledge or expertise in OO, BDD, TDD or any other proven Enterprise level methodology No concept of integration other than Twitter feeds No experience of complex Workflow or scalable caching This is one of the dangers - you know JavaScript, and a bit of SQL So everything else is superfluous - until you need it, such as the attempts to bring an element of type checking to JavaScript Seriously, each technology has its place, but there is no one size fits all approach Appreciate the strengths of each technology, and use them where appropriate. Great introduction to Thanks, i samo naprjed. Because they suck for a complex application Sure if your scenario where you spent all this time trying to make the ORM work the way you need it to, you could have just put that same effort into writing the SQL properly and making sure it s organized etc and you would be further along in the project and have more control over the application ORM s are great at saving time on a small to medium scale project, but once you delve into more complex and larger applications, you re going to spend either A A lot of time coding to make the ORM work the way you need it or B Just decide to write the SQL yourself because the time it takes to make the tool work how you need it just isn t worth it. Very great post you add. JavaScript is better than some of the other programming languages therefore a href cara menghilangkan gatal keputihan a better fit with JavaScript. Great, informative article Thanks for sharing this a href Unlockpwd a. Its very good post thanks. Pot, meet kettle Those may be intractable problems if any of them were true None of them are 1 a JavaScript is all JIT these days and delivers 1-2x native code performance faster than any other dynamic language I m aware of b Non-blocking by default can deliver orders-of-magnitude improvements in code efficiency - transparently 2 Almost all modern editors support type inference for JS ESLint, Closure Compiler, and a number of other options offer sophisticated static analysis capabilities TypeScript even offers a nice structural type system 3 The opposite of modular is a tightly coupled monolith That s a bad idea in ANY language 4 if all you are doing is waiting for some other IO bound process - Non-blocking by default means you re NEVER waiting for some other IO bound process That s why Node delivers such huge improvements on resource utilization 5 2006 called They want their language-snob attitude back The days when serious engineers considered JS to be a toy are long since over JS powers sophisticated enterprise applications at just about every fortune 500 today Additional point JS is the only language with fully native support for isomorphic code meaning you reuse most of your application on both servers and clients You can write JS ONCE, and it will power the server, the web br owser, and mobile devices including iOS and Android See React Native.1 1-2x native code performance Do the electrons run faster on node code Not a good start 2 Type inference is mapping variable declarations to types without explicit syntax, i e a it requires actual types, and b compilers enforce type safety, not editors And you can dress it up any way you want, but there is no way to enforce sophisticated state analysis with slop-tastic dictionaries of whatever stored in strings functional delegates Also, Typescript is not Javascript, it is Javascript with a half-assed type system pasted on top Even Google is abandoning Js for Typescript in Angular 2 0 Why Because Google has decided that an untyped system is insufficient for serious work But is that type system anywhere near as sophisticated as a compiled language Nope, not even close 3 You are misunderstanding what I was characterizing as modular design The alternative is not monolithic code, but encapsulation, specialization via inh eritance or prototyping , polymorphism, and externalizing dependencies via IoC The alternative is SOLID, i e modern Object Orientation 4 Your process may not be waiting, but your customers are waiting for the callback My point is that being able to serve more requests doesn t do you any good if every served request then has to wait on yet another operation In the end, somewhere somehow, you will eventually be going to a disk or waiting for IO, because that s where the information the customer wants lives 5 I didn t say that JavaScript was a toy language, I said that most JavaScript developers are well-meaning, cut and paste amateurs, and they will invade the ranks of developers as it becomes more popular I ll take a strong type system over full native support that s not native for isometric code that can run on clients or servers you say that like that s a good thing any day Wow, Js on android and iOS I guess the days of Apple adding another strongly typed, native language for iOS are over sarc Obviously you ve never heard of Mono, the cross platform that compiles and runs on every major OS, produces native runtimes for all three major mobile platforms, and runs on everything from beowulf clusters to wearable devices This is why we don t respect you You don t know or understand anything that came before, or anything outside of your javascript bubble You don t solve any problems that weren t solved before, but yet you re convinced you have all the answers That seems to be a common theme with anyone whose education system stressed self-esteem over critical thinking. This reply just strikes me as willful ignorance 1 Really Rather than investigate and learn the truth, you just want to ridicule the answer I m not taking the bait Watch Brendan Eich s Fluent talks if you re interested in actually learning something 2 I know what types and type inference are, and I know the benefits of static types I ve been in this game since before JavaScript was invented TypeScript is a s uperset of JavaScript that compiles to JS allows for sophisticated static analysis It s structural type system is better than the type system Java had back when I was coding in Java, and it s much better as in more reliable and flexible than C and C 3 encapsulation, specialization via inheritance or prototyping , polymorphism, and externalizing dependencies via IoC - these are all forms of modularity, and JavaScript modules provide viable alternatives to all of them - and in the case of class inheritance, it s far superior See 4 your customers are waiting for the callback Fortunately, that s where the performance I talked about in point 1 shines JS provides efficient utilization of I O resources In fact, dealing with I O bottlenecks is the entire reason that Node was invented I ve ported several large production projects from PHP and Ruby to Node, and seen dramatic reductions in response times, both average response times and response time ranges - and since a typical Node app utilizes a small fraction of the memory required for C applications, your customer I O competes less with the RAM paging you might experience with a compiled C application 5 you say that like that s a good thing I ve seen objectively measurable increases in team velocity ranging from 40 - 60 improvements Believe it or not, it s a fact, and being more able to adapt to changing needs and experiment more particularly in the UI layer delivers very real business value Why do you think so many enterprise organizations are adopting Node It s not because some dev prefers JS It s because they ran the tests themselves and figured out it s a huge win Obviously you ve never heard of Mono, the cross platform that compiles and runs on every major OS Yeah, I have - what I haven t heard of is Mono delivering anywhere near the value that Node delivers in enterprise production Got a good article on that Cause a quick Google search isn t turning up much Check out this awesome result in the top 3 of the SERP but a quick Google search for Enterprise delivers quite a bit Here are the top 3 search results I see There s really no contest here.1, yes, I m mocking your evidently accidental claim that JavaScript makes electrons run faster, or even as fast as native, because it s patent nonsense Not only is that impossible, it ignores one of acknowledged weaknesses It sucks on compute intensive operations, because it s single threaded, which means compute intensive operations block execution duh 2 Your knowledge of Java does not qualify you to understand what a competent type system is Java s generics are a largely useless, johnny come lately me-too feature when compared against to C generics because they suffer from run-time erasure, in other words, the generic type safety and reflection only works at compile time, because at run time, everything is cast to an object So when you are going on about static analysis, you are effectively trying to claim it s as good as compile time run time type reflecti on, which is very far from the truth 3 Meh Chopping up everything into discrete functions is a form of modularity too, but it s vastly inferior to SOLID, which was my point in the first place And while prototype based inheritance is interesting, it s hardly better than real inheritance, which permits far more flexible arrangements 4 I don t see how it s impressive to speed up a Ruby app, or refactor some craptastic PHP into something faster Your memory overhead claims are equally baseless I can run on a watch or on an arduino device I can write that runs very well on an under-powered phone Look at the memory chrome consumes for an SPA, or try to run a complex javascript app on a tablet, and then tell me how lightweight JavaScript is 5 The lack of a proper separation of concerns which is the cause of most maintainability problems is the number one issue I encounter at enterprise scaled customers, and an impressive team velocity is always how they got there Why do I think a number of org anizations are choosing node Because typically a mediocre, over-sized team of moderate competence f d up the previously shiny new thing that was supposed to solve all their problems, so they want to believe the hype that the problem is not them, but their previous technology choices.1 I think you misunderstood my meaning JS runs 1-2x SLOWER than native -- much better perf than any other dynamic language I know of It s fast enough to run AAA game engines like Unreal Engine and Unity in stunning quality at 60 fps 2 I actually think that a good native type tool would be a good addition to JavaScript, but only if they re user-definable structural types That said, JavaScript does support static analysis via type inference, and there are a number of ways to provide type hints for dev tools In addition, JavaScript also has an impressive array of runtime analysis tools 3 hardly better than real inheritance, which permits far more flexible arrangements Wrong 4 My apologies I was not aware of Ja vaScript also runs as-is on low-powered devices including Arduino, Tessel, and a number of others Node works great on most of them If that s not small enough, you can create a custom Node compile, drop features, even swap out the V8 engine for a different JS engine if you need to You can also restrict yourself to using tiny JS libraries of which there are many on npm to keep your codebase compact 5 they want to believe the hype that the problem is not them, but their previous technology choices That might explain an experiment or two, but the Node takeover is much more than that We re rapidly replacing apps in a variety of languages with Node Having worked at a fortune 500 during the transition to Node, I can tell you our justifications We did experimental ports to Node, found 1 that the app was faster and more reliable, delivering huge wins in both average response time, and the number of requests we could serve with the same machine, and 2 The developers were more productive for a va riety of reasons, including the fact that JavaScript specialists could more easily work on both sides of the stack without context switching, and a lot of code could be shared in both the server and the client Those advantages have real, measurable influences on the company s bottom line That s why Node is taking over at both startups and enterprise companies. especially with edge it is really handy. Thanks Tamisalv I was looking for quick reference read for understanding and why projects might use it Reading this gave me a better understanding of advantages of this this technology and also when one might use it Cheers. After over 20 years of stateless-web based on the stateless request-response paradigm, we finally have web applications with real-time, two-way connections As a result we have webpages which take longer to load nowadays when we have Internet speeds in the order of megabytes per second, than back in the day when our speeds were in the order of bytes per second but our webpa ges were plain simple HTML Nowadays we have webpages which load halfway and then stop, which crash at the slightest network error i e dynamic IP address reassigning, or a momentary lapse in the WiFi signal forcing you to reload the whole page, whereas browsers are designed to gracefully handle those errors or resume once the network connection is restored, buggy Javascript scripts don t handle errors as well. I only have 1 question here with your statement It s structural type system is better than the type system Java had back when I was coding in Java, and it s much better as in more reliable and flexible than C and C I can not take that How can you examplify Some Facts with obviously answer in no - Why did Node inventor used V8 engine which was made in C to power node, if the js type system was so flexible and much better - Can nodejs decode vp8 codec video by itself as efficiently as C C - Could you build nodejs on top of pure javascript instead of C - Is there any such thing as pur e javascript You really have to understand my friend that it is a type system that can take advantage of underlying hardware and makes your program efficient at CPU and memory Strongly typed C can solve any problem, even build node js Node shines at non-blocking i o and that is about it, it can not do anything else Yes you can chop-off node code and make it work on micro devices but will it be efficient and make sense Can you make product like node where you have to code in C , yes you can but it would not make sense as power of C C in not in web, its optimizations and hardware It not like non-blocking I O is something new, we have had that in many technologies including java Net, basic, python and perl, this is very old The only reason why this thing is in limelight is it has enabled millions of frontend javascript developers, who do not understand pointers and bash about C , to write server code, which is simply overwhelming, that s why the buzz And about Node in particular are actua lly very well suited to handle distributed computation , why on earth one would write such a statement Node is not made for computation it can not compute as efficiently as C C Java Period With all due respect, lets not bring C in picture here, there is simply no practical comparison at all, or it will be very touchy. You may be interested in this. Actually, Javascript in the V8 server engine is QUITE fast The statement that Javascript is not fast is outdated You combine Node with Chrome and you get a very fast environment If you understand how Node works, it has an event loop that processes all code that is ready to run So, you call a function that has a blocking database call inside and a callback when finished, it allows the the function to be called, which returns immediately allowing you to get on with other things while the database call is being processed So you aren t hurry-up and waiting as you suppose You get on with other things, and once the database call finishes, execution will continue to the callback which is invoked after the database call returns So, you get the same basic abilities as a multi-threaded environment without all the extra overhead incurred by thread-state swapping Because you don t get time slicing you have to be careful that no piece of code takes too long to run, and if it does, you just break it up using packages like async I come from a long C, C , Delphi, Java background, having mastered the multi-threaded paradigm, and I can state assuredly that the Node single-threaded async paradigm is super cool, fast, and highly scalable IF YOU KNOW WHAT YOU RE DOING But that s the same for any of the other technologies as well None of these technologies are for neophytes. A complex application is precisely where well tailored Domain objects and properly decoupled subsystems are most necessary If you are spending all your time trying to get the ORM to work you should either learn that ORM better or get another ORM I would assume the former goes without saying so if you are still fighting your ORM it s time to choose one that just works. Excepting your last comment that these technologies are not for neophytes, I think you are ignoring the last two paragraphs you were responding to Even the founder of says to avoid compute intensive operations Yes, V8 speeds up javascript, but that doesn t solve the problem of a compute intensive operation or IO dependent operations blocking a single thread You then respond that is non-blocking and therefore it can be awaited Great, I got that, sure, but what are you waiting on Some code that isn t written in apparently, so much for the claimed benefit of one true language to rule them all , because your single threaded process is happily moved on to something else until the callback So, works great just as long as you can rely on other processes handling the workload that is blocking like waiting for IO , or another instance of single threaded that will if written correctly undoubtable kick t he can down the road to yet another process And that s the issue there are a limited subset of stuff done in programs that can be executed in parallel out of order, and or doesn t rely on blocking operations Multi-threading is more complicated and has some overhead every time there is a context switch, but it means that more cores can be thrown at parallelizable units of work, and even discrete operations can be handled by the different threads In a solves everything world, you are either relying on something not written in or waiting for your single threaded application to finish up all the stuff that must be done, one way or another. You know what You seem to just like spouting on about something you are clearly not qualified to speak about You obviously have never built anything serious in Well, I have, and I can tell you that it works great if you actually program it correctly That means you use things like job queues, you use the clustering that Node provides, you make sure you do everything with callbacks and promises, you use async and setImmediate to properly share the processor between code that is waiting and code can now execute, you make sure UI code has priority over CPU intensive code, etc For example, I wrote an async heap sort algorithm that works great, sorting massive lists while not blocking for any appreciable amount of time I also have a 5000 line heuristic algorithm that is quite complex that I split up so that the main loops are executed using async constructs I then have these executed from a job queue called Kue that allows for efficient use of all cores, no threads, great UI response time, and complex calculation jobs being executed in the background using all available processor power This is ALL done in javascript with excellent performance in both CPU intensive tasks and response to front-end data requests In other words mate, the UI is super responsive, and the background processing complex heuristic calculation performed quickly and ver y responsively This is all done with a single language for both backend and front end, which is a huge deal when it comes to system architecture. Why are they not for neophytes Is it alcoholic. I agree Most times that I think an ORM is inadequate for complex queries, I write out raw SQL, later to find out the ORM has an app for that I like using an ORM as much as possible, but I won t spend too much time making it work for me, otherwise, as M said, I ll find another ORM. Sounds like the words from a Michael I know I agree with your last statement each technology has it place But why do you assume all Node developers are front-end developers with no back-end knowledge Why is it NOT possible for these developers to make a scalable solution Like or not Node is being used in Enterprise today and will continue to be adopted. Javascript is a poor choice of language for enterprise complex development It is messy, difficult to read, difficult to organise, doesn t support an entire raft of OO para digms that save a lot of code repetition and provide readable abstraction, predominantly gives run time errors, no AOP, no by convention, no reflection, no generics templates, no precision of scope, no rich low level processing, and it is not type safe We are stuck with it in the browser, and frankly it is only inertia and legacy support that means it is still used there In all rights it should have gone the way of the dinosaurs 10 years ago The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications that had constant bugs that couldn t be tracked It has only been a short 10 years since we breathed a huge sigh of relief when serious development moved off of scripting languages and here we are doing it again unwilling to learn from the past, convinced that this is new and cutting edge , rather than just old, tired and regurgitated It will end up the same way as it did last time, being talked about with disgust like classic asp and perl cgi I can only conclude the developers championing it now were just not around to see the fallout of this last time around Every new generation of developer is convinced they have discovered the truth , those of us who have seen this cycle of pain just have to sit back and shake our heads in disbelief Unfortunately you can t teach experience, it is something you have to learn the hard way Sure if you are an amateur and know nothing else then by all means, but anyone trying to do a professional job needs to leave this alone and stop making populist technology choices without considering the outcomes If you can t evaluate the long term limitations of a technology for yourself you shouldn t be working in development Developers need to stop being so childish, acting like a bunch of deluded fan boys, this is a serious business, not a game. OMG Eric Are you for real Do you even know how Nodejs works Did you even try to look at backbone of Nodejs Just download yourself a source-code and checkout IT IS IN PLAIN C C is C lib libuv is another and single most important C library in nodejs backbone which makes nodejs async, event driven and non blocking Javascript by itself is body without a soul and life JAVASCRIPT is just a script that you use to script your logic One day if smeoene ports lua with this libs, he will not need Javascript to code same for python etc But the basic fact remains the same IT IS C code that makes what nodejs is, not that javascript is too fast in fact javascript is slowest in all of the scripting language So don t flatter yourself in believing that just java-script is great and other things are shit And do not insult C C if you have no knowledge of it So, again, i urge you to take back your words Javascript type system is better then C Javascript has no type system and if you still believe that it has one, you are in a very wrong field, go build some scaffolding Also, these companies are not choosing nodejs for the reason you men tioned This is possible in almost all languages The reason why companies are choosing nodejs is that, they get ready made javascript coders, which are in millions and can not do c java code, to do server side because it is cheaper Another reason - its ecosystem Yet another reason - Its lot easier to conduct load tests in nodejs than other scripts The link you mentioned is work that is intended to be started Why do not you suggest them that please write this web-assembly compiler in nodejs rather than c c assembly because according to you that is superior C Mon man, how can you compare Nodejs A technology with a C language they are not in the same league C makes node possible, its not visa versa. The main driver to move away from scripting languages was that they were a maintenance nightmare and led to ball of mud applications -- could you clarify what you mean by scripting languages, and what replacements serious developers migrated to over the past ten years I was pleased to see a refe rence to Django in the article and have not run across maintainability issues caused by the use of Python, SQL, or ORMs in general On the contrary, Python is my go-to language precisely for its maintainability Your criticisms of js are spot on, but I can t see how they apply across the entire universe of scripting languages. Well I define scripting languages as runtime compilation languages, but there is a lot of overlap these days I prefer the reassurance of compile time verification of at least coding accuracy but that is not the only factor The depth of invasion into the inner workings of the compiler that tend to be exposed by compiled languages these days allow for a whole range of design constructs and patterns that allow programming to be more intelligent , I just don t find this level of sophistication in the scripting languages I have used It is a severe limitation for serious enterprise development ORMs are an ugly approach to data access on relational databases, but you would probably have to be a database developer to realise why Data design and Program design have different constraints, ORMs do either an injustice or have to be modified so much that they provide no productivity There are many issues such as security, isolation, atomic operations that ORMs break, and remember a database is a living system and may require changes in between code releases as a matter of course ORMs are a blunt tool if you want real performance from your database and want high concurrency without locking Its a detailed subject I could probably write a book on it, so sorry if this isn t conclusive enough for you Can t say much about Python other than I have heard good things in general I m the other end of the market on I crucify the open source guys next door in productivity and my defect level is about 1 of theirs I think you need a large system before it makes significant differences, as you need to invest in framework and substrate to get the main benefits back, its mass coding that is the enemy here When you have over a 100,000 code files you need a higher level of maintainability as it is simply beyond human capability to do it file by file and certainly beyond maintenance budgets By making core services that consume code as content you can achieve a high level of quality while keeping everything granular and ensuring release are small and targeted rather than entire system drops Each to their own, but if you are an IT pro you must have seen the millions of script based systems festering away in businesses because no one can find anything or understand how it works It s such a common complaint I should think it doesn t need justifying. P S I think serious developers have migrated to either Java, C or back to C along with their associated web techs etc I wasn t really intending to be derogatory but these three probably account for 90 of all commercial development atm C wins out on the commercial front for me solely on Microsoft s considerable ongoing i nvestment and new found modernist approach C is not very productive and Java is really starting to look a little dated Still I work in all three and they get the job done, each have their place. P P S Python is my go-to language precisely for its maintainability What do you consider maintainability It is often not what people think it is or is not as simple as they think It encompasses the cost of change and that is the primary cost on the business for a living project Example I have a service with 1000 public methods and the business asks me to de-prioritise all calls that take over 2 seconds If I have to modify any of the code in those 1000 calls then my code has seriously poor maintainability What I should be making is one code change in my service substrate pipeline I should not even be modifying the substrate I should be probably writing a statistics module and a de-prioritise module for that substrate loaded in a separate dll that can be loaded dynamically Now my testing is isolat ed to just this dll reverse harness testing and when ready for release I can add this dll and maybe make one small config change, that s it, no regression testing and no risk to existing code, so no production bugs in the service methods So many typical code bases would require all 1000 methods to be altered or at least marked for an AOP operation Enterprise design requires upfront anticipation of future crazy business requests I find with most scripting languages and even with Java that finding insertion angles later on is nearly impossible Even if I have a complete mare in C I can emit the code directly into the methods using reflection, I have never seen this level of access on a scripting language and even if it was there it would be dangerous code to emit into runtime compiled operations because I am literally changing the operations content so I would need to test the result of each This is just one example I could probably come up with 100s I m a technical architect framework an d substrate so it is my place to save my devs from backing themselves into a corner If I do a good job I can reduce the coding and testing effort to 1 of a mass coded system There is a whole other level of development that most devs will never see or appreciate, this means they are never equipped to make the most appropriate technology choices. Interesting article, I ve got quite a bit of experience in other realms but I m somewhat new to There s a few things I d like to clear up Flash was always async as well, it merely emulated threads much like it sounds like node does by using an event queue However, I believe it is technical ignorance to claim that trusting thread management to a 3rd or 4th generation language would be better than trusting a well-tuned JRE or operating system optimized for it s multi-core chipset How exactly do you think threads work in the lower levels anyway It isn t some magic , the only way to get true simultaneous code execution is via multiple processors, som ething you simply can t accomplish with a single thread It s also a mistake to say that a new event does not add memory or clock cycles taken to a stack just because said events are managed by an interpreted scripting language rather than optimized, compiled C I d bet my lunch that a well-written multi-threaded web application written in C or C will blow away any app performance-wise, and that s even without getting into servers and their current multi-core processor architecture If you ve got a quad or 8-core server running a single node thread you re only firing on one piston quite ironic that Google calls their engine V8 when considering such a fact Another thing to realize is that while Flash or even Java applets ran in their own runtimes, so does node -- it s just hidden to the user That is nothing more than good perhaps hostile business moves on Google s part Lets be honest here, if all browsers came with Flash automatically installed on them, and Apple actually supported Flash o n their mobile devices, node probably wouldn t even exist today I have other concerns about security What kind of protection does it have against cross-site scripting and other attacks Earlier today I stumbled across a TOR Bittorrent client that ran in my browser window, and after opening it my computer wouldn t shut down nicely it scares me to think what it could have been seeding No warnings about security or what types of connections my browser window was opening up, just went along with it s P2P business the hacker side of me could have a real hay day with those kind of features I doubt that kind of stuff has been tested much either which means there s a lot of room for bugs, and where there s a lot of room for bugs there s a lot of room for vulnerabilities But hey, at least your entire stack is all in the same language Means you can hire less experienced developers for less money, right. Good Article for Node JS, you can learn Node JS online in or send a email. You could remove all the pitfalls of JS by using the its superset aka TypeScript. Tldr Use node for IO-heavy processing and delegating CPU-intensive processing to a cluster of specialized worker nodes ex database, media processing, etc This isn t exactly new information I covered this topic back in 12 Ideally, the and API servers should be mostly stateless excl session management and disposable They re just a functional pipeline that translates the raw data into consumable representations That way, the servers are easy to provision destroy dynamically to meet the spikey nature of demand I m not sure why so many of the commenters are vehemently arguing in favor of multi-purpose vertically-scalable server architectures By nature, vertical scaling will always have an upper limit predicated by hardware capacity No matter how efficient the code is The writing is on the wall You can spend a fortune on hardware and lose sleep questioning the validity of your risk assessment aka WAG At the end of the day, bare meta l is a fixed asset Best case, it meets expected demand and justifies the cost Worst case, it either costs more than it s worth or lacks the capacity to meet demand Alternatively, you can embrace distributive computing and automate the infrastructure to grow contract relative to demand For the people fighting religious wars over which language is best, node C java Who cares All 3 allow functional-style programming All 3, support async processing natively or through extensions All 3 can be managed via provisioning All 3 are perfectly valid for building distributive infrastructure Choosing which one to use depends on the quality of the tools, whether or not it will be used to extend existing infrastructure, and the perception of the client Build whatever you re good at building If you re really good build whatever is easiest to implement, support, and generate the most profit or save the most on cost BTW, kudos to the author It s nice to see somebody do a comprehensive and mostly objectiv e writeup on this topic. Yes, both languages support horizontal scaling with asynchronous message management infrastructure CQRS is nothing but an API implementation pattern CRUD is the typical use case as it should be but Node doesn t automagically scaffold 1 1 mappings between DB and CRUD see rails laravel django for that Node isn t a framework at all, it s just a server You can leverage frameworks ex Express to more easily leverage the full power of Node but you still have to fine-tune your routes to define a fully functional API Net Reactive Extensions have been ported to JS In fact, even LINQ has been ported to JS yes, seriously ORMs are only an issue because they require an additional layer of abstraction from the underlying data If read when the data models need to change to adapt to business demands, both the ORM and the database schema will need to be updated and tested to reflect the changes Which is not really a big deal if there s a good update strategy in place As for the r est of your comment, you d do well if you stepped out of your comfort zone once in a while to see how JS development really works 1 JS classes are currently supported now via ES6 also, available client-side via polyfills Prototypes really aren t much different than classes in terms of encapsulation except they re a lot more flexible Compile-time static type checking is even supported via TypeScript Dart if that s what floats your boat, it s just not the default 2 TDD BDD isn t a feature exclusive to statically typed languages There are a lot of great testing frameworks available in JS both server client-side Choose your flavor, unit testing Mocha , behavior driven unit testing Chai , api testing SuperTest , and continuous integration testing TravisCI, and many others are all used extensively throughout the community JSUnit the JS equivalent of JUnit NUnit is even available if you miss unit testing in If anything, testing is a basic requirement of any non-trivial JS app that goes into p roduction because you don t have a compile-time type checker to hold your hand 3 Complex workflow Seriously So, you ve never heard of NPM scripting, grunt, gulp Automating any-and-everything in JS is pretty easy Style enforcement, linting, documentation generation, scaffolding, one-click-deployment, language transpilation, bundling, distribution building, package dependency management, release management, etc 4 cringe if you rely on the compile-time static type checking system alone to validate user input, you re doing it wrong Building a data layer in any language requires constraints above-and-beyond what the default types provide So, either way you ll have to extend your data models with custom validation checks The cool part about handling validation in JS is you can use the same routines to check user input on both the client server-side Less duplication of effort FTW Contrary to what you think Javascript really is a one size fits all approach if you prefer to use it as such Serio usly, you can even compile C C directly to javascript using Does that mean you have to use it Of course not Any developer with a speck of sense wouldn t fault you for choosing C , it s a great language I have experience writing code in many languages, including building non-trivial desktop applications in C Given a choice, I d prefer to use Javascript The mix of, looser constraints and functional imperative prototype styles allow for a level of creativity I haven t experienced in any other language The tools are great, the module system is amazing, and the language itself is getting substantially better with each update. Upload Files All the I O operations is handled by is using multiple threads internally it s the programming interface to that I O functionality that s single threaded, event-based, and asynchronous Libuv uses a thread-pool to handle I O operations files, sockets, etc in an asynchronous manner Where most languages block by default during CPU-heavy I O operations, Node do esn t It simply fires an event when the I O operation completes on the worker thread Active Directory. The distinction is that Node is async by default So, the number of developers doing async programming in other languages are the minority so they re not as well represented I can t come up with any good reason to use it on the server side in favor to other available languages Not gonna lie, using Node at first was Challenging to say the least Getting used to async-by-default is not an easy transition The nice part Node is, the primary focus of the platform is building servers clients so the ecosystem has a lot of powerful tools to do anything dealing with web development have better standard libraries, tools and resources I m not sure what gave you that impression It doesn t use the monolithic-everything-and-the-kitchen-sink base class library approach The core itself is very small but that s a benefit as it s much lighter to deploy It also includes a very powerful, full-featured packa ge manager by default so you re expected to add the dependencies your project needs NPM Node Package Manager has over 200K packages and counting Since the majority of the modules are developed independently from the core, they iterate and improve much faster than the equivalent core libraries in other languages Dependencies are managed locally on a per-project basis in the file Typically, it s bad form for a module author to require that their package be installed globally Installing packages locally prevents version conflicts at the global level and guarantees that -- when you install a package -- everything required to use the module is included It may seem inefficient at first glance because many dependencies may have copies of the same sub-dependencies or sub-subdeps, etc but compared to the cost of including a massive standard library, the storage space is insignificant The workflow to setup a project is - clone the source - run npm install NPM will automatically download and inst all all of the dependencies incl sub-deps, sub-sub-deps, etc Since the dependencies and their specific versions are explicitly defined in the config, you don t need to check them into source control In addition, with ES6 incl the new ES6-module-loader about to be released, a new JSPM Javascript Package Manager has been created to manage client-side javascript dependencies Module imports in the browser have finally been formalized in the language spec, so Bower and the variety of module-loading pseudo-standards ex AMD, CommonJS, UMD will go away. As said above modern OO languages have a vast array of options to formalize and control your code and solutions that are lacking in scripting languages That s just the plain truth, no amount of griping is going to change that My point is there are a lot of developers choosing technology by popularity rather than suitability, that s what makes them fan boys Right tool for the right job, applies in every trade apart from software development appar ently But that is probably because most developers aren t true Tradesman , more glorified DIY ers The industry is full of amateurs who don t even know enough to know that they know nothing They think because they can write an if statement and a while loop they are pros Techno-weenies. System level I O operations such as files, sockets in Node are handled by libuv which does use a background thread pool The difference is, the main thread can fire and forget the task to a background thread and the background thread will notify the main thread via firing an event when the operation is completed Even with background thread processing, doing lots of I O operations doesn t scale very well For long-running CPU-heavy tasks ex image movie encoding offloading the tasks to worker nodes is still preferable In most languages, I O operations are handled in a synchronous manner so if they requests are made on the main thread, they ll block execution until completed The reason you don t see a noticeabl e pause in the UI when this happens is because the UI is asynchronous event-based and runs on a thread separate from the main context. There s nothing stopping you from exposing the API as a microservice WebKit just allows you to run a native JS client I may be wrong but from what I understand, unlike the browser a webkit client isn t as strictly sandboxed so you can make system calls ex to open save files without user input. I think you made my point for me, frothing unthinking, emotional nonsense, with very little in the way of fact, from a mind so fanatic about one thing it can t even see its failings You seem to have made a fair few assumptions about what I do and don t know, I have been doing Javascript for 20 years, I know its short comings, I can work effectively in probably 30 languages, I use what is appropriate, I never indicated otherwise You need to grow up or find a new industry to work in People like you are the problem with Software Development, no nothing nobodies who can t even make a case for a technology, let alone use one Please stay away from the keyboard and do the rest of us a favour. Do you use version control with a standard workflow ex Gitflow workflow where developers make changes on feature branches and code is peer reviewed before being merged I ve been messing around with trying to build an Angular2 website lately and the Angular2 project is still in early alpha so breaking changes are a regular albeit unfortunate occurrence All of the available examples online are pretty-much broken so I ve been monitoring the project development on Github The rate that the core developers are thrashing on the codebase is truly remarkable What s even more amazing is that every PR is unit tested and continuous integration tested well enough that every release is guaranteed to be fully functional as far as they ve implemented it so far. Following what Tracker1 is saying Linting is the equivalent of compile-time checking in JS I even use a Sublime extension t hat shows linter errors directly in the gutter of the editor as I m writing code If you want stricter checking you can add a style checker such as semistandard which guarantees code styling on a project-wide basis That means, spaces-not-tabs, indent 2 spaces, consistent functions, curly braces, etc Type checking is good for superficial bugs ex uninitialized variables, dead branches, invalid values but eventually you ll have to verify the code doesn t have logic bugs through unit testing, continuous integration testing, api testing. Node uses async event-based I O via libuv incl a thread pool reserved for I O requests The main thread absolutely does not block during I O operations It works the same way cluster would except it s built into Node Check out one of the presentations on libuv for more details. Performance wise, PayPal seems to think good things about Node For security, the cors module is pluggable to Express and can be used for all the usual CORS control stuff The helmet module -- also pluggable to Express -- exposes a small suite of features to protect against malicious users including additional cross site scripting protection I m not sure if I d call a Fullstack JS dev inexperienced Having a solid understanding of multiple domains in a development ecosystem that is constantly evolving is maddening ya know, 10 years of experience vs 1 year of experience 10 times. hasn t even been around for 10 years which is funny considering I have seen job postings actually asking for 10 years experience with it I understand that following evolving technology is a challenge, and after 20 years I can tell you that by the time you get completely comfortable with any full stack it will be less relevant because technology is always advancing Nothing will change that, it s just how things work However, you can t really have your cake and eat it too there Newer technology is less tested and therefore less secure, but older technology does not have as many features There s always a trade-off there Anybody who claims otherwise is selling you something. I am sold on if your application is into building high scalability networking applications , is the way to go in 2015 No wonder why so many startups and large corporations are adopting it C , Java, Ruby and Python havew their place in their respective domains New companies and products will be getting built on wide vari ety of languages I predict ROR adoption would still be high in coming years for building web applications simply because ROR developers are easily available and time to market is so small Excellent article though Tomislav. So true My job is the maintainance of legacy apps usually SQL Server dB s ms access or pop fronteds These were usually made by the grandson who is good with computers Kind of guy No foreign keys, but custom date time functions Your post is my sentiment exactly. I find Java very unproductive and very expensive for a lot of low level tedious work C is for programmers who can handle memory access pointers Most corporate programmers cannot Back in the day you had PL 1 and C for software engineers and COBOL for information technology programmers. thanks this is so helpful as i am going to make a heavy-computation enterprise application i think i ll try on other application for now, i ll use ruby on rails. When this article was written. Thanks for this article I think than the argument of same langage for front and dev is the worst I can liste or read Organized good coding with js is the more horrible things append in a team I work since last year on backend project and where this should be coded in some times with mature framework like django it took too much time understand hundreds bugs Where mongodb feels cool Never I realy thinks than nodejs is a big joke and not So cool The package manager give us some cool package to patch and hide the bad side of node but there is nothing to do about the callback hell Finally the code looks like a big sand box than i hatte to open a file for debug or add some lines of code So my conclusion is than for small app why not but for big and evolutive project not use nor nodejs and mongodb Regards. This is a fairly ill-informed comment as ES6 was alive and well as at a year ago Besides the OO from ES6, there is also TypeScript which adds even more enterprise-level OO to JavaScript Like is compiled, TypeScript may also be tr anspiled to Javascript NodeJS allows for pretty much of all this now with an even still better utilization of server resources and no OS lock-in Think cutting your infrastructure costs by 2000 because you really shouldn t need to scale too vertically or pay for that license per node Fintech companies like Paypal are happily doing great things with node as well so I highly doubt this comment of yours comes from a place of non-ignorance about what NodeJS eco-system truly offers the enterprising product. I really wanna be able to try out but it s such a pain in the effing ass to get something running Installing a simple app always turns in to a list of things you need to do, install shit globally which is NOT always possible , edit files, try to figure out what the damn devs mean in their scant instructions It quickly goes to shit if you do the slightest thing wrong If it s so great why hasn t anyone figured out a way to make simple installers with this thing. Ghost blogging platform. David M Tromholt. Yeah it would be nice with a date I assume they don t show it because they know how biased people are towards new information but it doesn t make much sense to hide it in an article about a fast growing technology. Hi Avinash, Can you please eloborate little more on your statement I am trying to understand more on this. Would node be a bad idea for something like then Would you need to do any image manipulation on a different server to prevent blocking. Hey Tomislav, Great article I wanted to know that if suppose I want to get external hardware output in my app, e g, scanner or e-signature if user is doing e-signature or getting scanned copy from scanner , then can i get directly in my app it will be like an api call as we do in Java. TypeScript is syntactic sugar wrapper on top of standard JavaScript and compiles into standard JavaScript It is invented to make the code maintainable and allows it to be used more like a real programming language Given that you have to use JS wher e appropriate it makes writing it more familiar to real programmers and makes it maintainable That said, anything JS and Node is appropriate for thin, lightweight web apps that need to be put together quickly and efficiently, for which things like JSP, Ruby etc are a bit of overkill Believing that one can not use the new magic Node for everything just because one guy can write front and back end is amateurish. Encapsulating a language with another language, which you have to translate will add overhead Also there are things that don t translate, just in real life translating between language, you loose something In this case you loose speed having to translate from one to the other , and optimization, because of reason one ORM s don t do it all In the beginning, I was for ORMs, then I dove deep into it and you end up with How do I do this , Oh you can t easily, you have to do 10 other queries , or you end up with stuff that just seems like it should work well, but you end up wrecking th e performance ORMs are for simple Select blah blah from table where x y. Hey, is there a library tool you used to creste the graphics. Praveen kumar Pamani. Thank you for this article I would suggest this article if people want to know what is node and what can we do with nodejs.

No comments:

Post a Comment