eddorre

Observations in Traffic Patterns After an I5 Bridge Lift

July 31, 2010 — 0 Comments

Interstate 5 or I5 is an Interstate Highway that runs parallel to the Pacific Ocean and extends all the way from Mexico to Canada. In the Portland-Metro area it’s home to some of the worst traffic snarls and the subject of much debate from commuters, environmentalists and everyone in between.

I myself, am a commuter, meaning that I live in Vancouver, Washington but I work in Portland, Oregon. Unlike some of my commuter brethren, I don’t hold a grudge against people that are anti-commuting; I see their point as equally as I see my own. I firmly believe that a solution won’t present itself until both sides drop the tribal/faction mentality, stop stereotyping and start work collaboratively towards a vibrant and workable metropolitan area.

Until that time, I5 is what it is – a traffic quagmire. Having resigned myself to this realization, I started trying to understand why I5 traffic is this way. Like any good geek, I started this process by collecting data. In a forthcoming article, I’ll describe in detail how I’m collecting the data, but for now I’ll just give a summary. Every 15 minutes, between the hours of 5 AM and 9 PM, an automated script will fetch a speed map of the Portland-Metro area from WSDOT (Washington State Department of Transportation).

Although I’m still early in the process of collecting the data, I found something interesting on July 21st. Although I have no hard data to support this (I wasn’t there and I only have the empirical evidence of the speed maps), I’m fairly certain that an I5 bridge lift occurred in the late morning.

Before we get to the data, I should note, I’m not a traffic engineer, I don’t hold a degree in Civil Engineering, I don’t work for a government agency and the images below are copyrighted by WSDOT. I’m just a web developer with a thirst for knowledge and an intense curiosity for how and why traffic systems work and don’t work.

Let’s look at the data, shall we?

Our story begins at 12:30 PM, traffic on both sides of the Columbia River seems to be flowing normally as evidenced by this traffic shot:

Fifteen minutes later, I5 is at a complete standstill heading southbound from Washington as well as heading northbound from Oregon. Conversely, traffic directly after the I5 bridge – in both directions – is free flowing. This is usually indicative of a bridge lift that allows marine traffic to pass.

Our next shot, 15 minutes later, seems to indicate that the bridge has been lowered. We can deduce this because of movement on I5 south from Vancouver; it is “Wide Open” just before the bridge and “Heavy” just north of that. On I5 north, there is a different story, traffic is actually getting worse as is evidenced by the “Stop and Go” section extending further into north Portland.

At 1:15 PM, on I5 south in Vancouver, we see the “Wide Open” status just before the bridge change to “Moderate” with everything else being “Wide Open”. On I5 north in Portland, we see traffic migrate from “Stop and Go” to “Heavy”; which seems to be a natural progression. You can also see a small band of “Moderate” traffic begin just south of the “Heavy” traffic. This may or may not be unrelated to the bridge lift since it’s separated by a patch of “Wide Open”, free flowing cars.

One hour after we observed the bridge lift, I5 south in Vancouver is free flowing; there are no more slow downs. However, I5 north in Portland still seems to be having issues. Right before the bridge, it’s migrated from “Heavy” to “Stop and Go” and it’s still experiencing “Heavy” traffic just south of the bridge.

At 1:45 PM, heading north on I5 in Portland, the band of “Heavy” transitions back to “Stop and Go” just like it was at 1:00 PM. I5 south in Vancouver remains unchanged.

At 2:00 PM, I5 south from Vancouver is still free flowing, but I5 north continues to experience issues. Right before the bridge, a small band of “Heavy” traffic materializes but the band of “Stop and Go” traffic just after that remains unchanged.

At 2:15 PM, I5 north is beginning to see some small measure of relief as the band of “Stop and Go” traffic transitions, once again, back into “Heavy” traffic. However, all is not well. Just before the bridge, things seems to be getting jammed up again as traffic transitions, once again, from “Heavy” to “Stop and Go”.

At 2:30, all bets are off on I5 north in Portland. The slowdown at 2:15 PM right before the bridge sends a traffic shockwave down I5 south, transitioning the “Heavy” traffic back into “Stop and Go” traffic. If that wasn’t enough, even further south, we now see a new patch of “Heavy” traffic. This new patch is the start of Rush Time traffic (Rush Hour is a misnomer as periods of heavy traffic on I5 north can go on for five to six hours). Because this is now Rush Time traffic, we can stop our sampling and take a look at the results.

