22
Full-Stack-Development with NodeJS 携携 Mobile/Online 携携携携携携

Full stack-development with node js

Embed Size (px)

DESCRIPTION

Recall: n-Layer Code Structure & Org Structure What’s NodeJS Who are applying NodeJS Why considering NodeJS for Ctrip Risks & Issues Demo & QA

Citation preview

Page 1: Full stack-development with node js

Full-Stack-Development with NodeJS

携程 Mobile/Online 应用场景分析

Page 2: Full stack-development with node js

Agenda

• Recall: n-Layer Code Structure & Org Structure

• What’s NodeJS

• Who are applying NodeJS

• Why considering NodeJS for Ctrip

• Risks & Issues

• Demo & QA

Page 3: Full stack-development with node js

n-Layer Distilled – Tech Stack

Technology Center

e-Commerce System (frontend + backend)

Controllers, Svc Proxies

Presentation Layer

Application Layer

Domain Layer

Infrastructure Layer

Aspx/ServletHTML/JS

Ascx/Taglib/JSF

DAL Fx/Svc, Data Access Layer, etc.

ADO.NET, JDBC, ORM, etc.

Framework, Utils, etc.

JobWS Svc Proxies

FrontEnd BackEnd

SOA/Asmx/WCF/Servlet/RESTful SvcUtils

OOD & DDD

WinSvc

Page 4: Full stack-development with node js

Code Arch to Org Arch – Ctrip Samples

• Ctrip Flight Dev Team– Frontend Presentation + Application– Backend API (SOA) + Domain + Data

• Ctrip Hotel Dev Team– Data Dev Team DB/SQL/Repl/DAL

• Ctrip Fx Dev Team– Frontend Presentation + Application– Backend API (RESTful) + Domain + Data

Page 5: Full stack-development with node js

Code Arch to Org Arch – Int’l Flight Team

GDSConnectors

GDS Amadeus Sabre Galileo 中航信

Every App分销Online Offline无线

APPSNS航空公司

资源共享平台 API

预订订单搜索 出票查询 配送 其它

Presentation Layer (View)

Application Layer (Controller)

Domain Layer (API)

Infrastructure Layer (internal)

Infrastructure Layer (external)

Frontend Dev Team

Backend Dev Team

Page 6: Full stack-development with node js

Agenda

• Recall: n-Layer Code Structure & Org Structure

• What’s NodeJS

• Who are applying NodeJS

• Why considering NodeJS for Ctrip

• Risks & Issues

• Demo

Page 7: Full stack-development with node js

What’s NodeJS

• 2009.5 Ryan Dahl 发布于 GitHub ,总排名 #3

• 基于 Google V8 引擎的 Web & Socket Server

• 使用 Javascript 编写服务端代码,前后通吃

• Single Thread, Event Driven, Non-blocking IO

• Light-weight, Scale-out, Cluster-enabled

• 接近 70,000 NPM (Node Packaged Modules)• 成熟的社区,热情贡献者, Full-Stack 呼声

Page 8: Full stack-development with node js

Who are applying NodeJS ( 国外 )

• LinkedIn– 2012.10 将所有移动应用服务从 Ruby on Rails 迁到 NodeJS

• Groupon– 2013.10 将所有应用从 Ruby on Rails 迁到 NodeJS

• eBay– 2012.3 在 GitHub 发布 ql.io 框架,可认为是 Service Aggregator– 2013.5 发布第一个线上 NodeJS 项目

• PayPal– 2012.4 使用 NodeJS 在 6 周内完成支付系统重写– 2013.1 在 GitHub 发布 Kraken 框架,两年内将大规模使用

• Walmart 2014 年底电商平台全上 NodeJS

• Google, Yahoo, Netflix, AWS, Azure, etc.

Page 9: Full stack-development with node js

Who are applying NodeJS ( 国内 )

• 淘宝– 淘宝指数、数据魔方、时光机– CNodeJS 社区

• 网易– 2012.11 在 GitHub 发布 pomelo 框架– 移动推送、 Web 推送采用 pomelo 框架构建

• 腾讯推送、百度推送、搜狐推送、新浪微博 DB Proxy

• 去哪儿、点点、花瓣、雪球、小米手机销售、 etc.

• 携程 DVF RESTful API 、 Real-Time Crawler (Open House)

Page 10: Full stack-development with node js

携程最新进展:

1 、框架已构建 Ctrip NPM Repository

2 、 Clog via edge, SOA via Node native

3 、门票 v5.8 H5/Hybrid 接入 NodeJS

Page 11: Full stack-development with node js

Agenda

• Recall: n-Layer Code Structure & Org Structure

• What’s NodeJS

• Who are applying NodeJS

• Why considering NodeJS for Ctrip

• Risks & Issues & Countermeasure

• Demo

Page 12: Full stack-development with node js

Why considering NodeJS for Ctrip• 高性能,可减少服务器 (non-blocking IO, IOCP on Windows)

• 开发效率高,减少集成 (Same Javascript + Less Integration)

• 易于修改和维护 ( 由管道连接小模块构成 )

• DRY Principle : View & Controller 共用一套验证逻辑

• Frontend == View + Controller , Controller 是短板

• Controller == Model (SOA 1.0/2.0) Composing & Tailoring

• 适合 IO-intensive 场景,不适合 CPU-intensive 场景

• 机票、酒店已做前后端分离,可在前端团队尝试

• 强烈建议看这篇文章:淘宝基于 NodeJS 全栈开发

Page 13: Full stack-development with node js

Frontend & Backend – Tech Stack

Page 14: Full stack-development with node js

Risk & Issue & Countermeasure

• 思想理念的转变 Controller from C# to JS

• 团队分工的转变 Frontend Full-Stack-Engineer and Full-Stack-Development

• 同步开发模式 异步开发模式 + 严格异常处理

• 框架支持 Clog 、 SOA 已验证没问题,可稳定运行 (demo) , Cfx 需扩展,但不动核心, CI 原生支持

• 运维支持 NodeJS module for Zabbix

• 其它 SOA 支持 NodeJS module for SOAP/REST

• NodeJS & NPM 框架 & 系统研发 (C/C++/Driver 支持 )

Page 15: Full stack-development with node js

请收藏两个 Mail Groups :

1 、技术支持: RDkjts

2 、产品建议: KJCP

Page 16: Full stack-development with node js

Demo #1 – ql.io for service composing & tailoring

Page 17: Full stack-development with node js

Demo #2 – Send log via Clog .NET client

Page 18: Full stack-development with node js

Demo #3 – Send log via SOA 2.0 client

Page 19: Full stack-development with node js

Demo #4 – Visit .NET Service via SOAP

Page 20: Full stack-development with node js

Demo #5 – One rule set via nools run @ both node-side and browser-side

Page 21: Full stack-development with node js

Demo #6 – One js via browserify run @ both node-side and browser-side

Page 22: Full stack-development with node js

Q & A