Laravel is so slow on Azure Web App for Linux

Viewed 917

I would like to know what is the best approch, to run laravel application on Azure Web App linux based.

I tried to test the same application in Linux and Windows Azure web app ( same azure app plan , same region and same connection speed "optical fibre" ) :

The perfomance in Windows looking much better than Linux

This is the screenshot in Linux App :

enter image description here

This is the screenshot in Windows App :

enter image description here

Can someone can help me to find the root case of slowness in Linux ? it's problem in Microsoft web app itself ?

Regards.

3 Answers

I think nginx is better option for performance optimization.Also make sure to follow Laravel deployment guide.

When deploying to production, make sure that you are optimizing Composer's class autoloader map so Composer can quickly find the proper file to load for a given class:

composer install --optimize-autoloader --no-dev

When deploying your application to production, you should make sure that you run the config:cache Artisan command during your deployment process:

php artisan config:cache

If you are building a large application with many routes, you should make sure that you are running the route:cache Artisan command during your deployment process:

php artisan route:cache

When deploying your application to production, you should make sure that you run the view:cache Artisan command during your deployment process:

php artisan view:cache

Also caching views which are not updating data on regular basis. There is a library called spatie/laravel-responsecache

https://github.com/spatie/laravel-responsecache

Ref:https://laravel.com/docs/8.x/deployment

Caching files in ngnx

Ref:NGINX cache static files

Ref:https://docs.nginx.com/nginx/admin-guide/content-cache/content-caching/

Please use following step:-

  1. run cache remove comments php artisan config:cache , php artisan route:cache , php artisan view:cache
  2. In you image Favicon.ico not lording. Solved this problem
  3. minify the all js and css

When deployed to built-in images, your code and content are allocated a storage volume for web content, backed by Azure Storage. The disk latency of this volume is higher and more variable than the latency of the container filesystem. Apps that require heavy read-only access to content files may benefit from the custom container option, which places files in the container filesystem instead of on the content volume.

Related