Once again, Safari makes the world look better.

Posted by Christopher Smith Mon, 27 Aug 2007 15:06:00 GMT

So, if you’ve been reading this blog much, you’ve undoubtedly been noticing its completely lack luster performance. I’ve been trying to isolate the problem, and frankly I’ve been getting frustrated enough that I’ve considered just writing my own blogging software that merely shares Typo’s database back end.

Instead of doing that, I noticed that despite updates to the software on my system, I was still running an old version of Typo. It turns out you have to explicitly upgrade each deployment of Typo (not necessarily a bad thing). As always, there is an easy way to do this…. and it didn’t work for me (probably PEBKAC, but nonetheless frustrating). Anyway, after several false starts, I managed to upgrade to Typo 4.1.1.

There are a number of improvements that have come with upgrade that look to make life better on xblog. Oddly though, the new theming seems to be completely broken –except for on Safari. Yup, if you are looking at this with anything other than Safari (actually, I haven’t tested with Opera yet), you are probably seeing a pretty ugly looking site. Firefox shows the site as broken on Linux, Mac, and Windows. IE7 looks the same.

I haven’t diagnosed the how and the why behind all this, because I’ve been stunned by the downright awesomeness of this. The problem seems likely related to stylesheets, but for the life of me I am trying to figure out what is so different about my setup from a typical Typo configuration, and more importantly just look in awe at Safari.

Fighting Comment Spam

Posted by Christopher Smith Tue, 21 Nov 2006 06:08:00 GMT

I’m not sure what makes me special, but for whatever reason, I’ve been the subject of a substantial bit of comment spam of late. I’m not sure entirely what I’ve done to deserve this, but it’s given me a quick overview of what does and doesn’t work with regards to fighting comment spam.

First of all, Typo filtering just doesn’t seem to work how I’d expect it to. It may all be user error, as I haven’t looked at the code for it. I’ll look at it more closely in the near future, but for now impression is that it doesn’t work the way it needs to to be effective.

The Akismet support for Typo also seems to be lacking. Enabling it mostly seemed to result in me getting timeouts. I went to look at the Typo site to see how other people were tackling this and discovered… the site was temporarily down. Nice that.

What blows me away is that Typo’s “bulk operations” is still tied to the same synchronous “wait for it to complete or we’ll time out” interface as everything else. What’s clearly called for here is some primitive queuing up of bulk tasks. I’m still learning Rails, but my bet is Rails doesn’t have an easy way to do such a thing (although it seems like it’d be easy to do in Ruby).

Ultimately, I ended up going with the tried and true approach: just blocking port 80 access to IP’s and subnets that were clearly running comment bots. Not an ideal solution if you have a broad audience, but given that I probably have a typical audience of a handful of people, the odds of me accidentally knocking off someone who’d actually read my blog are slim to none. Since I started firewalling off people’s IP’s, the torrent of comment spam that I normally see has diminished to a perfectly manageable level.

So keep that in mind: firewalls are your best frend when it comes to blocking comment spam.

Ruby on Rails Memory Efficiency 7

Posted by Christopher Smith Wed, 13 Sep 2006 16:00:00 GMT

Okay, I said I suspected that Ruby wasn’t terribly memory efficient yesterday. Today I have some strong indications that at least Typo isn’t quite so memory efficient.

I had noticed that my blog was getting quite slow and handling updates, and it wasn’t clear to me why. I am particularly sensitive to efficiency issues, because I run this whole thing inside a User Mode Linux instance, which imposes it’s own inefficiencies on pretty much all aspects of the Linux kernel. So I generally have to be fairly careful to tune everything I run inside it to minimize kernel involvement. I was all ready to blame UML again until I looked at what was going on with the instance: it was swapping like crazy.

Some peaking around in the system showed working set sizes for my Ruby FastCGI processes in the 35MB-50MB range (very bad considering my instance only has 64MB of RAM allocated for it) –that’s the kind of footprint that makes you start to think of J2SE/EE! To get an idea of how inefficient that is, Postgres’s working set size for handling this puny blog is about 4-5MB.

So far, I’ve been able to get back to some kind of decent performance by trimming my FastCGI process count down to one (which has some unfortunate side effects, but none as unfortunate as having 20-30MB of memory constantly swapping).

This tweaks my curiosity as to what’s going on under the covers, and how much of the overhead is Ruby, how much is Rails, and how much is Typo.

My First Ruby Program

Posted by Christopher Smith Sun, 10 Sep 2006 05:43:00 GMT

I realized that earlier today I wrote my first Ruby program, and it’s probably worth documenting this moment for posterity.

It’s a trivial bit of code:

Fixing Typo sequence numbers
require 'postgres'

sequences = [
  'blacklist_patterns', 'blogs', 'categories',
  'contents', 'page_caches', 'pings',
  'redirects', 'resources', 'sessions',
  'sidebars', 'tags', 'text_filters',
  'triggers', 'users'
]

def fixSequence(db,tableName)
  results = db.query("select max(id) from #{tableName}")
  max_id = results.first.first
  if max_id then 
    db.exec("select setval('#{tableName}_id_seq'::text,#{max_id});").clear
  end
end

db = PGconn.connect("localhost", 5432)
sequences.each {|sequence| fixSequence(db,sequence)}
db.close()

So far, my first impression is that Ruby tries to be like Smalltalk, but is Perlish enough to fall short IMHO. Of course, I hardly know the language yet, so there may be a more elegant way to do things that I have yet to uncover. In particular, I’m wondering why the True and False classes don’t have “ifTrue:ifFalse” type methods that take blocks as arugments. Seems like an obvious “nice to have”. IIRC it’s possible to add methods to existing classes, so maybe I can do this to keep the Smalltalk cravings to a minimum.

Observations in the first 10 minutes 2

Posted by Christopher Smith Wed, 06 Sep 2006 10:28:00 GMT

So, my first observation is that Google’s AdSense crawler appears to not be getting the joke. So far it has selected ads with titles like “Get Paid To Create Hubs” and “Blog Advertising”.

I guess the ad selection isn’t entirely stupid, as I can only imagine how many first time bloggers expect to make millions out of the public’s intense interest in their thoughts (because in blog world, unlike reality, everyone is interesting).

The other observations I have are:

  • I’m a total novice at this blog thing
  • Blogs appear to have evolved in to something way more complicated than actually makes sense to me
  • I am definitely going to be using Postgres going forward (SQLite is different enough to be annoying without providing any benefits that I can determine)
  • Typo is currently set up to do far too much logging
  • Ruby gems brings back frightening memories of CPAN
  • Given how often I’ve heard Rails folks rail against the many frameworks of Java, it’s amusing to see just how many such frameworks are used by Rails
  • Despite all of it’s other features, it’s not immediately obvious how to add spelling and grammar checking to Typo. You’d think this would be a priority (well, maybe only if your spelling and grammar is as bad as mine).