Skip to content

Investigate caching strategies #118

Description

@PatStLouis

Explore Caching Strategies for Performance Optimization

Context

The DID WebVH Server handles high-frequency DID resolution requests and database queries. Implementing caching will improve response times and reduce database load.

Current Pain Points

  • DID resolution endpoints are frequently accessed
  • Database queries for policies and registries on every request
  • No caching layer currently implemented
  • Potential performance bottlenecks as traffic scales

Caching Options to Explore

Option 1: Redis Cache (Distributed)

Best for: Multi-instance deployments, horizontal scaling

  • ✅ Shared cache across instances
  • ✅ Fast in-memory performance
  • ✅ Supports TTL and complex invalidation
  • ❌ Requires Redis infrastructure
  • ❌ Additional operational overhead

Use Cases:

  • DID document resolution
  • Policy/registry lookups
  • Cross-instance cache sharing

Option 2: In-Memory Cache

Best for: Single-instance deployments, development

  • ✅ No external dependencies
  • ✅ Fastest access (no network)
  • ✅ Simple implementation
  • ❌ Not shared across instances
  • ❌ Limited by server memory

Use Cases:

  • Development/testing
  • Single-instance deployments
  • Hot data caching

Option 3: HTTP Response Caching

Best for: Public endpoints, static content

  • ✅ Reduces server load entirely
  • ✅ Leverages browser/CDN caches
  • ❌ Only for GET requests
  • ❌ Less control over invalidation

Use Cases:

  • Public DID resolution
  • Explorer UI assets
  • Static content

Cache Invalidation Strategies

  • TTL-based: Automatic expiration (simplest)
  • Write-through: Update cache on writes (consistent)
  • Pattern invalidation: Delete related keys on updates
  • Version-based keys: Natural invalidation via version numbers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions