Posts Tagged ‘rails’

Scaling Rails to 300 Million Pageviews

Monday, February 18th, 2008

Free Image Hosting at allyoucanupload.com

There’s an awesome rails scalability case study up at HighScalability.com:

In a short three months Friends for Sale (think Hot-or-Not with a market economy) grew to become a top 10 Facebook application handling 200 gorgeous requests per second and a stunning 300 million page views a month. They did all this using Ruby on Rails, two part time developers, a cluster of a dozen machines, and a fairly standard architecture. How did Friends for Sale scale to sell all those beautiful people? And how much do you think your friends are worth on the open market?

Friends for Sale App on Facebook. I hope there’s still room in the marketplace of ideas for new breakout Facebook apps. I’ll be trying my hand at some soon.

Simplicity vs. Power

Thursday, February 7th, 2008

Free Image Hosting at allyoucanupload.com

Vs.

Free Image Hosting at allyoucanupload.com

The ’simple’ mantra has been put forth in recent years by companies like Apple and 37 Signals.

But that doesn’t mean that all humans are perfectly rational creatures. A thread on reddit recently talked about how companies (or purchasing managers) will make decisions based on feature-lists, not the features that actually end up being used.

So your application might need to have the XML Widgets Technology © with SalesForce.com Integration (Siebold/Peoplesoft/Oracle Compatible) feature, even though chances are 95% of your users will never even use it.

Joel has talked about this before:

A lot of software developers are seduced by the old “80/20″ rule. It seems to make a lot of sense: 80% of the people use 20% of the features. So you convince yourself that you only need to implement 20% of the features, and you can still sell 80% as many copies.

Unfortunately, it’s never the same 20%. Everybody uses a different set of features.

Ok, so how does one address this?

An Open Source Case Study

Sure, it’s a lot harder to pull this off when you have to deal with a real UI and your target market isn’t programmers… but here’s how I dealt with this problem in the backup_fu rails plugin.

The only thing the user needs to touch is a 6-line configuration file. Here’s the default:

# The app_name is used as the backup filename prefix
app_name: replace_me
# Note: please create this bucket (whatever yours may be) externally first:
s3_bucket: some-s3-bucket
aws_access_key_id: --replace me with your AWS access key id--
aws_secret_access_key: --replace me with your AWS secret access key--

This gets the user just to the point of being marginally useful. They can backup their database & sync it to Amazon S3.

Modifying 4 lines in a config file doesn’t seem all that scary, does it? Of course, if you opened up this monstrosity, it might be a little more daunting.

To reveal the full power of backup_fu, one has to peruse the README to uncover the advanced configuration options available.

As you can see, I don’t 100% buy into the simplicity mantra. Yes, simple is nice for something like an iPod where the form factor dictates how limited one is when it comes to functionality.

But for a web application (or rails plugin), I believe there are often ways to keep the simple aesthetic (which is what people really like about Apple, 37 Signals), while still giving the power & flexibility of greater or more enhanced functionality.

The software program which most comes to mind here is Quicksilver:

Free Image Hosting at allyoucanupload.com

Any TextMate Mavens in the House?

Monday, January 7th, 2008

I just posted this to the TextMate users mailing list, but blogs seem to be a great way to harness the wisdom of crowds as well…

In Rails 2.0, the new default for view extensions is ‘html.erb’ instead of ‘rhtml’, and ‘builder.erb’ instead of ‘rxml’.

The only problem is that TextMate uses a generic white icon in the project drawer for all files with the ‘erb’ extension. I’d much rather have sexy icons in the project drawer for each distinct file type, as ‘rhtml’ files have currently.

What I’ve Tried

See this pastie as to how I modified TextMate’s Info.plist (XML tags were not getting escaped by WordPress).

Saved Info.plist, then Quit completely out of TextMate. Next, opened up an existing rails project, but the ‘index.html.erb’ for example, still showed the generic TextMate icon in the project drawer, not the tiny blue globe one that ‘rhtml’ files use. (I really like the way it strikes the eye… what can I say?)

Any ideas?

ps. this is probably completely unrelated, but I also went through Finder and did the ‘get info’ -> ‘change all’ trick to open all ‘ html.erb’ files in TextMate, yet the icon in Finder remains the generic white OSX one, not TextMate’s. Figured that’s an OS X thing but thought I’d mention it just in case.

The Benefits of Releasing Software as Open Source

Friday, January 4th, 2008

Just came across this post which talks about automating Facebook interaction to perform a request in a Facebook app.

Their ruby code is here (much of it based originally off mine — which is so cool).

For the longest time I didn’t get open source… why anyone would give away their hard-earned time (in the form of code) to everyone else.

It’s not some hippie thing though. The benefits are:

* expands your “street cred” in the community
* allows other people to enhance what you’ve done, and possibly, contribute back to the project
* fosters even more giving back by growing pie — it’s not a zero-sum game, as many would believe

In my case, I’ve almost always already written the software that becomes open source. Without releasing it, the code would simply rot on the vine. Usually within 2-3 hours (though I’m getting better), I can have the code cleaned up, tests added (if applicable) and released as an open source project.

The original Facebook automation article is here: HOW TO: Automate Facebook Interaction using Ruby and WWW::Mechanize.

More recent open source work: Sexy Temp Passwords (rails plugin), Dynamic File Store (rails plugin), and The Hydra Project.

Thoughts on “Rails is a Ghetto”

Monday, December 31st, 2007

I won’t link to the article, but recently a very popular and well-respected member of the rails community wrote some scathing stuff about some members of the community, pretty much lambasting the entire RoR crowd in one fell swoop.

