The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

See Cache: audit and review the caching in Meza #111

The following was AI generated and should be marked as verified after review

Semantic MediaWiki Additional Caching Mechanisms edit

Semantic MediaWiki (SMW) adds several specialized caching layers beyond standard MediaWiki caching.

SMW-Specific Cache Types edit

Query Result Cache edit

  • Purpose: Caches results of #ask queries and concept queries
  • Configuration: $smwgQueryResultCacheType and $smwgQueryResultCacheLifetime
  • Default: Uses MediaWiki's main cache (CACHE_ANYTHING)
  • Storage: Separate from page cache, stores semantic query results

Property Table Cache edit

  • Purpose: Caches the mapping of properties to their database tables
  • Key Variable: $smwgPropertiesCache
  • Impact: Affects how SMW resolves which table contains property values
  • Invalidation: Triggered on property type changes or new properties

Concept Cache edit

  • Purpose: Pre-computed query results for [[Category:Concepts]]
  • Configuration: $smwgAutoRefreshSubject controls auto-refresh
  • Mechanism: Runs concept queries in background, stores results
  • Manual Refresh: php maintenance/SMW_refreshData.php -page "Concept:Name"

Dependency Cache edit

  • Purpose: Tracks dependencies between pages with semantic data
  • Function: Ensures pages using #ask queries update when source data changes
  • Integration: Works with MediaWiki's LinksUpdate system
  • Performance: Can cause cascading updates on heavily-queried wikis

Statistical Cache edit

  • Purpose: Caches statistics about semantic data (property usage counts, etc.)
  • Location: Special:Statistics and Special:Properties pages
  • Configuration: $smwgStatisticsCache and $smwgStatisticsRefreshInterval

Serializer Cache edit

  • Purpose: Caches serialized semantic data objects (DIWikiPage, DIProperty)
  • Type: Object-level caching for frequently accessed semantic entities
  • Benefit: Reduces database queries for property metadata

Key Differences from Standard MediaWiki Caching edit

Aspect MediaWiki Semantic MediaWiki
Parser Cache Caches rendered HTML Also stores embedded query metadata
Link Tables Simple page-to-page links Complex property-value relationships
Cache Invalidation On page edit On edit + when queried data changes
Database Load Primarily page text + semantic property tables (20+ tables)

Configuration in Meza Context edit

In /opt/conf-meza/public/<env>/LocalSettings.php or extension configs:

// Query result caching
$smwgQueryResultCacheType = CACHE_MEMCACHED; // or CACHE_REDIS
$smwgQueryResultCacheLifetime = 3600; // seconds

// Enable query dependency tracking
$smwgEnabledQueryDependencyLinksStore = true;

// Concept cache refresh
$smwgAutoRefreshSubject = true; // Auto-refresh concepts on edit

Performance Implications edit

High-Impact Scenarios edit

  1. Inline Queries: Pages with many {{#ask:}} queries benefit most from query cache
  2. Concepts: Pre-cached concepts avoid expensive runtime queries
  3. Property Pages: Heavily accessed properties (like [[Has type::Page]]) benefit from property cache

Cache Warming Strategies edit

# Rebuild semantic data cache
php maintenance/SMW_refreshData.php -d 50 -v

# Refresh specific namespace
php maintenance/SMW_refreshData.php -page "Property:*" -v

# Force rebuild with full delete
php maintenance/SMW_refreshData.php -d 50 -v -f

Debugging SMW Cache Issues edit

# Check SMW cache status
php maintenance/SMW_debugCaches.php

# Clear SMW query cache
php maintenance/SMW_clearQueryCache.php

# View cache backend
grep smwgQueryResultCacheType /opt/conf-meza/public/<env>/LocalSettings.php

Integration with Meza's Caching edit

Meza's MediaWiki role configures:

  • Memcached/Redis: Backend for $smwgQueryResultCacheType
  • Parser Cache: Shared cache for rendered pages with SMW queries
  • Database Query Cache: MySQL query cache affects property table reads

The mediawiki role in Meza handles SMW cache configuration through templates in src/roles/mediawiki/templates/, particularly in the extension-specific configuration files.

See Also edit

Local content edit