Page is being generated
Once in a while I get the question why a visitor gets the message “Page is being generated” within their TYPO3 website and if this message can be removed. In this post I will explain you why you get this message and what you can do about it. Or why you shouldn't...
Why do you get the "Page is being generated" message?
The reason that this message shows up is actually quite simple. The message already explains: "Page is being generated". When the cache of a page is expired or you just altered a page in the backend, the first visit of this page in the frontend will cause the page to be generated. All PHP-code will be excecuted and at the end, if possible, a cache-entry will be saved.
The visitor that has this first "hit", will have to wait until the page is fully excecuted and stored in cache. Such an uncached action, can take up from below 1 second, up to 30 seconds (the worst I have seen, but it might even be more). While the page is being generated, other visitors to this spcific page will see this message. When the page is fully generated again, this temporary content is removed and your vistors will see the normal content again.
How can I get rid of this message?
Quite often I get questions of integrators if it is possible to get rid of the message "Page is being generated", because it will give a visitor a "strange" message instead of the content that needs to be shown. With that in mind, I can truly understand why you want to get rid of this message. But...
This message is there with a very good reason!
When this message is shown, it means that someone else is in the process of building the current page. If this message was not there and a lot of users will visit that page at once, it can cause a serious load on your server. This is of course only the case when you have a lot of visitors visiting your page on the same time. All users would end up generating all PHP and configuration. So this message really prevents your server to crash on high traffic installations. So I can only advise you to leave this message in your system to prevent your servers to crash on high traffic.
But I'm losing visitors...
We all know that visitors (at least in western Europe) wants to view the content within a couple of seconds. When vistors get the "Page is being generated" message, they will not get any content at all and most likely will leave your website. So I can understand why you want to get rid of the message.
When you disable this message and just let all visitors render the uncached page and you have a lot of visitors, you will end up with a server that is not able to handle all request anymore and will end up in quite a bigger loss of visitors. Requests will take longer and longer, after a while requests will time out and later your server will not accept any request at all anymore. Again: this is only on high traffic websites that have enough visitors during the time the page is being generated. But how big are the chances that if you, have let's say, 100 visitors a day, exactly one of those 100 visitors is visiting the exact page that you just edited. I think that chance is pretty small, or their might be something wrong with your code.
So the choice is up to you: do you want to lose maybe one or two visitors, or will you risk the server to crash and lose even more vistors? When your server crashes, or your server is busy handling all those requests, all pages will most likely be slow. And not only that one page. So my advice is still: do not disable this message when you care about the uptime of your server.
Fix the real problem!
Most of the times people come to me asking about why they get the message "This page is being generated" we came to the conclusion that the page takes (too) long to load in uncached version. I have seen pages taking over 30 seconds to render. The chance of getting the message increases with the time that the page takes to be processed.
When you take a look at those specific situations, quite often this is due to unoptimized code. Of course you sometimes have a page with a plugin that needs to do heavy work like calculating a lot of things. But most often it is just a human mistake.
If your page is taking a couple of seconds to load in uncached version, you really might want to take a look at it because often this is a mistake. Though this blog post is not about finding out these problems, you really might want to have a look with a profiler tool on that page. You can use tools like Blackfire for this. Make sure your page is as fast as possible when it is uncached. If your page loads in 1 second, the chances are pretty small a visitor will get the message "Page is being generated". So again, don't disable the message, fix your real problem!
Some people ask me but what about Google. Will this cause lower rankings for this page? "Google can't see the content neither when the see the message". Well, we don't have to be afraid for that. When TYPO3 will send the message "Page is being generated" to the browser of the visitor, it will also send the HTTP status code 503 Service Unavailable to the browser or search engine. This HTTP status code tells that the page is currently in maintenance and together with a header when the visitor can come back (30 seconds), it will make sure that search engines are informed about this temporarily unavailable page. More information about handling all kinds of site maintenance, can also be found on the blog of my friends of Yoast.
So again, no reason to hide this message!
But I really want to disable it!
Again: you are warned but if you are really at the point of ignoring all this, or you have a valid reason, there is an option to never show the message "This page is being generated". You can use the extension skip_page_is_being_generated. This extension will work on TYPO3 CMS version 7 and 8.
If you only want to do some more explanation to your visitor, you might want to use the TypoScript configuration option message_page_is_being_generated. You can alter the message that is shown with this option.
So, don't hide this message, fix the problem!
So I think you get my opinion about this "Page is being generated" message. Don't hide this message, fix the real problem. And if you have optimized as much as you can, take your loss on those small amount of visitors you will lose. You will lose a lot more visitors when your server crashes!