• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Server Connect To API / 3rd Service Pattern
 

Server Connect To API / 3rd Service Pattern

on

  • 184 views

when node.js as a middle server and connect to other servers, what should you notice? what do you have to ready after building a node.js process? ...

when node.js as a middle server and connect to other servers, what should you notice? what do you have to ready after building a node.js process?

We discuss the infrastructures and node.js processing that we have to know.

Statistics

Views

Total Views
184
Views on SlideShare
181
Embed Views
3

Actions

Likes
5
Downloads
0
Comments
0

2 Embeds 3

http://www.linkedin.com 2
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Server Connect To API / 3rd Service Pattern Server Connect To API / 3rd Service Pattern Presentation Transcript

    • Server Connect To API / 3rd Service Pattern Caesar Chi @clonncd Node.js 與多方服務串接實務 Monday, June 23, 14
    • @clonncd Monday, June 23, 14
    • Monday, June 23, 14
    • https://github.com/nodejs-tw/nodejs-wiki-book Monday, June 23, 14
    • Monday, June 23, 14
    • Structure Clients Server Monday, June 23, 14
    • That means we thought done with something in Node.js But actually we did nothing special. Monday, June 23, 14
    • Monday, June 23, 14
    • Request of As a Front end Server Monday, June 23, 14
    • Structure front Server Services secret information cache send Request Monday, June 23, 14
    • WWW are APIs When Node.js has Request Monday, June 23, 14
    • Structure front Server Services send Request ... ... Monday, June 23, 14
    • But When Service requirement Grows Up Monday, June 23, 14
    • Structure front Server Internal server send Request ... ... Too Much Code To Handle Monday, June 23, 14
    • Service Definition • Front server can be flexible to connect • Support Restful API for internal connect • Same Router rule for client • Modules install / uninstall be easy • Light way feedback data Monday, June 23, 14
    • Server Definenation • Front server can be flexible to connect • Support Restful API for internal connect • Same Router rule for client • Modules install / uninstall be easy • Light way feedback data Service as a module, feature as a apps https://github.com/clonn/module-loader Tips Monday, June 23, 14
    • app3 app2 app1 app4 Routers as apps, auto route Monday, June 23, 14
    • app3 app2 app1 app4 Every developers can handle by themselves Monday, June 23, 14
    • Make connect easy, A tiny distribution server Monday, June 23, 14
    • Face Response Issue ... Monday, June 23, 14
    • Wait ...Wait ...Wait ... https://www.flickr.com/photos/tormodspictures/ Monday, June 23, 14
    • 伺服器反應很慢 http://chinese.engadget.com/2014/06/21/facebook-android-update-africa/ Monday, June 23, 14
    • Let’s refactoring code Monday, June 23, 14
    • Monday, June 23, 14
    • Response back as soon as posible Monday, June 23, 14
    • Heavy processing or request, put late Monday, June 23, 14
    • Response as short as posible https://www.flickr.com/photos/calliope/ Monday, June 23, 14
    • what can NOT be late • real time date, have to be light (geo, data) • robust data, we could not avoid (but save in cached, redis and process them later) Monday, June 23, 14
    • What can late • log data writing • data saving (not for real time response) • data caching Monday, June 23, 14
    • Response First, Process Later Tips Monday, June 23, 14
    • Too many callback event in waiting queue https://www.flickr.com/photos/peter_curb/14318113011/sizes/c/in/photostream/ Monday, June 23, 14
    • WARNNING, It Cause High CPU Usage https://www.flickr.com/photos/peter_curb/14318113011/sizes/c/in/photostream/ Monday, June 23, 14
    • We put process in Task Queue. http://learnboost.github.io/kue/ Monday, June 23, 14
    • Save process, prarams in Task Queue Monday, June 23, 14
    • Monday, June 23, 14
    • Set callback event when things done Monday, June 23, 14
    • Send request to 3rd party library / API / URL Monday, June 23, 14
    • Feedback to Server or Storage trigger callback event to Server Monday, June 23, 14
    • Monday, June 23, 14
    • How feedback to clients, when task queue process task / jobs done, how could we notify clients? How about Client? Monday, June 23, 14
    • Time meet http://socket.io/ or Socket Monday, June 23, 14
    • Client and Server connect via a Tunnel Monday, June 23, 14
    • With handshake Monday, June 23, 14
    • Structure Clients Server Server push Monday, June 23, 14
    • Structure Clients Server Server push From single way to double ways Monday, June 23, 14
    • Structure Clients Server Server push From single way to double ways JSON Ads Habit Monday, June 23, 14
    • Server push, that means • Ajax mode changed • Browser can do more things • User request is getting more • Server has to afford more currency • Server has opportunity feedback data Monday, June 23, 14
    • Let’s integrate with Socket.io / Socket and Task Queue Monday, June 23, 14
    • Feedback to Server or Storage Monday, June 23, 14
    • Return data to User in a few minutes Monday, June 23, 14
    • Return data to User in a few seconds Monday, June 23, 14
    • Increase User Experience Not Make Them Wait Monday, June 23, 14
    • Monday, June 23, 14
    • Cache Layer Monday, June 23, 14
    • Storage Layer Monday, June 23, 14
    • Part of access Monday, June 23, 14
    • Part of heavy access Monday, June 23, 14
    • Not finished yet Monday, June 23, 14
    • Monday, June 23, 14
    • http://letsnode.com/example-of-what-node-is-really-good-at Monday, June 23, 14
    • http://mortarnpistol.com/2011/12/16/big-rigs-over-the-road-racing/ Monday, June 23, 14
    • Monday, June 23, 14
    • Monday, June 23, 14
    • Rules • Make events as light as posible • Divide things to tiny • Heavy process throw to another way • Monitor app.js after done • Figure out bottlenecks • Decrease users idle / waiting time as posible Monday, June 23, 14
    • https://www.facebook.com/groups/node.js.tw/ https://www.facebook.com/NodeJS.tw https://github.com/nodejs-tw http://nodejs.tw/ http://2014.jsdc.tw/ Monday, June 23, 14
    • https://github.com/nodejs-tw/nodejs-book-beginner-guide Monday, June 23, 14
    • @clonncd Monday, June 23, 14