Why Teams call analytics are critical to your entire business
What I learned from FluentConf and then some
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. 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. 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. 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. 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. 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. 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. 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. 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. Leftovers
• Read “Maintainable JavaScript”
• You should write better code
• See how racist you are:
https://implicit.harvard.edu/implicit/demo/ta
keatest.html