optimizing spot instance allocation

There is surprisingly little information on how to optimize costs using the AWS spot instance market. There are several services that provide management on top of the spot market if you have an architecture that supports an interruptible workload but very little in the way of how to go about doing it yourself other than surface level advice on setting up autoscaling groups. To remedy the situation here’s an outline of how I’ve solved part of the problem for CI (continuous integration) type of workload Continue reading

enforcing invariants with singleton classes and method redefinitions

If you play around with Ruby long enough you start to notice that Ruby programmers overall tend to prefer small domain specific libraries, Ruby on Rails notwithstanding. There are many good reasons for this kind of approach from a software engineering perspective but the biggest reason is that Ruby makes it extremely easy by providing the right kind of metaprogramming facilities. Continue reading

ruby blocks and evaluation contexts

If you’ve ever played around with JavaScript and jQuery then chances are you’ve stumbled on call and apply. These are methods on function objects that allow you to change what this points to. If you haven’t stumbled on those methods yet then you have more than likely used them indirectly via bind. John Resig has an excellent set of interactive lessons that demonstrate everything you’d ever wish to know about JavaScript’s scoping rules and the cool tricks you can do by manipulating the scope with call and apply. The lessons can be found at http://ejohn.org/apps/learn/.

Ruby has similar context manipulation facilities and they are even more useful. In fact one Continue reading