1

We are facing a performance issue when we are using Microsoft Azure App service with Symfony app (a basic back-office app, calling a WS, writing some data in DB and send it to the front app).

To validate that issue is not code relative, we tried on local and on Microsoft Azure oncloud Virtual Machine with same ACU. It's mandatory for us to use App service because of our customer policy

Summary

  • Performances on local are good

  • Performances on VM are good

  • Performances on app service are bad

  • metrics don't show hardware issue

  • performance seems to be relative to disk performance and latency when using PHP command (see below symfony specific command)

  • writing on the disk is 1000 times slower on App service VS VM/local

  • when we launch command using bin/console, it takes 8 seconds VS less than 1 for VM/local

How we test performance ?

When we are accessing to the front app, performances are bad, we have high latency.

we checked symfony _profiler, dd command and symfony specific command

dd command

on app service

root@09b68d228779:/home/site# dd if=/dev/zero of=/home/site/wwwroot/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 21.9822 s, 48.8 MB/s
 
root@09b68d228779:/home/site# dd if=/dev/zero of=/home/site/wwwroot/test1.img bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB, 500 KiB) copied, 31.7151 s, 16.1 kB/s

on Azure VM

user@app:~$ dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 10.1442 s, 106 MB/s
user@app:~$ dd if=/dev/zero of=/tmp/test1.img bs=512 count=1000 oflag=dsync
1000+0 records in
1000+0 records out
512000 bytes (512 kB, 500 KiB) copied, 9.1723 s, 55.8 kB/s

symfony specific command

on local

[INFO] Starting benchmark                                                                                               
------------------------------ ----------  
 Title                          Duration   
------------------------------ ----------  
 Write inside of project dir    0.3 ms     
 Write outside of project dir   0.8 ms     
 Factorials calculation         5.4 ms     
------------------------------ ----------  
mardi 29 mars 2022, 16:36:59 (UTC+0200)

on app service

Tue Mar 29 14:34:19 UTC 2022
 [INFO] Starting benchmark                                                                                              
------------------------------ ---------- 
  Title                          Duration  
 ------------------------------ ---------- 
  Write inside of project dir    558.5 ms  
  Write outside of project dir   2.4 ms    
  Factorials calculation         8.1 ms    
 ------------------------------ ---------- 
Tue Mar 29 14:34:27 UTC 2022

on Azure VM

Tue Mar 29 14:34:09 UTC 2022
[INFO] Starting benchmark
------------------------------ ----------
  Title                          Duration
------------------------------ ----------
  Write inside of project dir    0.4 ms
  Write outside of project dir   0.6 ms
  Factorials calculation         7.2 ms
------------------------------ ----------
Tue Mar 29 14:34:09 UTC 2022

what we've tried

  • scale up app service to P3v2 (840ACU, 14GB of memory)
  • scale out app service to 3 instances
  • mount external disk on the app service (we can only use CIFS)
  • contact Microsoft Azure Support (after a lot of mail, Symfony is not supported by Support)

Software

  • Symfony 5.4.8
  • we are using following packages :
 "require": {
    "php": ">=7.4",
    "ext-ctype": "*",
    "ext-curl": "*",
    "ext-iconv": "*",
    "ext-json": "*",
    "ext-openssl": "*",
    "beberlei/doctrineextensions": "^1.3",
    "composer/package-versions-deprecated": "1.11.99.2",
    "doctrine/annotations": "^1.0",
    "doctrine/doctrine-bundle": "^2.4",
    "doctrine/doctrine-migrations-bundle": "^3.1",
    "doctrine/orm": "^2.9",
    "michaeldegroot/doctrine-encrypt-bundle": "^4.0",
    "nelmio/cors-bundle": "^2.1",
    "phpdocumentor/reflection-docblock": "^5.2",
    "phpoffice/phpspreadsheet": "^1.19",
    "sensio/framework-extra-bundle": "^6.1",
    "symfony/apache-pack": "^1.0",
    "symfony/asset": "5.3.*",
    "symfony/console": "5.3.*",
    "symfony/dotenv": "5.3.*",
    "symfony/expression-language": "5.3.*",
    "symfony/flex": "^1.3.1",
    "symfony/form": "5.3.*",
    "symfony/framework-bundle": "5.3.*",
    "symfony/http-client": "5.3.*",
    "symfony/intl": "5.3.*",
    "symfony/mailer": "5.3.*",
    "symfony/mime": "5.3.*",
    "symfony/monolog-bundle": "^3.1",
    "symfony/notifier": "5.3.*",
    "symfony/process": "5.3.*",
    "symfony/property-access": "5.3.*",
    "symfony/property-info": "5.3.*",
    "symfony/proxy-manager-bridge": "5.3.*",
    "symfony/runtime": "5.3.*",
    "symfony/security-bundle": "5.3.*",
    "symfony/serializer": "5.3.*",
    "symfony/string": "5.3.*",
    "symfony/translation": "5.3.*",
    "symfony/twig-bundle": "^5.3",
    "symfony/validator": "5.3.*",
    "symfony/web-link": "5.3.*",
    "symfony/yaml": "5.3.*",
    "talan/pattern-matching": "^1.1",
    "twig/extra-bundle": "^2.12|^3.0",
    "twig/twig": "^2.12|^3.0"
  },
  "require-dev": {
    "doctrine/doctrine-fixtures-bundle": "^3.4",
    "fzaninotto/faker": "^1.9",
    "phpunit/phpunit": "^9.5",
    "symfony/browser-kit": "^5.3",
    "symfony/css-selector": "^5.3",
    "symfony/debug-bundle": "^5.3",
    "symfony/maker-bundle": "^1.0",
    "symfony/phpunit-bridge": "^5.3",
    "symfony/stopwatch": "^5.3",
    "symfony/var-dumper": "^5.3",
    "symfony/web-profiler-bundle": "^5.3"
  },

Linux Web App Service (P1v2: 1)

  • Runtime stack : PHP7.4
  • Operation System : Linux
  • deployment using code
  • Region : France Central
  • Production type
  • Size : P1v2: 1 (210 ACU, 3.5GB of memory)
4
  • I would suggest you to use a profiling tool such as blackfire to see where your time goes May 23, 2022 at 8:47
  • I don't know azure but it look like your latencies can be related to network (network mounted symfony dir) ? May 23, 2022 at 8:51
  • The project directory that you write to is part of the App Service? Can you check what is described in the File system storage blade of the App Service Plan? Depending on the SKU the throughput is limited....
    – Charlie V
    May 23, 2022 at 13:44
  • Hey Simon, were you able to resolve the issue? We're currently also facing major performance issues with the WebApp/Symfony-Stack on Azure...
    – red_clover
    Jul 7, 2022 at 15:48

1 Answer 1

1

What happens here is part of the App service infrastructure and as you mention you have a high dependency on the disk.

App services use a file share and mount it as a network drive which adds latency to I/O requests, this is to increase reliability, but usually when dealing with App service and high amounts of disk operations it is going to be slower than when using a VM or local machine.

Additional to that you are most likely using a standard HDD for the file share (there is no way to choose), I would recommend trying with BYOS (Bring Your Own Storage) and a premium storage account to use SSD Storage account overview - Azure Storage | Microsoft Docs

If that doesn't work, a container instance could be the closest thing to a VM without leaving PaaS

Your Answer

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.