Connection timeout error message on Cloud Sites
When serving content from your Cloud Sites, you may occasionally receive the "Connection timed out - please try again" error. We're here to shed a little light on this issue, and tell you about the steps we have taken to mitigate the problem, and steps that customers can take to improve their experience.
What Does It Mean?
"Connection timed out – please try again" is an error message that is received as a result of a script exceeding the maximum timeout value. If a client connection does not receive a response from the server after approximately thirty seconds, the load balancer will close the connection and the client will immediately receive the error message. In most cases, the script will continue to execute until it reaches completion, throws an error, or times out on the server; but the client will not see the page load as expected and will instead receive the "connection timed out..." error.
Why It Happens
- “Connection timed out – please try again” can be a difficult issue to troubleshoot, especially across all customer use cases. If you are seeing timeouts intermittently, it is recommended that you audit your code as intermittent timeouts are often indicative of code that may need to be optimized and/or broken down into smaller pieces. For instance, if the code is inserting several records into a database, try inserting a few records at a time and then sending back a response to the client’s browser.
- For a longer running script in PHP, the 'exec' function can be used to run the script in the background and write its status to a database or a file. Then you could use AJAX to display a loading bar and check the script's status. Once completed, you can then remove the loading bar and proceed to a completion page. (This is just an example, but the concept is good for any situation.) Another option is to run the script as a cron job using PHP or Perl instead of HTTP, which circumvents the load balancer's timeout.
- Another common cause of this error is when a site is trying to load files that don't exist (404 errors). This dramatically slows a site down and in rare cases can cause a timeout. More commonly, a site that is loading data from an external location will see load issues causing a timeout. For instance, if a site relies on Google Analytics, Authorize.net, or PayPal and for some reason these corresponding services go down or begin responding slowly, the site will see a performance hit that in some cases can cause the page not to load or to load intermittently. (Keep in mind that all sorts of plugins for content management systems like Wordpress and Joomla use third-party services behind the scenes, such as bit.ly and Twitter.)
- It’s also a possibility that the script simply uses a heavy amount of resources. If this is a PHP site, you may need to increase the memory limit to something more appropriate for your site. For more information, you can read our Knowledge Center article on Changing the PHP Memory Limit Value.
- If you’re not familiar with using an .htaccess file, you may take a look at these resources for using the .htaccess file.
- In extremely rare cases, you may see this error message due to an invalid cookie being stored by your browser. This will cause you to see the error message on pages that initiate a session on your site (such as login or member pages--or sometimes even your homepage). Although rare, it's a good idea to clear your browser cache and try the page again to verify that this is not the case.
The Bottom Line
The bottom line is that data must be sent back to the client's browser to keep the connection alive. So regardless of what sort of processing a page is doing, it must return data frequently or the load balancer will assume the connection has been dropped and will forcefully terminate it. Put simply, there will be some limitations of the shared architecture of Cloud Sites that will not allow us to resolve all issues for all customers.
What Rackspace Is Doing About It
- We've updated and made improvements to the Linux kernel for speed and stability.
- We have simplified and upgraded our caching infrastructure to move it closer to the edge node.
- We've increased the PHP memory allocation to improve performance.
- We've enabled compiling and caching of PHP scripts to speed up performance.
- We have moved PHP session state storage to a faster, dedicated system.
- We've implemented safe guards to prevent long running queries on MySQL from impacting multiple customers.
- And finally, we've implemented safe guards on PHP processes to prevent them from impacting multiple customers.
Here at Rackspace we are committed to constantly improving our infrastructure and products in order to bring you the best possible customer experience. To learn how to get more out of Cloud Sites, please consult our Getting Started Guide for Cloud Sites in the Knowledge Center!
© 2015 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
See license specifics and DISCLAIMER