-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable delay between each Auto-Cache Engine connection #294
Comments
Agreed. This would be a great addition. |
@ronnieg303 writes from #303...
|
Marking this a bug after receiving the report in #303. |
@ronnieg303 #306 specifically refers to the Auto-Cache Engine timeout, which is what this (#294) issue seeks to address. Therefore, #306 is a duplicate. Please re-read this issue's description:
|
I actually did read that. But I believe that the earlier description is actually confusing the issue. Increasing or adding a delay between requests does not help or change the fact that any one request can still time out if it does not receive the page content to be cached within 5000ms. Therefore, the suggestion that increasing or adding a delay between requests would reduce the timeouts being logged is erroneous. There are actually two separate timings at play, not one: 1) time to execute a page request and get the results to cache, and 2) a timing delay between requests, which is a server resource / loading issue. |
@ronnieg303 Apologies for the confusion. When I created this issue (#294) the research I conducted led me to discover that WordPress itself has a way of changing the timeout length (for which the default is 5000ms), so while that information was in my head, it was not actually anywhere in this issue. The timeout that you're seeing and referring to by "1) time to execute a page request and get the results to cache" is coming from the WordPress HTTP API, which Quick Cache (being a WordPress plugin) uses. (See the WordPress HTTP API on the Codex for more details.) Here's the relevant section related to changing the default timeout:
With that, you can change the default timeout to something longer, such as 15 seconds (15000ms), by adding the following code to your theme's add_action( 'http_request_timeout', '__custom_http_timeout_extension' );
function __custom_http_timeout_extension( ) {
return 15;
} Changing this value is really not something that Quick Cache should touch and rather is something that should be done by a site owner on a per-site basis, as such changes would be very dependent on the server environment and configuration (maximum values set in PHP, etc.). |
I think we are actually getting to the same page then. re: "Changing this value is really not something that Quick Cache should touch and rather is something that should be done by a site owner on a per-site basis, as such changes would be very dependent on the server environment and configuration (maximum values set in PHP, etc.)." This is in fact exactly what my issue #306 proposes that QC be able to do if a site owner so requests: override that default http timeout, and only for QC page requests, because the site owner already knows that some pages may take longer to render and are generating timeouts in the auto-cache log. In fact, WP does not time out all http requests at 5000ms, because if it did, many pages on my site would never render in that time and would be failing left and right, and that doesn't happen. So that timeout appears to be applied only to internally initialed http requests, like those QC does. When a site's pages take more than 5 seconds to load, that is exactly why caching plugins like QC are needed. |
Right. And as I see it, this is something that a site owner should configure on a per-site basis, outside of Quick Cache itself. But let me bring @jaswsinc into the mix here and get his thoughts on this. @jaswsinc what do you think? Add an Auto-Cache Engine option to extend the WordPress HTTP API timeout, an option that would only apply to requests being made by the Auto-Cache Engine? |
Please keep in mind that a typical WP site owner is not going to have a clue about how to manage or change this, and even if they did, their hosting service may or may not support even allowing them to do it. If it's anything more complex than adding a line to wp-config.php, most users are going to freak out. |
As I see it, a stream timeout is not necessary for the ACE (Auto-Cache Engine). Ordinarily, I would agree that a stream timeout should be configurable. However, in this particular case we are dealing with non-blocking (i.e. asynchronous) connections over HTTP, and PHP's In the
The connection timeout is Note: as Raam mentioned, there is a filter in WP where the default can be altered, but The second timeout is not an issue. Why?The ACE uses a non-blocking HTTP connection. When the HTTP request is made, once the connection succeeds the ACE immediately disconnects from the socket. On the other end (where QC is running and waiting for the page to be rendered so it can get cached), we detect that a connection was opened by the ACE, and in this case we call upon So what does that mean? It means the ACE does not need to wait for the page to be rendered at all, it just takes however long it takes. The ACE disconnects long before this is done, and that's OK. The process was spawned and will do it's thing, all by itself. The ACE just started the process :-) |
Good explanation. After reading this, it is likely all of the timeouts I was seeing in the log were probably caused by the original server overloading issue that caused it to crash. The server just stopped responding so all http connection requests because it was down. But that begs the question: Why didn't ACE recognize that there was a major server issue and suspend processing? It just kept hammering the server until I managed to kill it by renaming the plugin folder and renaming wp-cron.php so nothing could be scheduled. |
Exactly, and that's the issue here. Thanks! The ACE is not smart enough to deal with this yet. Fortunately, we are :-) We just need to teach our little QC robot this trick now. haha As it exists now, it just keeps hammering you. On a large site, this is causing issues because there are enough pages to place a burden on the processor. My advice, if your site is quite large, please disable the ACE for now, until the next release can address this concern. |
@jaswsinc Thanks so much for submitting a PR for this. This issue has been closed by PR #311 and this new Auto-Cache Engine option will go out with the next release. |
Next release changelog:
|
The Auto-Cache Engine currently goes as fast as it can, making many requests to URLs when pre-caching a site. It would be nice if there was a way for a site owner to specify a delay between each request (in milliseconds, using
usleep()
) so that if upon inspection of the Auto-Cache Engine log they see many request timeouts, the site owner can try increasing the amount of time between each request.@jaswsinc writes...
Note also that the Auto-Cache Engine currently runs on 15-minute intervals, caching as many URLs as it can within those 15 minutes. If all of the URLs are not cached, the remaining URLs will be cached during the next run, with any already-cached URLs ignored from being re-cached, unless they need to be.
If the delay between each Auto-Cache Engine request is considerably long and the number of URLs to cache considerably high, you need to consider that it may take the Auto-Cache Engine many iterations to cache the entire site. For this reason, there should be a warning displayed to the site owner if they try to set the delay to anything more than a few seconds.
See also, related feature request for user-configurable schedule for Auto-Cache Engine: #293
The text was updated successfully, but these errors were encountered: