following on from here, now that d.o. has memcached, and the most recent forum posts block has been identified as a mysql-killer, perhaps we should put that block into memcached with a 90 second (or something similar) expiry time?

CommentFileSizeAuthor
#3 forum.memcached.patch1.38 KBAnonymous (not verified)

Comments

Anonymous’s picture

from the "Improvements to the Drupal.org infrastructure" page:

Installed memcached, an in-memory object caching server, with Drupal's memcache API and integration module.

how is d.o. configured re. the memcache module?

i'm up to step 9. in the installation of the memcached module:

9. Edit settings.php to include either memcache.inc or memcache.db.inc. For
example, $conf['cache_inc'] ='sites/all/modules/memcache/memcache.db.inc';

and i'm wondering if i should use memcache.inc or memcache.db.inc so i have as close as possible to d.o.?

Anonymous’s picture

eeep.

node_title_list expects a db resource, not an array of nodes, so this patch will have to do one of:

- not use node_title_list, and generate the list via a copy of the functionality of node_title_list
- change node_title_list to work with either and array of node objects or a db resource

the first option is hacky, but keeps changes out of node.module, the second is possibly cleaner, but means changing node.module.

suggestions?

Anonymous’s picture

StatusFileSize
new1.38 KB

or, just cache the html, which is what i do in the attached patch against DRUPAL-5-2 - not sure if that matches what's running on d.o.

this patch assumes that the Drupal memcache module is installed.

Anonymous’s picture

Status: Active » Needs review
moshe weitzman’s picture

Status: Needs review » Needs work

you should add a check to see if any node access module is active. if yes, do per user caching, or none at all. here is the code:


if (count(module_implements('node_access_records'))) {
  // per user cache (like old D5 menu system)
}
else {
  // one global cache
}


pwolanin’s picture

for now, how about a custom PHP block (or theme function) that caches the result for the desired time - no need to even hack core...

moshe weitzman’s picture

you should add a check to see if any node access module is active. if yes, do per user caching, or none at all. here is the code:


if (count(module_implements('node_access_records'))) {
  // per user cache (like old D5 menu system)
}
else {
  // one global cache
}


kbahey’s picture

@justinrandell, just FYI, caching is a general Drupal API, not memcache specific.

So if you use cache_set() and cache_get(), it should work with the database cache, memcached, and flat file cache.

Just do a cache_set on the HTML of the final block, and retrieve it the same way.

If you look at the affiliates module, it does exactly that http://drupal.org/project/affiliates.

The permissions thing that moshe mentioned does not apply to Drupal.org, since we don't have private forums or private forum posts, but it is a good thing to have as a general feature for the forum module.

Another option is the block cache module too http://drupal.org/project/blockcache.

dries’s picture

That patch looks OK for drupal.org. It's not something that could be committed to CVS HEAD as is, but it should work in the drupal.org use case. We don't use any node access modules on drupal.org so no need to worry aboutt hat.

For CVS HEAD, Gerhard proposed a more generic solution: http://drupal.org/node/80951 ... as we will upgrade drupal.org to CVS HEAD before the final Drupal 6 release, it might be worth putting some time and effort into issue #80951.

In other words: this patch should get the job done (short term solution), but let's focus on polishing #80951 (medium + long term solution).

Anonymous’s picture

That patch looks OK for drupal.org. It's not something that could be committed to CVS HEAD as is, but it should work in the drupal.org use case. We don't use any node access modules on drupal.org so no need to worry aboutt that.

is there anything else i need to change re. this patch for the short term fix for drupal.org?

In other words: this patch should get the job done (short term solution), but let's focus on polishing #80951 (medium + long term solution).

will take a look at this on the weekend.

Anonymous’s picture

Status: Needs work » Closed (fixed)

Project: Drupal.org infrastructure » Drupal.org customizations
Component: Drupal.org module » Miscellaneous