TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C++: A language for next generation web apps

104 pointsby TomasSedovicover 15 years ago

25 comments

yummyfajitasover 15 years ago
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.
评论 #1079563 未加载
评论 #1080277 未加载
评论 #1079517 未加载
评论 #1080340 未加载
derefrover 15 years ago
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.
评论 #1079650 未加载
d0mover 15 years ago
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 ?
评论 #1079664 未加载
adityaover 15 years ago
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>
brazzyover 15 years ago
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!
评论 #1080602 未加载
tlrobinsonover 15 years ago
<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.
评论 #1080348 未加载
badsectoraculaover 15 years ago
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>
评论 #1080232 未加载
metamemeticsover 15 years ago
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.
fudgieover 15 years ago
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.
bad_userover 15 years ago
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.
khelloworldover 15 years ago
"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.
评论 #1079357 未加载
jrockwayover 15 years ago
Excellent satire.
评论 #1079387 未加载
miloshhover 15 years ago
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.
评论 #1079990 未加载
geirkover 15 years ago
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.
alfredpover 15 years ago
if you're on an embedded device, this is actually not a satire
评论 #1079874 未加载
评论 #1080143 未加载
评论 #1079695 未加载
评论 #1079449 未加载
评论 #1079441 未加载
joubertover 15 years ago
Objc is probably a better candidate because it is so dynamic?
评论 #1080843 未加载
评论 #1080847 未加载
theycallmemortyover 15 years ago
Anyone else remember ISAPI?<p>I still use it. Every day.<p>It really isn't as terrible as you'd think.
coderdudeover 15 years ago
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.
m0shenover 15 years ago
Reminded me of this: <a href="http://code.google.com/p/madfish-webtoolkit/" rel="nofollow">http://code.google.com/p/madfish-webtoolkit/</a>
icefoxover 15 years ago
Language {x} would be good as a next generation web app if there was web app libraries. Typically those are not {x}.
tweilerover 15 years ago
Was anyone else let down that this was a sarcastic thing and not real?
评论 #1079619 未加载
评论 #1079625 未加载
akadienover 15 years ago
I just drank a couple of Pliny the Elders with my neighbor, and now I read this. My head is definitely spinning now.
oztenover 15 years ago
Ending up at C++ because of design constraints is understandable... starting there is idiocy.
rbanffyover 15 years ago
I missed the &#60;sarcasm&#62; tag.
评论 #1079389 未加载
评论 #1079672 未加载
spektomover 15 years ago
He's lying, C++ apps are not portable.