13 ms·
CppCMS – High Performance C++ Web Framework
- bhauer 13y agoI would like to see an implementation of our test suite [1] for CppCMS in order to see the CppCMS vs CPoll-Cppsp cage match. Any C++ experts who would be so kind to send us a pull request? :) [1] http://www.techempower.com/benchmarks/ http://www.techempower.com/benchmarks/
- onedognight 13y agoI love that the code for the fastest database backed web server[0] found in this test suite, beating golang by 40% and node.js by 13x comes from a repository[1] that is filled with "all the code i've ever written since grade 11; also includes some forward-ported code from grades 8 and 9." including random class projects and a netcat replacement. [0] http://www.techempower.com/benchmarks/#test=query http://www.techempower.com/benchmarks/#test=query [1] https://github.com/xaxaxa/workspace/ https://github.com/xaxaxa/workspace/
- bhauer 13y agoYeah. I've considered adding a popularity attribute of some sort to use in the filters. E.g., "mainstream," "challenger," and "fringe." But to date, I've not put a whole lot of thought into how exactly I could objectively measure popularity. Perhaps Google search hits for "[name] web application framework."
- feniv 13y agoThat would be biased towards the frameworks named as some common word (like "go") being mistakenly marked as more popular than they are.
- bhauer 13y agoIndeed. I'm not really sold on the idea, and addressing this is not a priority. I just wanted to point out that I'm aware that it's a little funny to see fringe frameworks compared head-to-head with mainstreamers. But the charts are but one data point to consider in evaluating options. :)
- greyfade 13y agocppsp also compiles with a comically large number of warnings.
- n00b101 13y agoIt seems there's no documentation?
- deleted 13y ago[deleted]
- dewey 13y agohttp://cppcms.com/wikipp/en/page/cppcms_1x http://cppcms.com/wikipp/en/page/cppcms_1x
- marc0 13y agoI would be interested in how this perfoms compared to the web server implemented in Go
- Bjoern 13y agoOr Erlang.
- daeken 13y agoI must say, I made a beeline for the security page and was not disappointed. While I think they underplay the risk of memory corruption flaws (namely by emphasizing backups to be critical, rather than isolating user data to minimize compromise in the case of the site being owned), they otherwise do a fantastic job. I can nitpick a bit (and will probably send some recommendations to improve the guide a little) but I really have to commend them on that.
- pcwalton 13y agoI knew I would find a statement like this in the security page: "So using modern language techniques programming in C++ is not more dangerous then programming in Java, Python or Ruby." This is a belief that many C++ programmers have, and having spent much of my life in the past few years finding ways to break a C++-like memory model (Rust) I cannot emphasize enough how dangerously wrong it is. Safer than C, sure. As safe as a memory-safe language like Java, absolutely not.
- dakimov 13y agoWhat are you talking about? The safety you mentioned comes from only two things: type safety and runtime array boundary checks. There is no problem in implementing runtime boundary check in C++. What else in C++ is less safe than in Java? Is there some kind of magic?
- pcwalton 13y agoIterator invalidation, returning references that outlive their referent, storing references in data structures that outlive their referent, invalidation of the "this" pointer, etc.
- dakimov 13y agoBasically those are examples of bare pointer manipulations (as references are essentially syntactically sugared bare pointers). Although it can be mitigated with specially written collections (incompatible with the standard collections) and strict coding guidelines, I have to agree with you that the C++ memory model itself is insanely dangerous.
- solox3 13y agoOdd wiki. Unlike Wikipedia, the front page is completely open to public editing.
- mariusmg 13y agoWhat's next ? A OS written in Ruby ? snark
- abhinavk 13y agoIt's not a Content Management System. Read the article.
- ExpiredLink 13y agoC++ isn't suitable for Web programming.
- kryten 13y agoHalf of eBay used to be a massive ISAPI dll plugged into the back of IIS. It did a fine job at the time!
- Impossible 13y agoOKCupid is written in C++ as well. (http://www.okcupid.com/about/technology http://www.okcupid.com/about/technology)
- tomjen3 13y agoThat seems really strange. I mean I get why their database is written in that, but I would imagine that their matching algorithms, at least, were written in something more easily adapted to change. It is one of the cases where I would want to write it in Lisp.
- pothibo 13y ago1997 called. They want their framework back.
- pothibo 13y agoWhile I still stand by what I said, I want to add a clarification. Some languages are good at some things while others are good at some other. C/C++/etc are good for job intensive stuff that doesn't need fast maintenance cycle. Dynamic language are good as web server because of their flexibility and their fast response time (In term of maintenance) I wouldn't run an OS on Javascript and I wouldn't use C++ as a Javascript replacement in the browser.
- jmcdonald-ut 13y agoHow did Java fail? Java servlets are still very much so in use. This is for back end code, and I can certainly see this being useful. Edited to add that they mention that this won't satisfy every use case, and also what use cases they think it does satisfy. http://cppcms.com/wikipp/en/page/when_to_use_cppcms http://cppcms.com/wikipp/en/page/when_to_use_cppcms
- pothibo 13y agoI removed the Java part because it was ambiguous and unecessary
- dakimov 13y agoDon't you think that first off you need to be an expert in all those languages, in web-technologies, have vast experience and up to date knowledge in all of that, to make such claims? I'm pretty sure you just have wrong impression of C++, or to put it simply, you don't know C++. In what way does C++ have worse response time in terms of maintenance? What do you mean exactly? In general, statically typed compiled languages are better at refactoring than dynamically typed interpreted ones. Changing programs in the latter without fair test coverage means teetering on the brink of a catastrophe. Just recently I have seen an article on HN claiming unmaintainability of dynamic languages. The truth is that every general purpose language is general purpose, and the claim about language suitability is a commonplace and an overgeneralization. You can do 3D games in JavaScript and client web apps in C++. Different languages have different drawbacks and that may limit their applications, but C++ is not targeted for OS development, and JavaScript is not targeted for web development, both are just general purpose languages. Speaking of "low-levelness" of C++, with all the modern features and libraries it is as high level as other languages, and in some aspects is even more high level, e.g. JavaScript or Python have no corresponding means as the template metaprogramming which is the high high level. C++ just allows you to do low-level manipulations, you are not required to. There are many myths and prejudices against C++ caused by ignorance and frustration of those who have not cracked it at a time.
- IzzyMurad 13y ago"CppCMS is a Free High Performance Web Development Framework (not a CMS)" This is so dumb. Why it is called CppCMS then?
- sce 13y agohttp://cppcms.com/wikipp/en/page/faq#If.CppCMS.is.not.a.CMS..where.does.this.name.come.from http://cppcms.com/wikipp/en/page/faq#If.CppCMS.is.not.a.CMS..... Quote from that page: The original idea was: "Write your own CMS in C++". The lead developer asked in 2008 for a better name but didn't get any suggestions, so the name stuck. It was decided later to keep this name as it was already well known name and all the software around used cppcms as the namespace.
- CCs 13y agoCppCMS license is LGPLv3 - not too company friendly. CppDB on the other hand is MIT or Boost. It is the best DB library I found so far for C++.
- nitrogen 13y agoHow is LGPL not company friendly? It allows you to make all the changes you want for your own web site without having to distribute source code. If CppCMS is designed as a library, you can even use it in proprietary applications.
- CCs 13y ago1. It is limiting: no static linking or you have to distribute re-linkable object files (LGPL section 4.d.) 2. It is long and complex license, not yet tested in court. Sometimes what constitutes a "derivative work" is not that clear. 3. Section 6 says all these can be changed anytime, potentially making it more restrictive (see GPL v3). So from the business viewpoint it is better to find an alternative now than to potentially lose all the investment later.
- thezoid 13y agoThe LGPL doesn't apply to network distributed software. Working with this software via an API (i.e. HTML) doesn't mean you need to do anything. These kinds of licenses are put in place so people can't create proprietary extensions/patches and fracture a community. Now, I'm not saying this is better than MIT, but at least deters people from that. 1. will only matter if you are distributing binaries to clients/customers, which generally isn't the case with a SaaS product.
- CCs 13y agoIt does limit your future options. GitHub started out as SaaS and now offers Enterprise product https://enterprise.github.com/ https://enterprise.github.com/
- unabridged 13y agoI looked into CppCMS a few months ago, I would love to use it but the lack of SSL/HTTPS is a huge detriment. If I have to stick nginx in front of it for SSL I may as well keep using fastcgi.
- lsh123 13y agoDisclaimer: I used to write Web apps in C++ in late 90s/early 00s for the largest web company of the time. 1) DB is often a bottleneck for web apps. Not always. But often. Very often. Optimizing pages rendering will improve the performance for pages that are already rendered pretty fast. It will do nothing for pages that are loaded slow due to DB access. A better/smarter cache will give you much bigger bang for the buck. 2) For the annual salary of a good C++ programmer (i.e. one who can write safe and readable code with STL and Boost), I can run 50 large AWS instances for a year. 3) Writing safe C++ code is hard. Even with STL and Boost you still have to understand the little details of objects ownership (see boost::shared_from_this<> as an example). Overall, I would invest in distributed system with smart and efficient caching instead of trying to optimize single server performance. At the end, you will run out of the single box solution (if you are successful). Going from 1 server to 2 servers is really hard. Going from 10 to 100 is not too bad.
- danielparks 13y agoDisclaimer: I’m not a C++ guy; I generally write in Ruby and PHP. I agree with your overall point — C++ may not be a good fit for web development, and there’s a lot to be said for being able to scale across multiple servers (and choice of platform will determine how quickly you have to solve that problem). That said, my experience is that for most projects the performance bottleneck is the framework, not the DB. On big PHP projects, loading lots of code on every page load takes a huge amount of time, and many frameworks do things like parse multiple XML files on every request. Similarly, Rails is slow… just take a look at how much time is spent outside of the database for a typical request. It’s crazy how long it takes, considering that most requests boil down to a DB query and then some string concatenation. Another angle on his is the common pattern of having a bunch of app servers and just a few DB servers. That implies that the DB is not the main bottleneck. Again, I agree with your overall thesis, I just have to disagree with the common wisdom that is point 1.
- lsh123 13y agoIn my statement I kind of assumed that all the "cheap" optimizations in the framework are already done (e.g. PHP APC cache is enabled, lazy classes/configs loading is implemented, etc.) so we compare "apples-to-apples": a highly optimized C++ framework to a highly optimized, say, PHP framework (can't comment about Ruby - didn't have experience building/running large-scale apps on it). And of course, it all depends on the application itself. Fetching single "narrow" rows by primary key is obviously cheap and nobody cares. However, you have to dig through a table larger than 500G with multiple indexes is not so cheap. And the reason why you don't see a lot of DB servers is that it is HARD to scale DB by just adding servers (I am ignoring for a second non-SQL servers w/o joins as well as high-end Oracle and new MySQL-Galera solutions). An ACID compliant SQL DB is a single-server affair unless you invest heavily into the DB itself since it is really hard to run DB cluster even from pure operational standpoint.
- ricardobeat 13y agoIf the only benchmark is going to be against PHP + Wordpress, you might as well just say it's better than zero.
- krakensden 13y agoThey've got translations in their example: http://cppcms.svn.sourceforge.net/viewvc/cppcms/blog/trunk/po/ http://cppcms.svn.sourceforge.net/viewvc/cppcms/blog/trunk/p... Something more web frameworks should do.
- benjamincburns 13y agoSome of the negative comments here really anger me, and I feel a need to speak up. Who gives a flying fuck if this tool is the right one for whatever is your individual definition of web development? The fact is that someone had a need for a particular solution and they were kind enough to build it, document it, and show it off here for free. Turning your nose up at this based on language choice just makes you a close-minded fool. Applications for this do in fact exist, and I'm quite pleased that the author was kind enough to post this. On a past project I've had to write my own asynchronous web framework in C based on the wonderful libmicrohttpd. I decided on C because this was a resource limited device on which I was already using every available CPU cycle on a realtime computer vision algorithm and it all was just barely performing within acceptable limits. I needed as tiny a footprint as I could get. I'm in the early stages of a different project which will probably face a similar situation, except on this massive concurrency will be key. I will absolutely be looking into CppCMS when the time comes.
- j_baker 13y agoYou know, every time I see one of these types of frameworks the first thing that comes to mind is "Some people are just determined to make C++ look cool again". I mean sure, sometimes you run into a case where you are running computer vision algorithms on an embedded device and have to choose C or C++. But how common are those use-cases really? And why on earth would you want to worry about buffer overflows and memory leaks when you're already worrying about XSS and CSRF attacks? As fast as modern Java is, it just seems unnecessary.
- yati 13y ago> And why on earth would you want to worry about buffer overflows and memory leaks Have you written a line of code in modern C++? Know what RAII is? If you use C arrays and char*s in C++, that's your problem - the language provides idioms that are "as safe as" Java.
- kybernetyk 13y agoThis. I can count the occasions where I used new/delete (and worried about lifetime of objects) in the last year on one hand. And I'm a full time C++ developer.
- jokoon 13y agoHaha, I feel like there is a language bubble, everyone is using their interpreted/bytecode language, but people never realize how performance can be and is still always an issue. Even with the fastest computer, or cloud, or cluster, computer resources are always finite, and it's easier to reach that limit than anything else. People relying too much on inteepreted or bytecode languages end up making abstraction on what happens on the metal, forget the basics of good enough performance, and bam, even the fastest server looks like a piece of garbage. I'll always be conservative regarding language choices, because if a language makes things easier, it should also be taken with a grain of salt.