Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does my WordPress site, which has very little traffic, consume a lot of MySQL memory? #1071

Open
wencan opened this issue Jun 22, 2024 · 0 comments

Comments

@wencan
Copy link

wencan commented Jun 22, 2024

I have two Wordpress sites. They use the same Docker stack configuration. One was created a few months earlier. Both sites have very little traffic.

However, the first MySQL container is taking up several hundred MB of memory, while the other MySQL container is using very little memory.

I tried to update the first MySQL container with the command "docker service update --force www_db", after which both MySQL containers would take up several hundred MB of memory.

I don't know what the difference is. I want both MySQL containers to consume minimal resources.

Server version: 8.3.0 MySQL Community Server - GPL

Client: Docker Engine - Community
 Version:    25.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.5
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 8
  Running: 3
  Paused: 0
  Stopped: 5
 Images: 4
 Server Version: 25.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: active
  NodeID: bnxvzg6bep0ax0ys8gde0uftu
  Is Manager: true
  ClusterID: oe31f263mi0gt6k30a5giq318
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 172.25.247.29
  Manager Addresses:
   172.25.247.29:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-17-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.685GiB
 Name: iZ7xv0ti5rsq0wd273mtn3Z
 ID: 692ab3e3-47ce-40c0-ae74-1af78e75a749
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

[
    {
        "ID": "ovao36vjulijoh1h6v6fs7ydv",
        "Version": {
            "Index": 409
        },
        "CreatedAt": "2024-02-01T03:57:07.320331609Z",
        "UpdatedAt": "2024-06-22T04:13:41.058043854Z",
        "Spec": {
            "Name": "www_db",
            "Labels": {
                "com.docker.stack.image": "mysql",
                "com.docker.stack.namespace": "www"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "mysql:latest@sha256:d7c20c5ba268c558f4fac62977f8c7125bde0630ff8946b08dde44135ef40df3",
                    "Labels": {
                        "com.docker.stack.namespace": "www"
                    },
                    "Env": [
                        "MYSQL_DATABASE=wordpress",
                        "MYSQL_PASSWORD=XXX",
                        "MYSQL_ROOT_PASSWORD=XXX",
                        "MYSQL_USER=my"
                    ],
                    "Privileges": {
                        "CredentialSpec": null,
                        "SELinuxContext": null,
                        "NoNewPrivileges": false
                    },
                    "Mounts": [
                        {
                            "Type": "volume",
                            "Source": "www_db_volumes",
                            "Target": "/var/lib/mysql",
                            "VolumeOptions": {
                                "Labels": {
                                    "com.docker.stack.namespace": "www"
                                }
                            }
                        }
                    ],
                    "StopGracePeriod": 10000000000,
                    "DNSConfig": {},
                    "Isolation": "default"
                },
                "Resources": {},
                "RestartPolicy": {
                    "Condition": "any",
                    "Delay": 5000000000,
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "unknown",
                            "OS": "unknown"
                        },
                        {
                            "Architecture": "arm64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "unknown",
                            "OS": "unknown"
                        }
                    ]
                },
                "Networks": [
                    {
                        "Target": "t22h7m0u94g3tz8p8xv61g5e8",
                        "Aliases": [
                            "db"
                        ]
                    }
                ],
                "ForceUpdate": 4,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "RollbackConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "EndpointSpec": {
                "Mode": "vip"
            }
        },
        "PreviousSpec": {
            "Name": "www_db",
            "Labels": {
                "com.docker.stack.image": "mysql",
                "com.docker.stack.namespace": "www"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "mysql:latest@sha256:d7c20c5ba268c558f4fac62977f8c7125bde0630ff8946b08dde44135ef40df3",
                    "Labels": {
                        "com.docker.stack.namespace": "www"
                    },
                    "Env": [
                        "MYSQL_DATABASE=wordpress",
                        "MYSQL_PASSWORD=XXX",
                        "MYSQL_ROOT_PASSWORD=XXX",
                        "MYSQL_USER=my"
                    ],
                    "Privileges": {
                        "CredentialSpec": null,
                        "SELinuxContext": null,
                        "NoNewPrivileges": false
                    },
                    "Mounts": [
                        {
                            "Type": "volume",
                            "Source": "www_db_volumes",
                            "Target": "/var/lib/mysql",
                            "VolumeOptions": {
                                "Labels": {
                                    "com.docker.stack.namespace": "www"
                                }
                            }
                        }
                    ],
                    "Isolation": "default"
                },
                "Resources": {},
                "Placement": {
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "unknown",
                            "OS": "unknown"
                        },
                        {
                            "Architecture": "arm64",
                            "OS": "linux"
                        },
                        {
                            "Architecture": "unknown",
                            "OS": "unknown"
                        }
                    ]
                },
                "Networks": [
                    {
                        "Target": "t22h7m0u94g3tz8p8xv61g5e8",
                        "Aliases": [
                            "db"
                        ]
                    }
                ],
                "ForceUpdate": 3,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "EndpointSpec": {
                "Mode": "vip"
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip"
            },
            "VirtualIPs": [
                {
                    "NetworkID": "t22h7m0u94g3tz8p8xv61g5e8",
                    "Addr": "10.0.1.5/24"
                }
            ]
        },
        "UpdateStatus": {
            "State": "completed",
            "StartedAt": "2024-06-22T04:13:30.891795561Z",
            "CompletedAt": "2024-06-22T04:13:41.058031727Z",
            "Message": "update completed"
        }
    }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant