Mike Perham

On Ruby, software and the Internet

Entries Tagged as 'Ruby'

memcached vs memcache-client Performance

June 16th, 2009 · 1 Comment

memcached is Evan Weaver’s Ruby wrapper around the libmemcached C library and widely regarded as quite fast. After an hour of trying, I finally got a build of memcached to actually compile and install on my machine (the trick: you need to download the custom packages Evan links on his blog, nothing else seems to [...]

[Read more →]

Tags: Ruby

Scraping with Typhoeus and Nokogiri

June 12th, 2009 · 1 Comment

I’ve been working on some cool new functionality at OneSpot. We want to provide a widget that can give the reader more context about a given article. Zemanta takes the article text and hands us back a set of semantic entities, including links to their Wikipedia page, but we wanted to get a nice blurb [...]

[Read more →]

Tags: Ruby

Memory-hungry Ruby daemons

May 25th, 2009 · 7 Comments

We’ve had a perplexing issue with our Ruby daemons at OneSpot: they seem to grow to 300-400MB each within about 30 minutes, at which point our Monit scripts restart them. We suspected a memory leak and so upgraded from stock Ruby 1.8.5 shipped with CentOS to the latest REE 1.8.6 but nothing changed. I also [...]

[Read more →]

Tags: Ruby

memcache-client rdoc

March 30th, 2009 · 2 Comments

I’ve put up the memcache-client rdoc by request of my coworker Chris.

[Read more →]

Tags: Ruby

Caching and Rails

March 25th, 2009 · 3 Comments

Here’s the slides from my AOR talk last night: Caching, Memcached and Rails (600KB). Caching, Memcached And Rails I was a little unhappy with my wrapup – the one thing I wanted to teach people was when to use each different caching mechanism provided by Rails and I didn’t really revisit and summarize that content. [...]

[Read more →]

Tags: Rails · Ruby

Socket Timeouts in Ruby

March 15th, 2009 · 12 Comments

One of Ruby’s weaknesses is its poor networking performance. Much of that has to do with the net/http implementation, which uses Ruby’s awful Timeout library. The issues with Timeout are well documented. SystemTimer provides a reliable alternative that also performs better. However I started today wondering if there was a better way. Enabling timeouts has [...]

[Read more →]

Tags: Ruby

Using the Tokyo Tyrant native bindings

March 14th, 2009 · 1 Comment

My previous examination of Tokyo Tyrant’s memcache protocol support showed how you can use memcache-client directly with TT. John Mettraux has created Ruby bindings for TT’s own native client for ultimate speed. Let’s take a look at how this affects performance: require ‘rufus/tokyo/tyrant’   db = Rufus::Tokyo::Tyrant.new(’localhost’, 1978) Benchmark.bm(20) do |b| b.report ‘native-write’ do 10_000.times [...]

[Read more →]

Tags: Ruby

SystemTimer 1.1 crash

March 10th, 2009 · No Comments

We’re trying to use SystemTimer 1.1 on 64-bit Ubuntu and find that it crashes. An hour’s worth of investigation led to this fix: — a/ext/system_timer/system_timer_native.c +++ b/ext/system_timer/system_timer_native.c @@ -25,7 +25,7 @@ static void install_ruby_sigalrm_handler(VALUE); static void restore_original_ruby_sigalrm_handler(VALUE); static void restore_original_sigalrm_mask_when_blocked(); static void restore_original_timer_interval(); -static void set_itimerval_with_minimum_1s_interval(struct itimerval *, int); +static void set_itimerval_with_minimum_1s_interval(struct itimerval *, VALUE); [...]

[Read more →]

Tags: Ruby

Tokyo Cabinet vs Memcached

March 8th, 2009 · 5 Comments

Tokyo Cabinet bills itself as a next-generation DBM. Like BerkeleyDB, TC gives you low-level database operations and allows you to build your own very fast data access operations. Unlike BDB, TC has several functional layers on top of TC which provide network access, schema-less document-oriented storage (a la CouchDB) and supported bindings for many languages. [...]

[Read more →]

Tags: Ruby

memcache-client 1.7.0 – the End of the Line

March 8th, 2009 · No Comments

I believe that memcache-client has reached the end of its development lifecycle. I inherited a project which implemented basic memcached functionality and made it much faster, more reliable and expanded the implemented functionality to basically the entire memcached client protocol. At this point, there’s not much left to do – maintenance will be required if [...]

[Read more →]

Tags: Ruby