I have been looking for a ways to maximize speed in my web application. Came across an interesting application called CSP. Have you guys ever heard of them? They claim that you can program web application in c++. Is it worth it?
That's nothing new really. Just like CGI's.... you execute an application that can be written in virtually any language that hooks into an HTTP pipeline.
I wrote a website using C recently, using libcgic. It worked, and was probably pretty fast, but it was a pain to maintain because it was not written in a very web-friendly language. For nearly all uses, the maintainability of code provided by a scripting language far outweighs the probably slight speed advantage of using a language like C or C++. If there was a particular function that needed tuning, you could glue some C++ to a more normal scripting language for just that part.
You can program your website in assembly if you like.
The point is that the language generally isn't the slowpoint, it's your design that matters when scaling a website.
The execution-time of code isn't really relevant for serving back requests or just outputting HTML; it may be relevant depending on the type of data analysis you need to do, but in that case you just call out to it via whatever web language you choose.
You are much better advised to choose a framework that supports distribution over servers, and design your application (and database) to handle this. This is how you will get real benefits.
You might want to also consider ATL Server (if your platform is Windows). It's a C++ web framework covering web applications (and more) that Microsoft came up with then dropped support for. But they released what they had under a not-quite-open source license (MS-LPL, which restricts use to Windows only):
I've no experience with it, but if I were going to do a web app in C++ I'd take a look.
If you need the speed of C++ in a web application it ALWAYS makes more sense to create the front end using a common web language and have that interface with the C++ application.
...Is it worth it?
It depends on what you're trying to do. Most web applications are built with little or no regard for performance. The majority of pages do not need CGI at all. Using a database and code to produce/modify the page makes sense but serving pages to clients by generating each time is not optimum. As stated by others, creating the design, layout, content, infrastructure and keeping it all running usually take precedence over speed of generating the page. The current methods used for performance are reverse caching, edge side caching, load balancing, clustering, etc.. The web system is fed by a standard framework (java, php, python, ruby, perl, etc.) and the performance gains are met by spreading the load over more boxes and caching. Any CGI, even C++, will be slower than static files served by an optimized static server (ex. nginx) or static files served from memory using a reverse cache (ex. varnish). That being said most people shy away from using a lower level language for web serving because of lack of knowledge in lower level languages and the mass of code and frameworks available in scripting languages.
Having worked on projects where management dictated that no open source code was to be used, I do not agree that it takes longer to develop using lower level languages. If you wrote "all" the code in PHP it would take you just as long but most don't. Most people use other's code and then claim it's faster than writing all your own code in a lower level language.
Web apps usually are very simplistic and over time you (or your company) will develop a set of libraries to do standard web routines. Once written, a CGI web page can be constructed just as fast in C or C++ as in any scripting language. But if you need an json imported to your AJAX output chances are you'll find some amount of starter code in a scripting language rather than a lower level language.
Are web apps built with C and C++? Absolutely. Many of those "evil" ad servers are coded in C for performance. Many web based "applications" are built using C or C++ such as VMware's web based virtual console.
If you're looking for performance start thinking of your web application as two separate apps. One is a content management and page generator. The other is the serving framework. Full pages and page fragments can be pre-generated or generated on demand and served as static files increasing performance far above any changes in programming language. Even if a page only lasts for two requests it may be 100 to 1 load and speed difference. Dealing with sessions, authentication and authorization becomes the tricky part. How to de-couple sessions from pages and maintain security. This is often done by using C based modules in the web server. The same thing is done for SSL decryption, GZIP compression, flow control, etc..
If you're writing a web based game server or complex web app then by all means start building a C or C++ library. If you want to speed up a blog, learn and use clustering and caching techniques.