MVC may be Slowing Down Your Site
subbu.org
subbu.org
Seriously, stop posting and upvoting these stupid as hell blog posts, install Varnish or load your content with AJAX. And most importantly, don't put your real name on posts like these.
I know I'm over-generalizing here, but most PHP apps can print a the website's headers and navigation and send those to the browser before it starts doing the heavy lifting. The reason? Basically because they are just a smart template, and the logic is in the view.
Java JSP's are actually the same. Very often you can see a jsp powered site print the website headers and CSS so that the browser can be rendering while the server is still working.
The problem with most MVC frameworks is that their interface looks like HTTPResponse process(HTTPRequest), which doesn't imply but pretty strongly suggests that the server isn't going to send any data back until the request is finished processing. Generators provide an API that theoretically gets around this limitation, but in reality would require massive amounts of coding in order to make all the iterators involved lazy.
So using some dumb, non mvc frameworks, it's easy to get a shorter time-to-first-byte. With a fancy MVC framework, it's pretty difficult and involves lots of lazy loading (to delay the processing associated with database requests).
So yes, MVC as implemented by most of the web, might be slowing down your site, and despite the relative sophistication of the HN crowd, it's not a problem that most front-end devs have on their radar.
It might be interesting to try something like this with a generator, so that "for response in process_request(request): send_response_to_client(response)" would work.
E.g. in Rails, by default, due to the fact that you can have views provide content for your layout (using content_for), it has not been possible to start sending your rendered HTML before the rendering was completely finished.
There is an experimental Fiber based solution in Rails Core, that shipped with 3.2, that kind of fixes that issue, but only to a certain degree (see http://api.rubyonrails.org/classes/ActionController/Streamin...).
So why give it a linkbait-style title?
Even the article admits this isn't necessarily an MVC problem.
Oh, everyone else already covered it.