Web frameworks are like onions (layers ypon layers)...
Last night's post got me thinking about something else... high-level languages/frameworks and performance.
Take a look at the call stack for any ASP.NET, Java or Rails web application and you'll see what I mean. On Rails, there's a massive amount of pure Ruby code being executed for every query.
With a general HTTP server like Apache, we've already put in a layer of abstraction between our app and the socket to write data out to a user. Granted, that's a pretty thin layer witthen in C, but it's still a layer. Next we have FastCGI. Then the aforementioned pile of Ruby code. Pretty much the fastest query handling I could get in Rails, even without any DB action, was upwards of 16ms.
In the business I work in, 16ms is an eternity (our company doesn't directly sell web stuff). On the computer I'm using right now, 16ms is 54,400,000 cycles. Obviously we've come a long way since I was coding in 6502 assembly if we're willing to give up that many cycles to putting together some text.
So let's say a pure C# version of a Rails app can get that to be 5x faster (I don't think that's at all improbable, given Ruby's slow interpreter). By adding a little complexity to your language and adding to development time, you've essentially allowed yourself 5x less machines in the machine room to handle queries.
Now let's say you write a pure C++ version of your app and it's 10x faster. Again, 1/10th of the machines can handle the load.
At what point will this kind of thing pay for itself? 2 months? 5 months? Never? Is it ever worth working in the lowest level language anymore?
Granted, I'm a .NET junkie, but I've started to wonder if maybe we've gone too far in getting away from the bare metal. Shouldn't we still care about maximum performance? Java and C# are pretty damn good JITs, but you can still get a massive boost by using raw C++. And there's much less memory overhead.
Thoughts? I found Wt because I was wondering if anyone was doing web development in C++ anymore. So I guess I'm not completely alone on this line of thinking.
1 comments:
Maybe is Mango better solution than C++, and D is nice language, with power of C/C++ and agility of scripting languages.
Post a Comment