Jump to content

Intermittent large delays in the first byte when loading a site


Recommended Posts

I'm not sure since when, probably since a recent version, when loading my site I've noticed intermittent large server response delays for the first byte. The period of these delays requests is about 6 minutes, sometimes 10-12 minutes. With such a delay, I half-hear a server response after a second and a half, and sometimes, but less often, more than 10 seconds.
Typical first byte time for my site is in the 20-80 millisecond range.
I checked a lot of things but didn't find a solution.
I asked my host support for assistance, and they were able to record one such delaying request.
What's impressive - in one minute this request sent 268 requests to your server
https://www.invisioncommunity.com
There is probably a problem with your license server
Please check.
I'm attaching the strace.txt file that my host saved.

strace.zip

Link to comment
Share on other sites

13 minutes ago, Jim M said:

The trace there is not showing requests out to our website, it is showing snippets of the file being called. All our files have commented at the top our company name, URL, etc... 

Here is a line from that request

15:52:11 read(5, "<?php\n/**\n * @brief\t\tInitiates Invision Community constants, autoloader and exception handler\n * @author\t\t<a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>\n * @copyright\t(c) Invision Power Services, Inc.\n * @license\t\thttps://www.invisioncommunity.com/legal/standards/\n * @package\t\tInvision Community\n * @since\t\t18 Feb 2013\n */\n\nnamespace IPS;\n\n/**\n * Class to contain Invision Community autoloader and exception handler\n */\nclass IPS\n{\t\n\t/**\n\t * @brief\tClasses that have hooks on\n\t */\n\tpublic static $hooks = array();\n\n\t/**\n\t * @brief\tLoaded Hooks\n\t */\n\tpublic static $loadedHooks = array();\n\t\n\t/**\n\t * @brief\tUnique key for this suite (used in http requests to defy browser caching)\n\t */\n\tpublic static $suiteUniqueKey = NULL;\n\t\n\t/**\n\t * @brief\tDeveloper Code to be added to all namespaces\n\t */\n\tprivate static $inDevCode = '';\n\t\n\t/**\n\t * @brief\tNamespaces developer code has been imported to\n\t */\n\tprivate static $inDevCodeImportedTo = array();\n\t\n\t/**\n\t * @brief\tVendors to use PSR-0 autoloader for\n\t */\n\tpublic static $PSR0Namespaces = array();\n\t\n\t/**\n\t * @brief\tCommunity in the Cloud configuration\n\t */\n\tpublic static $cicConfig = array();\n\t\n\t/**\n\t * @brief\tIPS Applications\n\t */\n\tpublic static $ipsApps = array(\n\t\t'blog',\n\t\t'calendar',\n\t\t'cloud',\n\t\t'cms',\n\t\t'core',\n\t\t'downloads',\n\t\t'forums',\n\t\t'gallery',\n\t\t'nexus',\n\t\t'convert'\n\t\t);\n\n\t/**\n\t * Get default constants\n\t *\n\t * @return\tarray\n\t */\n\tpublic static function defaultConstants()\n\t{\n\t\t$storeMethod = 'FileSystem';\n\t\t$storeConfig = '{\"path\":\"{root}/datastore\"}';\n\t\t$cacheMethod = 'None';\n\t\t$cacheConfig = '{}';\n\t\t$redisConfig = NULL;\n\t\t$redisEnabled = FALSE;\n\t\t$outputCache = 'Database';\n\t\t$outputCacheConfig = NULL;\n\t\t$guestTimeout = 900;\n\n\t\tif ( isset( self::$cicConfig['guests']['guest_cache_timeout'] ) and self::$cicConfig['guests']['guest_cache_timeout'] and \\is_numeric( self::$cicConfig['guests']['guest_cache_timeout'] ) )\n\t\t{\n\t\t\t$guestTimeout = \\intval( self::$cicConfig['guests']['guest_cache_timeout'] );\n\t\t}\n\n\t\tif ( isset( self::$cicConfig['redis"..., 58552) = 58552
15:52:11 close(5)                       = 0

 

Link to comment
Share on other sites

8 minutes ago, Adlago said:

Here is a line from that request

