0

I have a test wordpress site in kubernetes on Azure using Azure Storage. It works, but VERY VERY slowly.

Here's the config:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: wordpress-volume
  namespace: cadlearning
  labels:
    type: slow
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  storageClassName: azurefilestorage
  azureFile:
    secretName: storage-secret
    shareName: wordpress
    readOnly: false
  mountOptions:
    - dir_mode=0777
    - file_mode=0777
    - uid=1000
    - gid=1000
    - mfsymlinks
    - nobrl

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wordpress-volume-claim
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: azurefilestorage
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wordpress-deployment
  namespace: cadlearning
  labels:
    app: wordpress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      containers:
        - image: wordpress:latest
          name: wordpress
          env:
            - name: WORDPRESS_DB_HOST
              value: mysql.database.azure.com
            - name: WORDPRESS_DB_NAME
              value: BetaWWW
            - name: WORDPRESS_DB_USER
              value: admin
            - name: WORDPRESS_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: wordpress-db
                  key: password
          ports:
            - containerPort: 80
              name: wordpress
          volumeMounts:
            - name: azurefileshare
              mountPath: "/var/www/html"
      volumes:
        - name: azurefileshare
          persistentVolumeClaim:
            claimName: wordpress-volume-claim

This is the sum of the configuration. But requests are brutally slow. And looking at the logs, (there's no errors), it is very slow to even receive the request and see anything in the logs.

I've followed this: https://ahenriksson.com/2020/01/27/how-to-set-up-wordpress-behind-a-reverse-proxy-when-using-nginx/ in the hopes that it was on the ingress that the problem lay without any success.

Once it starts responding everything loads very quickly. It's just that initial delay of about 9 seconds that kills it.

So I'm at a loss. How do I get wordpress on azure kubernetes to respond quickly?

2 Answers 2

1

I'm having same issue where my MongoDB volume is mounted to Azure Fileshare and it performs extremely slow (about 2-3 times slower), and easily makes my Pod's CPU usage get high and being throttled with just 2-3 requests. Before when deploying my project on an Ubuntu VM, volume is mounted to the VM disk itself, I didn't experience this bad performance.

I think not only us having this issue. Check here, seems like this is a long time ago problem with FileShare until now. Some folks in the link also tried FileShare Premium and it doesn't work.

Their solution is using azure Disk for such data that need better performance, high IO: like database.

Update: I have tested using Premium Azure Disk (managed-premium). The result is not much better as I expect.

Here's my experiment where I perform some requests on a MongoDB collection with ~70K records (each batch is a specific type of request):

| Environment + Storage class | Batch 1 | Batch 2 | Batch 3 |
|-----------------------------|---------|---------|---------|
| UbuntuVM + SSD (on same VM) | 36ms    | 741ms   | 3.29s   |
| K8S + azurefile             | 133ms   | 4.25s   | 10.39s  |
| K8S + managed-premium       | 46ms    | 2.73s   | 8.26s   |
| K8S + default               | 53ms    | 2.87s   | 7.82s   |

All of them are running inside container (Docker)

Environment is where I deploy my project and my DB is mounted to appropriate storage

0

There are a number of possible reasons you could experience low performance with your Azure file share. Ensure your storage account is in the same region as your cluster. Microsoft provides a troubleshooting guide with an exhaustive list. Depending on your wordpress site, it is possible you are exhausting the IOPS available for the file share. There are details on how to monitor throttling in the guide.

To troubleshoot whether the Azure file share is the bottle-neck, you can try using a persistent volume having a storage class of managed-premium instead. Alternatively, pull your wordpress content directly into the container by using wordpress:latest as the base image and see if performance improves.

2
  • So I'm already using wordpress:latest No version of Storage Account file share speeds it up, however if I instead use an Azure Disk it works full speed ahead. But then I don't have direct access to the files which is problematic for my people managing the site. I'm guessing that this is a problem with CIFS on linux with wordpress? Jun 28, 2020 at 20:09
  • You should check and see if you are getting throttled, increasing the size of the file share should increase the number of IOPS available. Please refer to this table which shows the relationship between fileshare size and performance for a premium file share: learn.microsoft.com/en-us/azure/storage/files/…. Otherwise, you could be getting throttled due to CIFS implementation on Linux - have you tried the nostrictsync mount option from the troubleshooting guide?
    – bpdohall
    Jun 29, 2020 at 12:49

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.