Category Archives: Misc

Blog Moved! plzplzplzbbq update your feed (plz)

I moved my blog to: http://macournoyer.com/blog.

New feed is at http://macournoyer.com/blog.atom

I know, I’m asking a lot… But I guarantee you’ll have a lot more fun if you update your feed to point to my new blog.

kthxbai

6 Comments

Filed under Misc

Thin 1.0

Thin 1.0, codename That’s What She Said, is out!

gem install thin

1.0, OMGWTFBBQ!

Yes 1.0! That doesn’t mean it’s bug free or anything. But, it does mean that it’s been running on a number of servers and no show stopper bugs have been found since a while.

Special thanks to…

A lot of people have helped me achieve this milestone. I’m very proud to say that Thin is no longer my project, but the collaborative work of many bright people.

Here they are. If you like Thin or if it helped you in any way, please take a couple minutes and recommend them.
(If you contributed to Thin in any way and are not on the list, that’s an error so please let me know!)

Also thanks to everyone who’ve taken the risk to run Thin on their website.

13 Comments

Filed under Misc

Speaking at meshU

meshUOn May 20th, I’ll be in Toronto presenting at meshU. Probably about climate change or Thin, haven’t decided yet.

From meshU site:

meshU is a one-day event of 12 focused workshops in three streams (design, development, management) given by those who have earned their stripes in the startup game; people who can talk knowledgeably about everything from interface design to using Amazon’s S3 distributed server network. We hope this addition to mesh will meet a growing need in Toronto: the need for practical, down-to-earth information about tools, knowledge and expertise for startups, web designers and developers of all kinds.

There will be some awesome and famous speakers: Daniel Burka and Leah Culver of Pounce, John Resign, creator of jQuery, Kevin Hale of Wufoo, Avi Bryant of Dabble DB, Jon Lax, Ryan Carson, Allistair Croll and Reg Braithwaite, it’s gonna be crazy-sexy-cool!

I hope to see you there!

5 Comments

Filed under Misc

How many applications can you fit in your VM ?

SanboxSo there I was last night, unable to sleep after Simone finally did went to sleep. I started to play with Why’s Freaky Freaky Sandbox. I knew some people thought about using this to run multiple Rails applications inside the same VM but nobody actually did.

Installing the Sandbox

Installing the Sandbox is kinda scary cause you have to patch Ruby and install it using setup.rb which is not the typical gem install.

Patch Ruby 1.8.6:

cd /path/to/src/ruby-1.8.6
wget http://code.whytheluckystiff.net/svn/sandbox/trunk/patch/ruby-1.8.6-sandbox_needs.patch
patch -p1 < ruby-1.8.6-sandbox_needs.patch
make
sudo make install

Install the Extension:

svn co http://code.whytheluckystiff.net/svn/sandbox/trunk sandbox
cd sandbox
sudo ruby setup.rb

See InstallingTheSandbox for the official guide.

What the Sandbox allows?

It clones the Ruby environment and keeps all the objects seperated in their own freaky freaky sandbox! It’s a bit like running a VM inside another VM!

Rails + Multiple VMs, yeaaaah baby you guessed it!

Rack Sandbox

So I’m hacking on this thing: http://github.com/macournoyer/rack_sandbox that runs a Rack application inside a Sandbox. I was able to run 2 very-very bare bone Rails applications (no db, no session, no plugins) inside the same VM, all served by one single Thin instance!

map 'http://myfirstapp.com' do
  run Rack::Adapter::SandboxedRails.new(:root => '/path/to/a/rails_app')
end
map 'http://mysecondapp.com' do
  run Rack::Adapter::SandboxedRails.new(:root => '/path/to/another/rails_app')
end

I don't fully understand how the Sandbox works, I had to do some crazy hacking to make it work and haven't tested it with several Rails applications. A lot more work needs to be done before this is even usable.

But this allows to save all the memory overhead of running a separate ruby process which is about 60 MB on my machine. So instead of costing you 120 MB to run 2 simple Rails app it's only around 63 MB.

git clone git://github.com/macournoyer/rack_sandbox.git

Feel free to clone, pull and fork!

3 Comments

Filed under Misc

Simone Cournoyer

SimoneSince a few days now, I have the pleasure to be the father of the most beautiful baby girl in the world. You might say that all parents think their child is the most beautiful, but that’s because you haven’t seen mine. I’m totally objective, ok?

I’ve already started to teach her some basic Ruby.

18 Comments

Filed under Misc

yu can has a mery Crismus

Image

It beez dat tiem of teh yeer agin, lol
Hai! Kittehs luv Crismus Trees very much! Dey liek to play wit dem, an eet dem, an mak tinsul hang out of der butt. But we mus remembah teh troo reesun we haf Crismus is cuz Ceiling Cat luv pien trees and he mak a holaday for dem. Srsly.
See dis piktur? Ceiling Cat in high plases cuz dat be wer he belong, srsly. Ceiling Cat don haf to stay in teh tree tho! He can has plases everywhar! Ceiling Cat can has part in ur Crismus? Uplaod yer pikturs or send dem to his proffet an show everywun wer Ceiling Cat hangz out in yer holiday decerashuns! Invisible sanity!
Yu can has a mery Crismus!

(WTF?)

If you’re looking for something to do this holidays, I’d suggest renewing with The Bible.

Merry Christmas and happy new year to all my readers.

Leave a comment

Filed under Misc

Ouch! You broke my site

When James asked me if he could send RefactorMyCode to Digg, I said: sure. After all I spent lot of time on caching parts of the site so it would be fast. Ben and Fred also helped me spread the word with their networking ninja skills. By the time I went home that day it gained 30-40 diggs, but disappeared on the other link sites (reddit and ycomb hacker news). The server had no problem handle the load.

I kept checking my stats until I fell asleep.

7 AM: Checking my site… Huh! Not responding…

Ouch

It’s on programming front page of Digg, Reddit and Delicious! 20 000 visits! My heart is pumping!

What can I do ?

I tried multiple things on my poor little 200 MB of RAM Dreamhost account. Whenever a new dispatcher process is started it’s killed right away due to the incredible number of simultaneous visits. I read some comments on Digg, damn those people are mean, :(. I make some coffee and realize the only solution it to put an index.html file at the root and turn Rails dispatching off. Doesn’t seem to work, I can’t even serve a static page! 15 minutes later it works! The home page shows the last snapshot of the live site I could take. And visits keep going through the roof, 30 000.

It was better then nothing and I think it was less frustrating for people to see at least the facing page.

On my way home I was pretty desperate that the only solution was to move everything to a new provider. That means it will be down until I can get an account and resetup the whole app (installation of Ruby gems for syntax highlithing require some black magic and lots of luck). That’s too long!

So there I was, yesterday night, trying to find a better solution with my site busting the 50 000 visits mark.

I was caching almost everything on the front page, but with fragment caching, the request had to go through ActionPack. What prevented me from using full page caching was the login and account link and the “Your submissions sidebar”. Each are specific to a user, so it’s impossible to cache those. But still, security is checked on the server. So I though: I can show everything and show/hide relevant links with javascript. This way everyone would have the same HTML and it could be cached. That’s what I did. You can check the HTML source of the page and see the trick. I’ll go into more details in a future post.

After all this, the site is now back online. Everything seems to be working well now. Even though the traffic is going down a little bit, I still got 5800 visits today (at 1PM).

Thanks to all the people who talked, commented or blogged about or digged/voted for RefactorMyCode! You made it happend (made it popular that is, not crashing it, that was only me)!

3 Comments

Filed under Misc, refactormycode