I have languages like Python, Java, Node and many others for web development. Considering the fact that C++ has a better performance in most cases, why isn't web development using C++ mainstream yet? Do you believe this is a territory worth exploring?
When I have laid the foundations of my latest endeavour (http://cloudy.sh), I took a lot of web development platforms on a test drive. The main requirement of the project was an easy to use multiplatform client software, backed up by a stable web service. I also needed strong encryption both client and server side and some support for web programming generics.
For the client I quickly decided for Qt, this being the only real multiplatform alternative for a modern UI, but deciding upon the web part took several rounds, till it hit me that the only sensible way to achieve what I want is by using C++ as the main language for the entire project in order to avoid code duplication, and to have a consistent implementation of my product.
This decision gave me access to a large set of libraries, providing encryption (botan), email handling, webserver part (tntnet), database (tntdb), so I could concentrate on what's important. The application.
Not considering all the performance issues C++ is supposed to come with, the only gain I really felt worth while doing the project was that I could use a largely common codebase for both the client and the server, so there was no need to re-implement the same thing in various languages.
So I can say that if it depends on the project C++ can be and it is used in an end-to-end web project.
I think ANSI C will come back actually. The reason? The Internet of Things (IoT). These devices in some cases have very little power consumption. I know a bit have ongoing monitoring as to how to begin a project. As usually, these are products that use various Microcontrollers from the ARM cortex series, of which there are many; see also Texas Instruments.
Sometimes what you're looking for is not precisely performance (if so, everyone would program in pure C). While C++ gives you the benefits or C with classes, you have to do memory management and many other costly operations regarding development time and architecture design (like compiling the code).
Java/Python/C#/PHP help speed up the development (some are interpreted, have memory management, havecleaner syntax, is easier running a webserver) by losing some performance. And it isn't generally so much.
I think C++ is great you want to heavy-computing operations. Also, remember that general runtime performance remains more in algorithm complexity than language implementation.
C++ has it's uses for sure, but the reason for not using it for web backends is that 95% of the times you don't need the performance that C++ offers. What you do get is a maintainability nightmare, features taking months vs days to release and a shortage of talent.
Any development has a cost associated, for C++ it just way more for any sort of web development.
The IO over head (in reading a file and sending the data over network) is huge, it overshadows the performance gain obtained by using C++. If a server does huge number crunching then using C++ is necessary. Transcoding an audio or video, image processing, natural language processing etc require huge computation and this kind of work load is where C++ performance is required. Based on the need the programming language is decided.
Zero copy data transfer from hard disk to network card, async data read/write, etc can be difficult to implement in some high level language. That is why web servers like apache, nginx, node are written in C or C++ as they need multi-threading, async IO, fork / exec and other system call access to make serving data fast.
Example: Google page ranking algorithm uses matrix operation, svd etc. It requires huge number crunching so it uses C++ and Fortran libraries that does number crunching. To serve search result C++ is not necessary at all.
When a video is viewed in youtube the server spends most of the time on reading the file and transferring it via network. But when a video is uploaded the youtube server starts encoding the video in different format (mp4, webm etc), different resolutions. This involves huge number crunching, for this youtube uses ffmpeg which is written in C++.
Deák Ferenc-Lajos
Pragmatic developer
PrasannaKumar Muralidharan
Kernel developer @ Witworks
Hugo Mota
Code Hero
Unless you're alerady "fluent" in C++, I wouldn't do that. HTTP is a stateless protocol, meaning it's capable of horizontal scaling. This also means language performance is not that important.
Bottlenecks for web are most often in database queries. Meaning you would have much more performance gains by dropping ORMs and learning how to do proper SQL and database management.