distribution/distribution

S3 work, cache not work

xdkaka opened this issue · 2 comments

Description

I'm using S3 for storage and have enabled Redis caching. However, each time the data is fetched directly from S3 and the cache is not being hit.
As a result, the number of requests to S3 has reached tens of thousands per minute.
I checked Redis and found some descriptive data. How can I optimize this? Thank you

Reproduce

  1. docker pull xxx
  2. docker pull xxx
  3. docker pull xxx

Expected behavior

Hit cache

registry version

registry:3.0.0-alpha.1

version: "3.2"

services:
  paya_registry_redis:
    image: "redis:7.2.4-alpine"
    ports:
      - "6379:6379"
    container_name: paya_registry_redis
    command: redis-server --requirepass xxx --appendonly yes
    volumes:
      - ./redis-data:/data
    environment:
      - REDIS_PASSWORD=xxx
    networks:
      - registry_network

  # docker-compose -f docker-compose.yml up -d
  registry:
    container_name: paya_registry
    image: registry:3.0.0-alpha.1
    ports:
      - "443:443"
    volumes:
      - ./registry-config:/etc/docker/registry
    restart: always
    depends_on:
      - paya_registry_redis
    networks:
      - registry_network
    deploy:
      resources:
        limits:
          cpus: "0.70"
          memory: 3.5G
        reservations:
          cpus: "0.2"
          memory: 500M
    logging:
      driver: json-file
      options:
        max-size: "500m"
        max-file: "3"

networks:
  registry_network:
    driver: bridge

Additional Info

config.yml

version: 0.1
log:
  accesslog:
    disabled: true
  level: debug
  formatter: text
  fields:
    service: registry
    environment: staging

redis:
  addr: paya_registry_redis:6379
  password: xxx
  db: 0
  expiry: 600 
    
storage:
  s3:
    accesskey: xxx
    secretkey: xxx
    region: ap-xxx
    bucket: xxx
    regionendpoint: xxx.com
    chunksize: 52428800 
    loglevel: debug
  delete:
    enabled: true
  cache:
    blobdescriptor: redis
    blobdescriptorsize: 10000

auth:
  htpasswd:
    realm: basic-realm
    path: /etc/docker/registry/auth/nginx.htpasswd

http:
  addr: :443
  host: https://docker-hub.paya.com
  headers:
    X-Content-Type-Options: [nosniff]
  http2:
    disabled: false
  tls:
    certificate: /etc/docker/registry/ssl/paya.com.pem
    key: /etc/docker/registry/ssl/paya.com.key
  secret: "xxx"

health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3

You might wanna remove passwords and API keys from the issue, though it might already be too late for that

You might wanna remove passwords and API keys from the issue, though it might already be too late for that

We only deploy on our company’s intranet, but thank you anyway.