I've been away from Drupal for ~10 years, but I recently helped a friend spruce up a Drupal site he's working on and still found it's largely powered in production by heavy caching, and the page load speeds in development are a slog. I didn't know enough about how he built the site to know if that's still the case everywhere in Drupal or just his configuration, but my impression is still that it's absolutely not production ready without heavy caching in front of the site.
Whether you generate that HTML in Drupal, Wordpress, or some other system, having to run code to generate it is always going to be slower than caching. Drupal is plenty fast for internal previews (i.e. when the server is not overloaded), but at the end of the day it's still a PHP app, and LAMP/LEMP is generally harder to scale up and across vs plain files.
And for what it's worth, a Drupal site cached behind Acquia/Pantheon/etc and their CDN can -- usually will -- be faster than an uncached JS site served from any single data center.
You could, however, use Drupal (or any other CMS) to manage the relatively infrequently-changing parts of the website (static assets, the layout, introductory text, landing pages, much of the Javascript, etc.). And then use AJAX to dynamically fetch in the dynamic portions (the user content) from some other API.
I doubt that's the best approach though... probably there are better systems for something like that. Not my specialty though, sorry =/
------
edit: It's also very different if you're operating at reddit scale vs "small website with a few dozen comments a month" scale. If you're not expecting heavy, consistent real-time traffic, it'll probably be OK. Not as fast as it could be with better architecture, but fast enough that users will put up with it. Hell, we all did it for years with phpBB, the Drupal forums, etc.
- you host at one of the Drupal-optimized services (Amazee, Pantheon, Acquia)
- you put a Varnish service like Fastly in front of the site
- you use BigPipe to serve the dynamic content
- you have experienced Drupal engineers available for your project
If you’re missing one of those pieces, I’d recommend pretty strongly that you find a different platform.
Bigpipe looks like it chunks data from the server to the client, but it's not clear to me how that helps with real time updates to the database?
Varnish can help to a degree, but if you're on a big provider you're going through their Varnish setup anyway (among other caches) and it's not super configurable.
I’m not sure I read the OP the same way you did. If you read it as “can I build a site on the scale of Reddit or Twitter with Drupal” then no, don’t build Reddit or Twitter with Drupal. If you read it as “will Drupal serve a site with user generated content” then yes, it will, but if you’re planning to be a top 10 site on the internet, you’ll need a custom stack.
To be fair, that's the case with pretty much any CMS. Even if they start with a stock system, by the time they actually hit top 100/1000 (let alone 10) there's a lot of custom work to be done.
And realistically, a "top 100/1000 site" is almost always going to have a cloud of other sub-sites and related properties. The corporate site, intranet/HR, jobs and recruiting, press center... The penumbra of "Oh, yeah, we need one of those... but it would be ridiculous to build it from scratch" sites for a large organization can be pretty large indeed.
> if you’re planning to be a top 10 site on the internet, you’ll need a custom stack.
And yeah, that's what I thought the OP was hinting at (or at least hoping to become).
It'll handle small-medium scale forums just fine. Probably any stack would.