To be fair, after coming back to C++ after years in the world of Python and Haskell, it's not as bad as I remembered.<p>C++ is actually a moderately effective functional programming language. With reasonable knowledge of the standard data structures, and using BOOST, one can actually write fairly expressive and effective C++ code.<p>Most of the time, I feel like all I'm doing is writing a much more verbose version of Python. The rest of the time, I'm hunting nightmarish segfaults and segfault and template errors.
It's perfectly sane to write web <i>services</i> (computationally heavy processes accessed via REST) in C++. But for the algorithm-light, marketing-heavy <i>frontend</i> to such a service, use something easier—the optimizations C++ offers aren't worth it there.
I thought at first that the article was sarcastic :-| I mean, what's taking time is not whether you use ruby python or c++ but the http request, request to the DB, IO or javascript loading..<p>And anyway, the part that really need to be optimized can still be done in C even if you use python.<p>There was a time I was a C++ guy who wanted to control memory and everything.. but now, I've got other things to do. If I can write 1 line that is more readable and cost less to type, why should I use C++ ?<p>And by the way, C++ isn't a verbose python. And, even if I once thought that boost was the best thing ever made, I feel that it's a waste of time. Instead of using meta-programming hacks to use lambda in a clumpsy/ugly way, why not simply use python or scheme ?
IIRC OkCupid uses a webserver and application stack that is all C++<p>Ref: <a href="http://www.okws.org/doku.php?id=okws" rel="nofollow">http://www.okws.org/doku.php?id=okws</a>
What has not been mentioned at all: how C++ webapps will spell the end of XSS and SQL injection as hackers refocus on the much more interesing but almost-forgotten buffer overflow vulnerabilities.<p>Oh joy!
<i>"MySql is GPL'd, so you can't even link to its client library in a closed source app."</i><p>AFAIK it's GPLv2 (and not AGPL) so this is only true if you intend to distribute your application itself, not just host it yourself.
For a two to three years i was running in a VPS server in VPSLink which had about 64MB of RAM - for everything and without swap space. The target use of this VPS was probably as an email server or something as most people recommended the more expensive 128MB and 256MB plans for serving (static) pages. And actually there were only about 40MB left since the OS needed some memory for itself too.<p>Personally i thought that with better resources management i could do much more, so i wrote a custom HTTP server in that could fit in less than one MB of RAM. Most of my pages were generated offline using a custom program in FreePascal.<p>The server could also execute CGI scripts, so i also wrote a forum in FreePascal.<p>According to my logs, the whole system ran out of memory only once :-). Until the day i decided to give myself a little more features (when i got a much better VPS from Linode) i had about 5-6 sites running (different domains), a Subversion server and a few "dynamic" apps.<p>The forum can be found here. I still run it in my new VPS, although it got some spam. The a + b = ? anti-spam feature was new when i wrote the forum but seems that bots got better :-P.<p><a href="http://www.badsectoracula.com/projects/mforum/" rel="nofollow">http://www.badsectoracula.com/projects/mforum/</a>
Let's say C++ can code be executed OVER 9000% faster than python.<p>However this does not imply a web app written in C++ will run even 1% faster than a web app written in python unless the performance bottleneck is code execution.<p>If the performance bottleneck is instead the database server (which it almost always is) then choosing C++ for your next webapp would be a _very_ masochistic premature optimization.
Way back in 2000, when we launched Planetarion (<a href="http://en.wikipedia.org/wiki/Planetarion" rel="nofollow">http://en.wikipedia.org/wiki/Planetarion</a>), we used C++ with a custom webframework, and CORBA for communicating with the database.<p>At our peak late in 2002, we served about 320 million dynamic webpages a month using three desktop Pentium 3's for webservers, and a dual CPU P3 for the database. No caching, as that wasn't needed.<p>Blazing fast, and not all that difficult to work with once the basic framework was solid and in place.
He does have a point about efficiency, or about delivering a single app ... but you also get those advantages with a Java, or a .NET, or even an Erlang or Haskell app which are reasonably efficient ... and still, you won't have to deal with segfaults.<p>Also, if you want extreme scalability, like being able to serve 10000 requests/sec on a single server ... sorry, but raw performance doesn't cut it ... see this article for instance ... <a href="http://www.kegel.com/c10k.html" rel="nofollow">http://www.kegel.com/c10k.html</a>.<p>Not to mention that the most usual bottleneck is the database (how many apps can you build that doesn't use one?). So even if you build the fastest web server in the world, if you're using a RDBMS you're going to end up with 100 reqs/sec, unless you're sharding or caching that data.<p>The bottom line is ... if you want extreme scalability, I don't think C++ is going to cut it, and you're going to invest a whole lot more in optimizations that are already done in more mature web frameworks.<p>Well, unless you have Google's resources and skill.
"Also, as often overlooked by anyone over 30, you have to handle UTF8 to Unicode conversion, but this is easily achieved in a 10 line function."<p>lol.
The reason why dynamic scripting languages are more appropriate for web applications than C++ is simply that the bottleneck is somewhere else - namely, the Internet is slow enough to make the performance of the server-side code irrelevant. That can very easily change in the future.
If this guy is really running his web server on an Acer Aspire One 512, as he says at <a href="http://stevehanov.ca/blog/index.php?id=71" rel="nofollow">http://stevehanov.ca/blog/index.php?id=71</a> C++ sounds like an excellent choice.
I think he does a good job of humorously pointing out the difficulties involved with writing a C++ Webapp, but I don't doubt that he's serious about the performance characteristics being a good thing.