I have installed Boost on my site and it is working well, however it doens't seem to be clearing old content. A CTRL+F5 refresh needs to be performed on a page to get the latest page.
All our edits are done on a staging site which then gets synced across to the live site every hour. After the sync is performed, cron is run, but this doesn't seem to remove the old content.
What I have noticed in the watchdog are messages like
Crawler Start http://default/boost-crawler?nocache=1&key=f8d07b9a9009987bffcccfb134f4e865
Where is it getting the name "default" from? Should this not be my site name?
Any hints or tips on this would be greatly appreciated. I'm sure I'm missing something obvious but I can't figure out what.
Comments
Comment #1
mikeytown2 commenteddefault comes from
global $base_url;. Whats that setting in your settings.php file?Also enable etags to the recommended setting on the boost config page. That should take care of the F5 issues (I hope).
Comment #2
millaraj commentedDiscovered that Drupal wasn't picking up the name of the site so I've set $base_url in settings.php. Crawler now seems to be running, but still not picking up fresh edits.
What I should have said in my initial run down was that our live URL is actually attached to a proxy server that proxies requests through to our Drupal server. We have it set like this so we can map other sites located on the proxy server into the same URL. What I'm wondering is whether because the cache is being created under the Drupal server name (which is different from our live URL) whether this is causing it not to pick up the edits?
I've set the ETAG options, so I'll see whether that improves things.
Thanks again for the response, much appreciated.
Comment #3
mikeytown2 commentedMy guess is this would cause issues. Can I get more info about how the 2 URLs vary? is it just the host or more? If it's just the host.
Couple of things to try
UNcheck "Do not store the cache file path in the database" - Save and go back to that same place. Below you can change the directory that the cache gets written to.
"Overwrite the cached file if it already exits" - you probably want to enable this.
Comment #4
millaraj commentedOur public URL is of the form
www.sub.domain.com
This takes requests, and proxies them through to our drupal server which lives at
drupal.sub.domain.com
drupal.sub.domain.com is our staging server where all the edits take place.
On our staging site, should I cahnge the directory where the cache gets written to to
cache/normal/www.sub.domain.com
Comment #5
millaraj commentedJust some further info on how the sync takes place. We have a cron job that is set to run every hour which utilises the drush command 'rsync' and 'sql-sync'. The cron job then remotely runs the cron job on the live server to kick off the crawler.
Comment #6
millaraj commentedI've tried unchecking "Do not store the cache file path in the database" and instead forcing both our staging and live server to use the same directory for the cache. I've also updated the Rewrite rules to reflect this as follow.
Both sites are now creating caches in the correct directory, and Boost is definitely working as I can see the boost tags at the bottom of the source in each page. However it still doesn't seem to be expiring content.
What effect would the above changes have on the crawler? Does it know which files to expire given that Boost is now using the same directory and not creating a new one per domain?
Hitting the site directly or via the proxy doesn't seem to get the page regenerated until a CTRL+F5 is used.
Comment #7
millaraj commentedAnother pondering...
When I'm doing the sql-sync from the staging to live server, I'm copying all the boost tables. So the tables are being populated with URLs that are pointing to my staging server and not the live server. I have updated the drush aliases to exclude these tables and they are now being populated solely by the live site.
Comment #8
millaraj commentedHere's a question. How does Boost know that content has changed? When a node is updated, is there a flag generated anywhere for boost to say it's out of date? Or do we just have to wait for the page to expire before it is crawled?
Comment #9
mikeytown2 commentedIt all depends on your setup. At work we have a crawler on another server that checks the boost_cache table every 30 seconds and crawls those URLs. If your wondering when a node is updated the expire column gets reset to zero, which means crawl this url. You can configure boost to flush the page from the cache on node save or to mark it as expired.
Comment #10
millaraj commentedThat would make sense. So because I'm not copying across boost_cache, it's not expiring content when the node is updated. Maybe need to create a small script to do that manually...
Comment #11
millaraj commentedJust did a test on our staging server and the "expire" column got set to 434966400 when the node was changed.
Comment #12
mikeytown2 commentedyep that's my birthday; it's back in 83 so that will get re-crawled.
Comment #13
millaraj commentedHmmm, so I presume running cron does something to this expire timestamp? After running cron, the node is correctly listed as 0 for the expire column in boost_cache.
Comment #14
mikeytown2 commentedIf it's zero that means it has been flushed from the system. The built in crawler can be setup to recrawl the site on cron. Long story short it's a little messy but it can be setup. The crawler needs a major overhaul.
Settings for recrawling the site & never having a page not cached (unless it's a new node):
Expire content in DB, do not flush file. - Enabled
Overwrite the cached file if it already exits - Enabled
Enable the cron crawler - Enabled
Do not flush expired content on cron run, instead recrawl and overwrite it. - Enabled
Preemptive Cache HTML - Enabled
Preemptive Cache XML - Enabled
Preemptive Cache AJAX/JSON - Enabled
Crawl All URL's in the url_alias table - Enabled
Comment #15
millaraj commentedI'm seeing content in boost_cache that has a timestamp that is less than the current time, so I'm presuming this should get picked up on the next cron run and refreshed. However this is not happening. The crawler is definitely running as I can see other URLs being populated to boost_crawler.
Am I misunderstanding the logic here?
Comment #16
millaraj commentedThe logic is, as I understand it...
Crawler is kicked off
Checks to see if the site has been changed
- It does this by going through the different tables and getting back the most recent timestamp
- Once it has retrieved these values it compares it to boost_max_timestamp in the 'variables' table
- If it matches, then the site hasn't been changed and false is returned.
- If it doesn't match, then true is returned.
Expires content by setting 'expire' to 0.
Comment #17
jumoke commentedJoining ;)
Comment #18
jumoke commentedWhat if i want the new cache to be generated whether the content was changed or not. I have an "upcoming events" block at the bottom of my site and even tho the content is not changed, this block needs to be show the correct data so i want the page to always clear on cron run and recrawl. Whats the setting for this?
Comment #19
mikeytown2 commentedfor blocks use ajax
http://drupal.org/project/ajaxblocks
http://drupal.org/project/ajaxify_regions
Comment #20
jumoke commentedThank you sweet mikey..you rock! :)
Comment #21
jumoke commentedI noticed others have asked and haven't gotten an answer, can the crawler only work with the alias table? some of my pages that are not aliased are not getting crawled.
Comment #22
karlis commentedI've been having a similar problem using boost and the domain module. I thought it was domain module related, but now I'm not so sure. My problem seems to be related to the cache file entries in the boost_cache table having the expiry set to '0' which is done when you do a boost flush with boost_cache_clear_all_db().
There seems to be a problem with that, If you run cron to expire your files, it won't delete them because in
boost_cache_expire_all_db() where it only adds files to the list for deletion where expire BETWEEN 1 and BOOST_TIME, so those files with expiry = 0 will remain.
Weird that the expires date wasn't being set to something other than 0 when they are written after the flush, which is in boost_put_db(). They are now, but it seemed "stuck" for awhile, which I suppose could happen if the cached file exists but boost_cache shows the expiry as 0. In that case, you can try UPDATE boost_cache SET expire = 2 WHERE expire = '0'; (or substitute 2 for a more recent timestamp) and it should start working better. At least it did for me.
Comment #23
dirtabulous commentedWe ran into the same issue. Expired was being set to 0 and cache was not being removed or recreated. Setting expired to >=2 worked for us and the content was removed from cached and reindexed.