One thread can put server load from 0.1 to 0.5? That's one hell of a thread And yes, caching the page will affect the views.Today I had a thread that was very popular that illustrates what happens when the cache kicks in. I posted it, and immediate traffic started to steadily climb, with the graph below representing around 10,000 guests looking at the page. CPU load steadily climbed until the second page was reached, then the cache kicked in, and it dropped back to much more manageable levels, even though there was no let-up in the growth
View attachment 66138
So:
- Well done, the cache worked great!
- It would have been great to have the option to switch on caching threads with one page I actually made some posts just to kick it over onto the next page.
It was an unusually popular thread. However my forum gets these spikes every few weeks, and my goal here is to prevent slowdown or outages during those spikes. Your add-in is great for that, so long as the thread has more than a page.One thread can put server load from 0.1 to 0.5? That's one hell of a thread And yes, caching the page will affect the views.
I will see what I can do.It was an unusually popular thread. However my forum gets these spikes every few weeks, and my goal here is to prevent slowdown or outages during those spikes. Your add-in is great for that, so long as the thread has more than a page.
View count is not a huge deal, but would certainly be greatly appreciated, as otherwise the view counts become meaningless. Maybe an option, as it's a bit of a speed trade-off?
Not, if you are using something like Google AdSense.Dumb Question: Does this affect ad-impressions as well?
Dumb Question: Does this affect ad-impressions as well?
Not for me, ads just fineNot, if you are using something like Google AdSense.
You can set TTL to 0.How to disable some pages being cache?
Like forum_list to prevent this problem: http://xenforo.com/community/threads/google-integration-not-working-on-index-homepage-view.67606/
But then guest caching is disabled (and this is most of what this add-on does.)You can set TTL to 0.
He only needs to disable caching for forum_list, that page is rather fast by itself. CSS to file does a lot too btw.But then guest caching is disabled (and this is most of what this add-on does.)
So if you set TTL to 0 on a specific page, it would make only this page to be 0?He only needs to disable caching for forum_list, that page is rather fast by itself. CSS to file does a lot too btw.
Of course. The TTL is for individual page.So if you set TTL to 0 on a specific page, it would make only this page to be 0?
Thanks Mike for the input. I will add new code to work specifically with Google+ then.There is now a CSRF token generated attached to sessions so it can be used for guests. It's (only) used for Google+ logins (as per their integration documentation). If you're caching pages, the CSRF token wouldn't be correct for each user.
It won't be page specific; it will potentially happen whenever a cached page is served.
$request = $fc->getRequest();
$uri = $request->getRequestUri();
// $ uri will be something like:
// "/threads/debunked-fukashima-radiation-reaches-west-coast.2898/"
// So we explode it into an array of parts
$parts = explode('/', $uri);
// only want to handle /threads/
if ($parts[1] == 'threads')
{
// split into . delimited strings
$num = (explode('.',$parts[2]));
// we want the last one, as the name might contains dots, so can't take the second
$tnum = end($num);
// make sure it's a positive integer
$threadId = intval($tnum);
if ($threadId > 0)
{
// and log that view
$threadModel = XenForo_Model::create('XenForo_Model_Thread');
$threadModel->logThreadView($threadId);
}
}
The new version has an option to keep thread view for cached pageI've created a patch to fix the thread view counts not being updated
In bdCache/Core.php at the start of the output function (around line 148 currently), add:
PHP:$request = $fc->getRequest(); $uri = $request->getRequestUri(); // $ uri will be something like: // "/threads/debunked-fukashima-radiation-reaches-west-coast.2898/" // So we explode it into an array of parts $parts = explode('/', $uri); // only want to handle /threads/ if ($parts[1] == 'threads') { // split into . delimited strings $num = (explode('.',$parts[2])); // we want the last one, as the name might contains dots, so can't take the second $tnum = end($num); // make sure it's a positive integer $threadId = intval($tnum); if ($threadId > 0) { // and log that view $threadModel = XenForo_Model::create('XenForo_Model_Thread'); $threadModel->logThreadView($threadId); } }
I don't think this will make much difference to performance, as logThreadView just is a quick insert into the view log (the actual counting is done via cron).
It's parsing the URI to get the threadId. I'm not sure if there's a case where a thread view would not have the format "/threads/some-thread-name.1234/", but buyer beware.
We use essential cookies to make this site work, and optional cookies to enhance your experience.