Your SlideShare is downloading. ×
KSDG meet-up #1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

KSDG meet-up #1

960

Published on

2012/05/03 node.js 雲端應用實例

2012/05/03 node.js 雲端應用實例

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
960
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. May 3, 2012node.JS雲端應用實例
  • 2. Web再進化 - 很久很久以前 ·• 事件發生仰賴 Refresh rate·• 互動性差·• 即時性更差©2012. KKBOX Inc. All Rights Reserved
  • 3. Web再進化 – 不久前… ·• 事件觸發單向從Browser發出·• 互動性略好些·• 即時性還是很糟©2012. KKBOX Inc. All Rights Reserved
  • 4. Web再進化 – 現在 ©2012. KKBOX Inc. All Rights Reserved
  • 5. 現在網路服務的需求 ·• 互動功能多·• 即時性要好·• 網站上朋友要多·• 最好正妹也要多©2012. KKBOX Inc. All Rights Reserved
  • 6. 使用者需求越來越多(高?) ©2012. KKBOX Inc. All Rights Reserved
  • 7. 但… ©2012. KKBOX Inc. All Rights Reserved我們回不去了…
  • 8. 我們碰到的瓶頸 ·• 主要後端語言PHP·• PHP 很讚– 好開發/效率不差– 除了寫起來有點醜– 要做 Comet / Web Socket 也可以©2012. KKBOX Inc. All Rights Reserved
  • 9. 我們碰到的瓶頸 ·• 持續連線數量大時·• php-cgi 會卡很大·• 加機器?·• php-cgi 實在很肥…©2012. KKBOX Inc. All Rights Reserved但…
  • 10. 所以需要找個連線成本低的方案 ·• Javascript: node.JS·• Python: Twisted, Tornado·• Ruby: Event Machine·• Java: Jetty·• Erlang….©2012. KKBOX Inc. All Rights Reserved
  • 11. node.JS 優點 ·• Javascript大家都會寫·• 連線成本低, 處理連線效率高·• 大量開發者投入, api 完整度越來越高·• 有Joyent、Microsoft等商業公司投入·• UNIX like / Microsoft solution都有不錯支援©2012. KKBOX Inc. All Rights Reserved
  • 12. node.JS 注意事項 ·• 不適合大量運算場合·• single thread serves js runtime– non-blocking I/O, 但寫爛程式還是 blocking– 謹慎控制每個 callback 執行時間– 嚴格管控變數 scope·• Multi-core CPUs 需要自己管控·• JSON -> JavaScript Object Notation– 但是在 node.JS JSON.stringify/parse 跑不快– 還好 0.6 終於補回來©2012. KKBOX Inc. All Rights Reserved
  • 13. KKBOX哪邊用到 node.JS? ©2012. KKBOX Inc. All Rights Reserved
  • 14. KKBOX一起聽©2012. KKBOX Inc. All Rights Reserved點播歌曲點播歌曲點播歌曲創作者 / 演唱者聽眾聽眾聽眾素人DJ直接互動直接互動歌迷互動
  • 15. nodeslavenodeslavenodeslavenodeslaveKKBOX一起聽 服務元件 (原型) ·• node.JS slave·• node.JS master·• memcached·• Mysql©2012. KKBOX Inc. All Rights ReservedUsersUsersUsersmmcnodemasternodemastermmcmysqlmysql
  • 16. nodeslavenodeslavenodeslavenodeslaveKKBOX一起聽 服務元件 (now) ·• node.JS slave·• node.JS master·• memcached·• Mysql·• RabbitMQ©2012. KKBOX Inc. All Rights ReservedUsersUsersUsersmmcnodemasternodemastermmcmysqlmysqlRabbitMQRabbitMQ
  • 17. Summary ·• node.JS 已經足夠成熟·• event driven 帶來許多 server-side 開發優勢– 雷也不少– 但瑕不掩瑜©2012. KKBOX Inc. All Rights Reserved
  • 18. 大家來寫 Javascript 吧~ ©2012. KKBOX Inc. All Rights Reserved
  • 19. Thanks ©2012. KKBOX Inc. All Rights Reservedericpi@kkbox.com

×