ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
'use strict'; | |
const parseExpression = require("./parse-expression"); | |
function findAll(regex, target) { | |
let results = [], match; | |
while (match = regex.exec(target)) { | |
results.push(match); | |
} |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns on recent CPU
L2 cache reference ........................... 7 ns 14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory
Summary: use good/established messaging patterns like Enterprise Integration Patterns. Don't make up your own. Don't expose transport implementation details to your application.
As much as possible, I prefer to hide Rabbit's implementation details from my application. In .Net we have a Broker abstraction that can communicate through a lot of different transports (rabbit just happens to be our preferred one). The broker allows us to expose a very simple API which is basically:
- publish
- request
- start/stop subscription
(based on http://www.whatsmypass.com/the-top-500-worst-passwords-of-all-time) | |
123456 | |
porsche | |
firebird | |
prince | |
rosebud | |
password | |
guitar | |
butter |
function MyObject() {} | |
MyObject.prototype.doSomething = function() { | |
console.log('MyObject.doSomething()'); | |
} | |
// ----- | |
var parent = MyObject; |
<?php | |
// An experiment: using traits for dependency injection | |
// A trait provides a way to inject a Logger and a way to use it | |
trait aLogger { | |
protected $logger = null; | |
public function setLogger(Logger $logger){ | |
$this->logger = $logger; | |
} | |
public function log($msg){ |
/** | |
* Returns a function which won't be invoked until delay has elapsed, without further calls being made during that interval. | |
* If further calls are made, the delay is reset and the cycle repeats. | |
* @param {Function} fn Behaviour to be wrapped in this delay | |
* @param {Number} delay Duration in milliseconds | |
* @return {Function} | |
*/ | |
function until(fn, delay) { | |
var timeoutId; | |
var scheduledCall = setTimeout.bind(window, fn, delay); |