Repository navigation
Expand file tree
/
Copy pathatom.xml
More file actions
110 lines (73 loc) · 7.55 KB
/
Copy pathatom.xml
File metadata and controls
110 lines (73 loc) · 7.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[YARB]]></title>
<link href="http://philmes.github.io/atom.xml" rel="self"/>
<link href="http://philmes.github.io/"/>
<updated>2013-09-04T20:14:03+01:00</updated>
<id>http://philmes.github.io/</id>
<author>
<name><![CDATA[Phil Messenger]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[The toolsmith and the context switch]]></title>
<link href="http://philmes.github.io/blog/2013/08/31/the-toolsmith-and-the-context-switch/"/>
<updated>2013-08-31T20:28:00+01:00</updated>
<id>http://philmes.github.io/blog/2013/08/31/the-toolsmith-and-the-context-switch</id>
<content type="html"><![CDATA[<p>I’m now convinced that every team should have a toolsmith, who’s raison d’etre is to automate and speed up repetitive tasks.</p>
<p>Why?</p>
<p>It’s long been known that mental context switches are incredibly costly. Joel Spolsky <a href="http://www.joelonsoftware.com/articles/fog0000000022.html">wrote about</a> in relation to software development as far back as 2001. However most attention is paid to interruptions by colleagues. This ignores what is probably the bigger problem: context switches indirectly caused by slow and repetitive tasks.</p>
<!-- more -->
<p>A quintessential example of this is the compile-wait-deploy-wait-rage-at-websphere build cycle of death that afflicted J2EE developers of the last decade. Thankfully most of us have been relieved from that particular horror, but plenty of examples still remain: slow CI builds, slow application startups and slow dependency resolution to name but a few.</p>
<p>The interesting thing here is that it’s not actually the slowness of the task itself that directly causes a problem, but our short attention spans. It may only take 90 seconds to restart an app to test a change, but that’s 90 seconds where I’m tempted to switch to a browser and check my email. Sitting around watching Spring debug logs scroll by is <em>boring</em>!</p>
<p>So, 90 seconds to restart the app. Five minutes reading and responding to email. Five minutes at least to refocus. Even if I resist the temptation eight times out of ten, that’s a lot of wasted time. It also has a parasitic drag on motivation – I want to be solving problems, not staring at the screen waiting for something to happen.</p>
<p>Unfortunately a lot of developers seem quite.. well, not happy, but tolerant of this situation. I’ve seen a lot of otherwise very talented developers wasting time waiting for their tools to catch up. The worrying thing is that this slowness is often easily fixed, either via amazing solutions like <a href="http://www.jrebel.com">JRebel</a> or by some simple tweaks to the software stack. So why are so many willing to put up with this?</p>
<p>The individual reasons vary greatly. Familiarity is perhaps the biggest one. Many developers brought up on a diet of J2EE (or .NET, or any other static language dominated stack) are simply used to things taking a while, so much so that it’s an accepted part of how they work.</p>
<p>My favourite example of this is a situation I encountered recently at work. One of my team was tasked with implementing a system to extract topics from plain text. This system used a bunch of different data sources, many of which needed to be loaded into RAM at startup – in total about of 4 GB of static data. Even with a SSD this took a while, especially as a large chunk of that data was plain text which needed to be parsed first.</p>
<p>Amazingly, he tolerated this until we noticed what was happening. A couple of simple batch jobs to do the parsing up front combined with a switch to mmap dropped the startup time to 8 seconds, and made the rest of the implementation process much quicker and less painful.</p>
<p>The toolsmith is responsible for eliminating or reducing these problems. In an agile team this is unlikely to be a dedicated individual, but technical debt tasks that are worked on like any other task. It should also be something teams actively look for, ideally as part of the retrospective.</p>
<p>Spreading the work around also has the positive side effect of exposing all members of the team to parts of the development infrastructure they usually wouldn’t be exposed to. No longer will Bob be the only one who understands how the Jenkins cluster is configured.</p>
<p>tl;dr: as developers we shouldn’t be so accepting of slow tools.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Java 7 with Elastic Map Reduce]]></title>
<link href="http://philmes.github.io/blog/2013/08/11/java-7-with-elastic-map-reduce/"/>
<updated>2013-08-11T20:28:00+01:00</updated>
<id>http://philmes.github.io/blog/2013/08/11/java-7-with-elastic-map-reduce</id>
<content type="html"><![CDATA[<p>At <a href="http://www.intenthq.com">work</a> I use Amazon Elastic Map Reduce a lot – there’s nothing quite like the convenience of firing up a 100 node Hadoop cluster with a single command.</p>
<p>At the time of writing, the pre-canned EMR instances only support Java 6. This is a problem as we use Java 7 exclusively and have a pile of shared dependencies that we’d like to reuse. Thankfully it’s possible to use <a href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-plan-bootstrap.html">bootstrap actions</a> to swap the pre-installed Java 6 for Java 7.</p>
<!-- more -->
<p>The process is actually quite simple, but required a bunch of trial and error. First we replace the pre-configured Debian repositories with the official Wheezy repository:</p>
<pre><code>#!/bin/bash
sudo echo -e "deb http://http.us.debian.org/debian wheezy main contrib non-free" | sudo tee /etc/apt/sources.list
sudo apt-get update
</code></pre>
<p>The OpenJDK 7 installer prompts for license acceptance, which doesn’t work in a non-interactive session. Setting the <code>DEBIAN_FRONTEND</code> environment variable stops this:</p>
<pre><code>export DEBIAN_FRONTEND=noninteractive
</code></pre>
<p>We then install OpenJDK 7:</p>
<pre><code>sudo -E apt-get -y -q install openjdk-7-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
</code></pre>
<p>And then forcibly remove Java 6. This is pretty nasty, but there are a bunch of EMR specific dependencies installed which explicitly depend on the pre-installed JDK (including hard coded paths).</p>
<pre><code>sudo rm /usr/lib/jvm/java-6-sun
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-6-sun
</code></pre>
<p>The full script:</p>
<pre><code>#!/bin/bash
sudo echo -e "deb http://http.us.debian.org/debian wheezy main contrib non-free" | sudo tee /etc/apt/sources.list
sudo apt-get update
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get -y -q install openjdk-7-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
sudo rm /usr/lib/jvm/java-6-sun
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-6-sun
</code></pre>
<p>This script should be uploaded to an S3 bucket, and added as a bootstrap action:</p>
<pre><code>./elastic-mapreduce --create --alive --log-uri s3://log-bucket/logs --num-instances 6 --master-instance-type m1.large --slave-instance-type m2.xlarge --key-pair <pair> --bootstrap-action s3://script-bucket/script
</code></pre>
<p>Your instances will take a little longer to startup then usual as the bootstrap action takes a while to run.</p>
]]></content>
</entry>
</feed>