So it easier to visualize, I’ve created a time lapse image of the event from 12:30 PM to 2:30 PM.

Ending Observations

It is common knowledge that in the morning commuters will jam I5 south as they head into Portland and beyond. In the afternoon, the inverse is also true, commuters jam I5 north bound as they leave their jobs and head home. This is not a disputed fact. However, it’s interesting that the data shows that I5 north can become quite a mess even when the bulk of commuters are still at their jobs (assuming that the earliest commuters start at around 6:30 AM and leave at 2:30 PM). This is something that’s rarely, if ever, discussed within the commuting debate.

It’s also clear that based on the data, I5 south in Vancouver will recover more quickly from a bridge lift than I5 north in Portland will. Within approximately 60 minutes of a bridge lift I5 south has completely corrected itself. In Portland, I5 north, doesn’t correct itself until Rush Time is over (on July 21st this doesn’t occur until 8:15 PM).

What causes this? I don’t have any data to support my suppositions so I honestly don’t know. If I were to take a wild guess it would be that the arterials on I5 north are poorly designed and this causes and inordinate amount of merging. Merging usually results in some slow down and in turn this slow down translates into a traffic shockwave that can reverberate for miles. I5 north in Portland is not the only culprit, the entrance to SR-14 eastbound in Vancouver is too close and requires drives to slow down to make the turn. During peak times, this slowdown will extend all the way to the Hayden Island entrance on I5 in Portland (this is the last entrance to I5 north from Portland) and essentially turns I5 north from a 3 lane Interstate into a 2 lane Interstate.

For those that are curious as to what happens before and after the bridge lift, I’ve create a time lapse image from the hours of 5 AM to 9 PM.

Using Ruby Enterprise Edition and Passenger on OS X with RVM

July 21, 2010 — 6 Comments

Ever since I installed Ruby 1.9.2-head with RVM (Ruby Version Manager) I’ve become a convert of using it to manage all of my Ruby installs.

Last week I decided to install Ruby Enterprise Edition on my development environment as my default Ruby install. My motivation for this was two-fold; better memory management and a comment by Laurent Sansonetti (one of the authors of MacRuby and works at Apple) on an article written by Robby Russell titled Installing Ruby on Rails, Passenger, PostgreSQL, MySQL, Oh My Zsh on Show Leopard, Fourth Edition.

The comment left by Laurent suggested not to rename the default Ruby install (and then symlinkling the Ruby installed via Ports) but to manage it by setting the load path.

Using RVM, we can install any Ruby version we want and have it set as the default Ruby instance easily. Let’s see how it’s done.

Note: The following documentation worked on my install of OS X. When encountering an error with the following instructions refer to the RVM documentation.

Installing the RVM Gem

There are multiple ways to install RVM, but I chose the gem install method (even if it is listed as not recommended in the documentation).


sudo gem install rvm

Installing RVM and Adding Hooks to Your Shell (bash, zsh, etc.)

Once the gem has been installed, you can now run the rvm-install command to add the hooks to your shell by running the following:


rvm-install

After RVM has been installed, you’ll be prompted to change something in your shell profile (the end of the install process will provide you with a code snippet). Since I’m using Oh My Zsh, and therefore the z shell (zsh), I opened up my .zshrc file located at /Users/carlos/.zshrc and pasted the code snippet at the bottom of the file.

Here is an example (the code snippet might be different depending on your shell and the version of RVM that was installed):


if [[ -s /Users/carlos/.rvm/scripts/rvm ]] ; then source /Users/carlos/.rvm/scripts/rvm ; fi

Updating RVM to the Latest Version

The gem version of RVM seems to be a little behind (this may be why it’s not recommended) so we’re going to update it. This updates RVM to the latest, greatest version.


rvm update --head

Installing Ruby Enterprise Edition and Dependencies

As the title of this post suggests, we’re going to be installing Ruby Enterprise Edition. According the web site, using Ruby Enterprise Edition has the potential to reduce Ruby memory consumption by 33% (on average) when used in combination with Phusion Passenger.