If this person’s blog had “Enterprise Java Architect” plastered across the top of it (and was not a well-known ruby contributor), then I’d probably be here ripping him to shreds. Actually, I’d probably be here just ignoring that kind of rant…

I’ve blogged before about the ability to take criticism well. Unfounded, meritless attacks are one thing. But if the criticism points out some flaws that are recognizable, I’m more than willing to take a good hard look. Won’t necessarily agree with the critics or feedback all the time, but it’s worth at least getting, to see how other people perceive you / your abilities / etc.

That’s how I would view this attack on some members of the community. He backs much of what he says up with IRC logs. Some of them, if true, are indeed astounding. i.e. the fact that a, how shall we say, major RoR operation had to restart their app server 400 times a day. Who knows if this was an exaggeration, or later turned out to be due to hardware failure (it happens).

On Consulting

It’s this persons right, but he basically called almost all of his consulting clients “morons” or some such. His reasoning was that he had a business degree as well, and obviously a high sense of self-worth & belief in his ideas, etc.

This person should clearly not be doing consulting. He made some pretty major mistakes, i.e.:

1. Not getting a percentage paid up front (i.e. minimum 30% of some X amount)

2. Kept working on projects even though he wasn’t getting paid (similar to #1)

3. Allowed his clients to pay him NET-30 (turned into NET-60)

You have to be pretty firm as a consultant or clients will try and walk all over you. On several occasions, I’ve had the opportunity to glance at client’s bank accounts just to ensure A) they had a viable balance, or B) they indeed were sending me a check via their bank’s check mailing system.

In these cases, I didn’t ask this but the clients offered this to me as an assurance that they were the real deal.

For every 1 paying client, you get 4-5 people who want you to work equity-only, so often the lines are blurry.

Do Most of Us Get it Wrong?

Statistically speaking, most of said rant author’s clients probably will fail. But at least these clients are taking chances by starting “some silly social network.” BTW - has he heard of silly social networks like Bebo who targeted the UK market (even while MySpce dominated here) and is now valued at hundreds of millions?

Or perhaps Digg, which was built by a php contractor for ~ $2,000 paid for out of Kevin Rose’s retirement savings. This ruby contributor (god bless his contributions, which my apps use daily) would probably have scoffed at Rose’s idea for “yet another” social bookmarking site.

Small sample sizes indeed, not scientifically indicative, but if all of these client ideas are stupid, then sites like Digg, Bebo, etc. would never have broken through.

Extraction of Sunk Labor Cost Value Through 60+ Hour Weeks

The rant author then goes on to post this gem, which I could finally get behind (company name removed so as to not run their name through the mud via hearsay):

Because ******** pays these people a salary that is fixed and considered a sunk cost. If they pay someone 60k/year and that person works 40 hours/week then they are paying them about $29/hour. If they convince this idiot to work 60 hours/week then they are basically paying the moron $19/hour. If they can push them to 80 hour/week then these idiots are actually making $14/hour. You can make $29/hour managing a fast food joint.

The further and harder ******* (or any consulting firm) pushes its employees the more money they make because then they charge the client for each fucking hour. Get it? If they push an employee to 60/week they not only reduce the cost of that employee but also increase the billable hours. Hell, even if they don’t charge for those hours they still make more money just by reducing costs.

Okay, but that could be said of any company that hires someone on salary but then pushes them to work so many more hours each week.

I’ve had occasion to work with people who seem to value hours spent in the office as opposed to actual productivity.

They basically come across as having the Jesus Complex, i.e. “they died in the office for our sins.”

Here were some of the things that were slightly annoying about this mentality:

1. You could, literally, get as much done in 20% of the time (or 5x as much for the day), but if you didn’t work 10 hours that day you still looked like a slacker.

2. Working from home is not allowed. Lord knows, people might *goof off* at home (or run errands) in between checking in code. Because no one ever surfs Google Reader, Digg or their favorite sites in the office.

3. Were not accustomed to using a Changeset viewer to see exactly what everyone is working on each day.

4. Changeset viewers would make it trivial, for example, to see if someone indeed produced many multiples of quality output as someone else.

5. Would spend 20+ hours setting up their favorite version control / ticket system, when Unfuddle and friends would be ready to go in 5 minutes worth of setup.

6. Would create new projects (not optimizations) that could take days to implement (not to mention maintain), when leasing an additional server @ $125 per month would solve the problem equally (if not better) as well.

This is not directed at anyone individually, but rather that kind of mentality that values “looking like you’re working hard” vs. actual quality output.

Under Pressure

I’ve had to deal with a pressure cooker situation before, where this statement from our rant author rang a bell:

I saw them pull passive aggressive shit like picking on a single employee high-school-nerd-vs-jock style until he conforms or quits.

In my case, I got the heat because of my speaking up about the diminishing (then negative) returns of pushing devs in 60, 70+ hour weeks. Then eventually walking out one evening when my feelings on the matter weren’t being heard.

If you’re treated like this, it probably is a good idea to just walk out or somehow or another assert your value. If you’re normally a rockstar but are farting along, checking in crap code, while you see your fellow devs checking Facebook stats every 5 minutes in between GReader sessions, then you know that nobody is really getting much done but is rather just putting in face time…

All in all, that experience was a learning one, and it was more about miscommunication, middlemen / managers, etc. than anything.

Rant Repercussions?

Will this developer’s rant have repercussions beyond the ruby world? Perhaps — this could end up all over Digg, programming.reddit.com, etc.

I say that’s great though. If the RoR community can’t take criticism, then it will never actually evolve or learn to take a good hard look at itself in the mirror.


Shanti A. Braford blogs here.

If you really want to know, just read this.



  

Powered by FeedBlitz