Monthly Archives: February 2008

Fun With Rails and High-Performance Caching Mechanisms (Memcached)

Since it’s Spring break for University of Michiganers, I’ve had some free time to mess around with learning stuff I don’t have time for when school is in session. Something I’ve been meaning to try out is memcached, which is an uber-efficient way to cache stuff in memory so you don’t end up hitting the database a lot for redundant queries.

I installed memcached on my mediatemple machine using some directions I found online specifically for centos. I don’t have yum or rpm or whatever people use for putting new stuff onto their linux boxes. I just wget, untar, and make/make install. I had to make a symbolic link for the libevent thing that I installed as well since the path wasn’t set up correctly. I’m still trying to get memcached to run automatically as a daemon when I boot up. I tried sticking a line in the /etc/init.d/ or something rc.local but it hasn’t really worked. Oh well.

I’m using memcached right now along with a rails gem called “Cached Model” that does a pretty good job of automating the caching process. What’s important to know is that the gem only caches Active Records that are found via a simple find on id. It won’t cache more complex queries. Right now I have it running on my Animenano site caching a bunch of objects. I’ve seen a small though noticeable difference.

Memcached isn’t without its caveats, however. For one thing, your initial db hit is going to take longer than normal since you’re going to be checking memcached, then grabbing the data from the db, then saving the data into memory. From reading the logs, this doesn’t really take that much extra time. The time saved is likely more worthwhile.

I’m always trying to squeeze more performance out of my sites. Periodically I’ll go check out my log files and see if there’s anything taking an insane amount of time to render (like, .1 seconds or so). I’ve caught a few bad algorithm decisions that I had made in the past, and I think for the most part my sites run pretty efficiently. Memcached is a pretty fun way to slice some time off of the page rendering times for Anime Nano.

If you have a few spare hours to kill and a rails app that seems to be a little slow, it might be worthwhile to install memcached and see if caching your Active Record objects will speed things up. I’m seeing a speedup of maybe 1/2 (it takes half as long to load a page) vs running without memcached. That’s totally non-empirical observation, though.

Apple Internship Phone Interview + Verdict!

I had my Apple phone interview on Friday. It went well, except for all of the questions I couldn’t answer! orz.

About five seconds into the interview, I realized that the description given to me and the actual content of the internship would be quite different. The position was described as “iPhone QA Engineer,” which listed duties like “functional testing of iPhone applications” and “design and implementation of test plans and test cases, risk analysis, & integration testing across the system.”

The description that my interviewer gave was that I’d be working on an internal iPhone web application for tracking test results and other stuff. Definitely not as interesting as I thought it would be. It’s probably still kind of cool, but not as cool as doing actual QA on the iPhone.

By the time the interview had finished, I knew it would be a bad fit and that I would get an email with the same sentiments. Sure enough, about two hours after the interview had ended I got an email from the recruiter saying there wasn’t a fit. He said he’d send it to a few other departments in Apple as well. Cool guy.

I’m not too upset about this particular rejection, other than the fact that I feel it was incorrectly described, which cost me a bit of time in my preparation. It was still a good experience, and I got to ask a few questions about the company culture at Apple.

In other non-news, I actually got a successful internship offer, so to speak. But it’s not quite official yet so I can’t write about it until it is.

Overheard in Stats Class

Student: So, log(x)… that’s like, x2, right?

Me: *headdesk*

Facebook Social Ads Really Work!!!


I mean, they work if you’re a captain who knows how to catch big fish with their boats. Oh wait, I’m not! But thanks for the ad anyway… Also, I love the typo: “This app if for?” IF FOR? Seriously? You must’ve gotten your MBA at Harvard!

Microsoft Internship Response + Apple Phone Interview Get!

I heard back from the Microsoft person. Apparently they think I have “great potential,” yet they don’t want to continue with the interview process. Which is just the kind of corporate doublespeak I’d expect from a place like Microsoft. I think it’s unfair to judge a company as large as Microsoft by pigeonholing it into a “good” or “bad” category. But let’s just say things are not looking good for the company. First they seem to be losing the Yahoo takeover, then they reject me. Don’t worry, there’s some sarcasm in there! A little.

In other news, I just got an email from Apple for an internship in their iPhone software group. Cool! I think that would be the best fit as any with me + Apple since I’m not too into the low level details of OS coding. But doing iPhone software would be really cool! The listing on the website didn’t mention any kind of internship in iPhone, so I’m glad I took a chance and talked to the Apple booth when I went to the engineering career fair last week.

I still haven’t heard back from Zazzle but it’s still early in the internship game. Actually, I haven’t heard back from many companies. I’m not really sweating it or anything though. I’ll find something to do during the Summer, even if it’s not with a company.