Simon
Simon

Reputation: 23

Performance issue on Microsoft Azure App services using Symfony

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

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

Software

 "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)

Upvotes: 2

Views: 1217

Answers (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

Upvotes: 1

Related Questions