Laravel Application Response Time Slow on Kubernetes (EKS) vs. Baremetal

11/1/2019

I am in the process of migrating our Laravel application to EKS Kubernetes which is currently running on Docker however the response time is significantly slower.

The current response time is roughly (Docker): 350-450 ms
The new response time is roughly (Kubernetes): 750-1100 ms

Notable Environment Differences:

  • Source code is mounted as a volume in the Docker environment vs. Kubernetes environment has the source code baked into the image (with PVC's for the storage folder)
  • Docker environment is running on a bare metal server vs. Kubernetes is on AWS's EKS

APM Findings:

I am running DataDog which shows that a lot of time is being spent on Laravel, rather than DB or Redis which doesn't give me much to work with.

enter image description here

At this point, I am thinking it is infrastructure related rather than an issue with Laravel as the Docker environment already preforms (decently).

I am running this as an init container (which occurs every deployment or pod restart):

php artisan opcache:clear
php artisan route:cache
php artisan config:clear
php artisan config:cache
php artisan view:clear
php artisan view:cache
php artisan opcache:compile --force
php artisan migrate --force
php artisan db:new_seed
php artisan queue:restart

I am unsure where to start troubleshooting. Any advice will be helpful.

-- leeman24
docker
kubernetes
laravel
laravel-5
php

0 Answers