Before we can start installing Ruby Enterprise Edition we need to install Readline.


rvm package install readline

Once that’s done, we’re ready to get to the main event; installing Ruby Enterprise Edition.


rvm install ree -C --with-readline-dir=$HOME/.rvm/[yourusername]

Usually it will take some time for Ruby to be downloaded, compiled and properly installed with RubyGems support. When that’s done, you can switch over to your new RVM Ruby interpreter:


rvm use ree

Installing RubyCocoa for Use with the Passenger Preference Pane

Passenger is easiest to administer with the Passenger Preference Pane but it has some dependencies that we’ll have to install in order for it to work. If you don’t wish to manage virtual hosts with the Passenger Preference Pane, you can skip down to the next section.

Installing RubyCocoa

At the time of this writing, RubyCocoa 1.0.1 has been released but it’s broken at this time so we’ll have to rely on RubyCocoa 1.0.0.

Let’s download this from source and build it:


tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0

ruby install.rb config --build-universal=yes
ruby install.rb setup
sudo ruby install.rb install

To make sure that RubyCocoa you’ll need to pop open an IRB session:


irb
require 'osx/cocoa'

If everything has gone well, you’ll see the shell return ‘true’ and you’re ready to install the Passenger Preference Pane

Installing and Configuring Passenger

Note: If you already had a development environment up and running, you’ll need to re-install your gems into the new RVM’d environment. When installing a gem into an RVM’d environment, do not prepend the command with sudo.

Before we can install Passenger, we’ll need to generate some wrapper scripts. This is done with the following:


rvm ree --passenger

Since the Ruby Enterprise Edition suggests using it with Passenger, we’ll go ahead and install the gem now.


gem install passenger

Once the gem has been installed, we need to to make sure that Apache is running; open up the System Preferences and then the Sharing applet. Make sure that Web Sharing is checked. Doing so will start the Apache web server.

Since Apache has been installed we need to have Passenger and Apache be friends. Start off by adding the Passenger module to Apache:


rvmsudo passenger-install-apache2-module

Towards the end of the installation process, you’ll be prompted to copy some information to put into your Passenger configuration file. There is a catch though, the Passenger install has no idea that you’re using RVM so the last two lines have inaccurate information (they are most likely referencing your system Ruby instance). The fix for this is easy though, you’ll just have to change the references to point to your RVM’d instance instead.

Here is an example from my install (obviously you’ll want to replace [yourusername] with your actual username:


LoadModule passenger_module /Users/[yourusername]/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /Users/[yourusername]/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11
PassengerRuby /Users/[yourusername]/.rvm/bin/passenger_ruby

As mentioned, the above code snippet needs to be added to a passenger configuration file which I normally put in /private/etc/apache2/other and I call the file passenger.conf. I should note that this directory is owned by root, so when you create the file and save it you’ll have to provide your system password in order to make the changes.

Here is a sample of my configuration file:


LoadModule passenger_module /Users/carlos/.rvm/gems/ree-1.8.7-2010.02/gems/passenger-2.2.14/ext/apache2/mod_passenger.so
PassengerRoot /Users/carlos/.rvm/gems/ree-1.8.7-2010.02/gems/passenger-2.2.14
PassengerRuby /Users/carlos/.rvm/bin/passenger_ruby

#Set the default environment to development
RailsEnv development

# Which directory do you want Apache to be able to look into for projects?
<Directory "/Users/carlos/work">
	Order allow,deny
	Allow from all
</Directory>

Finishing Up

If you’d like to make Ruby Enterprise Edition your default Ruby Interpreter, just use the following command:


rvm ree --default

Once Passenger has been configured, all that’s left to do is restart Apache. You can restart Apache by going to the System Preferences Pane and selecting the Sharing applet. Uncheck and re-check Web Sharing.

You should now be able to add Rails and Rack applications with the Passenger Preference Pane. Note: When opening the Passenger Preference Pane, you might see this warning:

Passenger Preference Pane 32bit Warning

This is normal if you have a 64-bit machine. Since RubyCocoa is 32-bit, it just has to relaunch the preference pane.

RVM is a fast moving target and as such these installation instructions may be out of date by the time you read them. I try to update my older posts when I get new information, but if you stumble across something that doesn’t work or if you know of a better way of doing something, please let me know.