I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.
The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.
It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential
| /** | |
| _____ _____ _ | |
| | __ \ / ____| | | | |
| | | | | ___| | _ __ _ _ _ __ | |_ ___ _ __ | |
| | | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__| | |
| | |__| | __/ |____| | | |_| | |_) | || (_) | | | |
| |_____/ \___|\_____|_| \__, | .__/ \__\___/|_| | |
| __/ | | | |
| |___/|_| | |
| */ |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
| /* | |
| In Ethereum, a contract can be written so that it returns a value for eth_call. | |
| A Dapp can then check for success or error value of eth_call, before calling eth_sendTransaction, | |
| to take advantage of eth_call effectively being a "preview" of the code flow that the transaction | |
| will take. In traditional client-server, clients can't ask servers beforehand what's going to | |
| happen when the client makes a call; with Dapps contracts can be written so that clients can ask | |
| for a "preview" of what is going to happen, before any funds/ethers are actually utilized | |
| (eth_call does not cost any ethers). | |
| Note: it is possible that in between eth_call and when eth_sendTransaction is actually mined, |
In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.
A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval.
You can find instance_eval used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.
class Article < ActiveRecord::Base| # Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
| # the mechanics, not a real-world use case. | |
| # NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
| # extension that works for any named association. That's what I really wanted! | |
| # Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
| # == DEFINITIONS | |
| # - A Taxi is a car for hire. A taxi has_many :passengers. | |
| # - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
| 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 |
| ### INSTALLATION NOTES ### | |
| # 1. Install Homebrew (https://github.com/mxcl/homebrew) | |
| # 2. brew install zsh | |
| # 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh) | |
| # 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace | |
| # 5. Install iTerm2 | |
| # 6. In iTerm2 preferences for your profile set: | |
| # Character Encoding: Unicode (UTF-8) | |
| # Report Terminal Type: xterm-256color | |
| # 7. Put itunesartist and itunestrack into PATH |