Node.js• Debugging using node:  – node --debug hello.js  – kill -s USR1 <pid> - switch to debug  – node-inspector - remote...
Node.js• One can use IPC  (http://dailyjs.com/2012/04/26/node-unix-  ipc/) to sync up Node instances• Better yet, use an i...
Node.js• For all events in Node (EventEmitter), one can  register for a SINGLE event (once) and not  have to manage memory...
Tools• www.caniuse.com - which browsers support a  feature• <script src="//foo.com/widget.js"> - protocol  agnostic• z• li...
Back-End Tools• Speed testing:  – http://www.webpagetest.org/  – http://httparchive.org/• blackhole.webpagetest.org – to t...
JavaScript• Many languages compile into JavaScript  – CoffeeScript     • IcedCoffeeScript• Some implemented __DEBUG_WARNIN...
Frameworks• Comparison of template engines:  http://engineering.linkedin.com/frontend/clie  nt-side-templating-throwdown-m...
Redis.IO• Fast, in-memory cache   – Size limited to memory   – Good for ephemeral data (cache, session), for syncing serve...
Internal Suggestions• Compiling our templates to JS code• For ads: To communicate some configuration to a  script tag use ...
Leftovers• Read “Maintainable JavaScript”• You should write better code• See how racist you are:  https://implicit.harvard...
Upcoming SlideShare
Loading in …5
×

What I learned from FluentConf and then some

800 views
741 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
800
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

What I learned from FluentConf and then some

  1. 1. Node.js• Debugging using node: – node --debug hello.js – kill -s USR1 <pid> - switch to debug – node-inspector - remote debug• For long synchronous tasks (calculations), one should spawn a new Node instance• Cluster – spawning multiple instances• Proxies – varnish, HAProxy are faster than NGINX
  2. 2. Node.js• One can use IPC (http://dailyjs.com/2012/04/26/node-unix- ipc/) to sync up Node instances• Better yet, use an in-memory database (see Redis, perhaps also Socket.IO’s RedisStore)• There is A LOT of talk about Socket.IO• One can implement process.on(uncaugtException) to avoid the instance crashing
  3. 3. Node.js• For all events in Node (EventEmitter), one can register for a SINGLE event (once) and not have to manage memory.• Winston – a logging tool for node• Express 3 implements many high-level HTTP features (compression, caching)
  4. 4. Tools• www.caniuse.com - which browsers support a feature• <script src="//foo.com/widget.js"> - protocol agnostic• z• live compiling, plugins for live update of JS, CSS• Learn to better use your toolset
  5. 5. Back-End Tools• Speed testing: – http://www.webpagetest.org/ – http://httparchive.org/• blackhole.webpagetest.org – to test missing JS resources• Not ready yet: http://www.stevesouders.com/blog/2012/05/ 22/self-updating-scripts/
  6. 6. JavaScript• Many languages compile into JavaScript – CoffeeScript • IcedCoffeeScript• Some implemented __DEBUG_WARNING preprocessing directives (js-build-tools)• Chrome can now emulate touch events• Never use try-catch for an async operation• You can create inline SVG with JS• webkitRequestFullScreen()
  7. 7. Frameworks• Comparison of template engines: http://engineering.linkedin.com/frontend/clie nt-side-templating-throwdown-mustache- handlebars-dustjs-and-more• One can translate AI files into Raphael code• TreeHugger for layout of long-form content• Backbone.JS, CoffeeScript, Bootstrap, Socket.IO, MongoDB, Redis, Derby, Meteor, Grunt
  8. 8. Redis.IO• Fast, in-memory cache – Size limited to memory – Good for ephemeral data (cache, session), for syncing servers• Can be saved to disk, mostly for faster start up• Key-value storage• Support strings, integers, floats, sets (+operations), sorted sets, and hashes. – Native to developers• Makes the developer think about the implications of large- scale• In JavaScript, set operations are unidirectional, get async• Supports pub-sub, transactions, LUA scripts
  9. 9. Internal Suggestions• Compiling our templates to JS code• For ads: To communicate some configuration to a script tag use s.setAttribute(data-config, whatever); instead of <script>var config=”whatever"</script>, and find it by its URL.• Have only minified + gzipped output and use source maps to understand errors• We can terminate SSL on NGINX instead of Node
  10. 10. Leftovers• Read “Maintainable JavaScript”• You should write better code• See how racist you are: https://implicit.harvard.edu/implicit/demo/ta keatest.html

×