15:52:11 read(5, "<?php\n/**\n * @brief\t\tInitiates Invision Community constants, autoloader and exception handler\n * @author\t\t<a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>\n * @copyright\t(c) Invision Power Services, Inc.\n * @license\t\thttps://www.invisioncommunity.com/legal/standards/\n * @package\t\tInvision Community\n * @since\t\t18 Feb 2013\n */\n\nnamespace IPS;\n\n/**\n * Class to contain Invision Community autoloader and exception handler\n */\nclass IPS\n{\t\n\t/**\n\t * @brief\tClasses that have hooks on\n\t */\n\tpublic static $hooks = array();\n\n\t/**\n\t * @brief\tLoaded Hooks\n\t */\n\tpublic static $loadedHooks = array();\n\t\n\t/**\n\t * @brief\tUnique key for this suite (used in http requests to defy browser caching)\n\t */\n\tpublic static $suiteUniqueKey = NULL;\n\t\n\t/**\n\t * @brief\tDeveloper Code to be added to all namespaces\n\t */\n\tprivate static $inDevCode = '';\n\t\n\t/**\n\t * @brief\tNamespaces developer code has been imported to\n\t */\n\tprivate static $inDevCodeImportedTo = array();\n\t\n\t/**\n\t * @brief\tVendors to use PSR-0 autoloader for\n\t */\n\tpublic static $PSR0Namespaces = array();\n\t\n\t/**\n\t * @brief\tCommunity in the Cloud configuration\n\t */\n\tpublic static $cicConfig = array();\n\t\n\t/**\n\t * @brief\tIPS Applications\n\t */\n\tpublic static $ipsApps = array(\n\t\t'blog',\n\t\t'calendar',\n\t\t'cloud',\n\t\t'cms',\n\t\t'core',\n\t\t'downloads',\n\t\t'forums',\n\t\t'gallery',\n\t\t'nexus',\n\t\t'convert'\n\t\t);\n\n\t/**\n\t * Get default constants\n\t *\n\t * @return\tarray\n\t */\n\tpublic static function defaultConstants()\n\t{\n\t\t$storeMethod = 'FileSystem';\n\t\t$storeConfig = '{\"path\":\"{root}/datastore\"}';\n\t\t$cacheMethod = 'None';\n\t\t$cacheConfig = '{}';\n\t\t$redisConfig = NULL;\n\t\t$redisEnabled = FALSE;\n\t\t$outputCache = 'Database';\n\t\t$outputCacheConfig = NULL;\n\t\t$guestTimeout = 900;\n\n\t\tif ( isset( self::$cicConfig['guests']['guest_cache_timeout'] ) and self::$cicConfig['guests']['guest_cache_timeout'] and \\is_numeric( self::$cicConfig['guests']['guest_cache_timeout'] ) )\n\t\t{\n\t\t\t$guestTimeout = \\intval( self::$cicConfig['guests']['guest_cache_timeout'] );\n\t\t}\n\n\t\tif ( isset( self::$cicConfig['redis"..., 58552) = 58552
15:52:11 close(5)                       = 0

 

That is commented out line as given in Nathan's example. You can open that file it is referencing and see it exactly.

Link to comment
Share on other sites

3 hours ago, Dll said:

I'm pretty sure that if you rewrite all the CSS you'll resolve this.

Too curious a suggestion... And how does css affect the first byte? I look forward to your discovery.

@Charles

Please explain to me:
Why with my configuration - apache main server and nginx cache server, redis on refresh creates a spike of one second delay in first byte, at different interval - sometimes every 6-7 minutes, sometimes every 10-12 minutes?
Stopped redis - switched to file storage data - same bad storage handling - peak after peak every 6.7 or 10 minutes. (I noticed a match with entries in the datastore directory)
I've given up on that too, switched to mysql data storage - at least it only creates such a spike every 15 minutes or so...
Please explain - why is there no option in ACP to select a refresh time, with each of these methods?
My cache server refreshes every 30 minutes ie. what should I do (besides rebuilding the css as you advise...Ha Ha) to sync cache refresh?

Edited by Adlago
Link to comment
Share on other sites

  • Management

I honestly have no idea why your server is behaving so oddly. You have several layers of cache methods going on there and a fairly complicated setup. You might want to consider simplifying your setup. You have a successful community but it's not SO active that it even needs things like Redis and the like. It's a case of when you spend so much time making a complicated, multi-layer setup and obsessing about every little millisecond of load time that you end up making the problem worse. Kind of like adding too many spices to your cooking.

Sometimes less is more 🙂 

Or... cloud 😉 

Link to comment
Share on other sites

4 minutes ago, Charles said:

I honestly have no idea why your server is behaving so oddly. You have several layers of cache methods going on there and a fairly complicated setup. You might want to consider simplifying your setup. You have a successful community but it's not SO active that it even needs things like Redis and the like. It's a case of when you spend so much time making a complicated, multi-layer setup and obsessing about every little millisecond of load time that you end up making the problem worse. Kind of like adding too many spices to your cooking.

Sometimes less is more

You are wrong - I tested all of this without any changes to your build - no difference in the offset of those first byte peaks.
With my improvements at least in the time left between two peaks of the first byte, my site is well accelerated.

PS. In fact, these first byte spikes exist on your site as well. Here now after about 10 minutes of tests - this is what I got (in the rest of the time I get your first byte in 30 - 50 milliseconds)

Could contain: Text

Link to comment
Share on other sites

23 minutes ago, Charles said:

I'm not sure what to tell you. In your test there you are not logged in so probably hitting Cloudfront cached page. In that case it's not even touching our servers and something like Cloudfront is optimized in ways none of us can duplicate.

Is this Apache server not yours?

Could contain: File, Text

Link to comment
Share on other sites

For IPS hosted sites (including this one), users not logged in will get a cached version of the page if it's available.  And yes, the server reports as Apache.

Could contain: Page, Text

If you notice in the screenshot above, the server is reported "Apache" where the request itself has a cache status of "Hit" served from Cloudfront's cache.  This means the request never made it back to IPS's EC2 instances.  

Edited by Randy Calvert
Link to comment
Share on other sites

  • 1 month later...

Unfortunately, there is no answer that helped me.
I ditched the nginx cache server, and now only use apache. I changed the cache sidebar to 1 hour, and for now the momentary spike lag issue is gone.
There is probably more issues cache processing - but if I find something else I will write... I have a feeling that every newer version worsens cache processing... I hope I'm wrong...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...