Skip to content

Archive for the 'Technology' Category

Gordon: A Flash runtime written in JavaScript

Ok, I’m super stoked about the possibilities of this one. Gordon is an open source Flashâ„¢ runtime written in pure JavaScript. Give some of these demos a try on your iPhone. They don’t run as fast as they do on the computer but OMG Flash on the iPhone!

(thanks Mark)

Happy 25th Birthday Macintosh!

Apple Macintosh
Marcin Wichary

Phusion Passenger (mod_rails) Memory Management

I’ve been using Phusion Passenger (mod_rails) for about a month to run a production and staging machine with a Ruby on Rails app. So far things have been going really well. Installation was smooth and it’s been really peppy.

However, the app just got hit by a lot of people at once and stopped responding. I didn’t realize the default setting in Passenger is to spawn a max of 6 Rails instances simultaneously. The documentation recommends 2 instances for a VPS with 256MB of memory (almost exactly what I’m running). So, my server spawned the max and then ran out of memory which made it unresponsive.

I hit a couple of small walls while getting this working so I wanted to share the process.

On linux based machines you can run passenger-status to find out the number of Phusion Passenger application instances that are running.

----------- General information -----------
max      = 6
count    = 3
active   = 0
inactive = 3

----------- Applications -----------
/u/apps/myapp/releases/20080921194503:
  PID: 8792      Sessions: 0
  PID: 8789      Sessions: 0
  PID: 8784      Sessions: 0

You can see that the output show the default max value of 6. To change this number you need to edit your httpd.conf and set the PassengerMaxPoolSize option. Make sure this is outside of your VirtualHost or it won’t work… which, I obviously ran into. It should probably look something like this:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby /usr/local/bin/ruby
PassengerMaxPoolSize 2

Once you’re done with that restart Apache and Passenger. Now, to take a look at the memory that Apache and Passenger are using run passenger-memory-stats. You’ll see something like this:

------------- Apache processes -------------
PID   PPID  Threads  VMSize   Private  Name
--------------------------------------------
5842  1     1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
8757  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
8784  5842  1        10.4 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9137  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9141  5842  1        10.4 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9143  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9147  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
9155  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
9163  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
9506  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
9510  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9623  5842  1        10.4 MB  0.3 MB   /usr/local/apache2/bin/httpd -k start
9629  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9631  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9633  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9750  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9752  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
9865  5842  1        10.3 MB  0.2 MB   /usr/local/apache2/bin/httpd -k start
### Processes: 18
### Total private dirty RSS: 4.36 MB

-------- Passenger processes ---------
PID   Threads  VMSize   Private  Name
--------------------------------------
8749  20       6.0 MB   0.5 MB   /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/ApplicationPoolServerExecutable 0 /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/bin/passenger-spawn-server  /usr/local/bin/ruby  /tmp/passenger_status.5842.fifo
8758  1        5.5 MB   2.9 MB   Passenger spawn server
8789  1        61.6 MB  53.7 MB  Rails: /u/apps/myapp/releases/20080921194503
8792  1        61.8 MB  53.9 MB  Rails: /u/apps/myapp/releases/20080921194503
### Processes: 4
### Total private dirty RSS: 111.03 MB

Now, that may look like a lot of Apache instances running but you can see the “Total private dirty RSS” (real memory usage of the processes) is only 4.36 MB which is nothing in the scheme of things. More importantly, the real memory that the Rails instances are taking is 111.03 MB which my server can handle. Remember, you’ll probably have MySQL and other applications running along with these processes, so don’t up the PassengerMaxPoolSize to the point of bringing your server to its knees.

WordPress 2.5 is officially out

WordPress 2.5

It’s official. WordPress 2.5 is now out with a crisp new admin interface and great new features. They’ve even redone the website. Here are some of my favorite changes:

  • A beautiful new admin interface.
  • A much more intuitive flow when making a post.
  • Multiple instant file uploads.
  • Thumbnail, medium and full-sized image options (and you can change the image dimensions in Settings).
  • A quick way to display your photos as a gallery
  • Easily add/edit tags so no more plugins are needed.
  • A visual editor that doesn’t break your code (this one is great for my clients).
  • Search now looks at posts and pages.

I’ve always thought that WordPress is one of the best blogging and content management systems. It’s incredibly intuitive for the user (even more so now) and extremely flexible for developers.

Thanks so much to everyone who has helped with WordPress!

OS X Leopard

CompUSA is running a $30 rebate special today and tomorrow on OS X 10.5 (Leopard). Now is a great time to pick up a copy if you’re planning on upgrading. As you can see, I’ll be installing mine after I finish this post (and backup my stuff).

OS X Leopard

The New iPhone… Disassembled

Think Secret iPhone
(photo via Think Secret)

Last night, at 6:00 PM, Apple and AT&T released the iPhone (to most of you this is no surprise). I’m not sure why this tends to be the case these days but the first thing to appear online after the release were multiple sites taking the iPhone apart and putting it through some stress tests (*tear*). Instead of being interested in the functionality of the $500/$600 gadget lets take a look at the guts! Such geeks… of course, I’ve looked at every photo.

Steve Jobs and Bill Gates Joint Interview

In case you weren’t aware of it, Steve Jobs and Bill Gates did a joint interview at D5 last night. Steve and Bill have contributed incredible things to the world and appear to have a great deal of respect for each other. Check out all of the video clips from the event.


Above is the Highlight Reel with some of the funniest portions of the interview.