0

I have test instance of Prestashop in AWS on EC2 t3.small (2 x vCPUs, 2GB memory) running Ubuntu with Apache2 + PHP 7.4 + MySQL 5.7.

I have cloned exactly the same setup to Azure App Service with PHP 7.4 (B1 1 vCP, 1.74GB memory) and MySQL Flexible Server 5.7 (Burstable 1 x vCore, 2 GB memory, 640 IOPS). MySQL is accessible via public network. Both AAS and MySQL are on the same region.

Both setups have the same configuration, AWS hosted Prestashop takes on average 2-3 seconds to load any page.The one in Azure takes around 1 minute and 30 seconds to load any page.

Metrics show none of the resources: CPU, memory, IOPS reaching 100% of usage.

I upgraded both Azue App Service to Premium (P1V2) and MySQL to Business Critical Tier (Standard_E2ds 2 vCores, 16 GiB, 5000 iops) and the results are the same.

Prestashop debug mode shows huge amount of time spent on querying.

enter image description here

I also connected to both AWS and Azure MySQL directly and executed the same query.

On average AWS is 3 times faster than Azure one (100ms vs 310ms).

One approach I haven't tried is to set MySQL on VNET, but would that improve the performance at all?

Maybe there is something I'm missing in the setup or maybe MySQL performance in Azure is questionable. I have seen other posts stating that running MySQL in Azure VM gives better performance than using managed one which would be crazy.

Artur Kedzior
  • 3,994
  • 1
  • 36
  • 58
  • Sounds like you have a slow query on that page. Find it (optionally using the "slowlog"), then let's discuss how to speed it up. – Rick James Sep 30 '22 at 16:26
  • @RickJames I can't change those queries because they are made by Prestashop or modules installed so even if find which one is the slow one it won't matter. Also I think queries are not a problem, it is the fact that Azure does something different to AWS for this setup. – Artur Kedzior Sep 30 '22 at 16:50
  • Condolences. Frameworks are great for toy projects or proof-of-concept. Alas, they rarely scale well. – Rick James Sep 30 '22 at 16:53
  • Still, if you can find the slow query, we may be able to add an `INDEX` that will help. (But I do need to see the query!) – Rick James Sep 30 '22 at 16:54
  • @RickJames thanks haha. Well right now prod has beefed machine but I wanted to migrate it to Azure and auto scale horizontally. I run the slowest query on both environments using EXPLAIN and they give the same results. I'm thinking this is might be something to do with networking. Going to try this: https://stackoverflow.com/questions/68315745/migration-from-aws-ec2-mysql-db-to-a-azure-mysql-database-resulted-in-a-very-poo – Artur Kedzior Sep 30 '22 at 16:59
  • How long does `SELECT 1` take? That is a way to measure the network lag. The US is about 80ms 'wide'. If your web page is doing 100 queries, then that distance would equate to 8 seconds. (Then the solution is to avoid so many queries on the page. Or find a closer cloud.) – Rick James Sep 30 '22 at 17:09
  • Additional DB information request, please. One set from AWS and a set from Azure, please. Try to run similar workload on each server, please. Any SSD or NVME devices on MySQL Host server? Post TEXT data on justpaste.it and share the links. From your SSH login root, Text results of: A) SELECT COUNT(*) FROM information_schema.tables; B) SHOW GLOBAL STATUS; after minimum 2 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; not SHOW STATUS, just STATUS; G) SHOW ENGINE INNODB STATUS; for server comparison analysis to look for cause of Azure delay. – Wilson Hauck Oct 06 '22 at 17:52
  • @RickJames just getting back to this. Both MySQL and App Service is in East US region. `SELECT 1` takes 125ms. Unfortunately I don't control how many queries it sends as it runs the most famous open source e-commerce solution of the planet. – Artur Kedzior Nov 06 '22 at 20:17
  • 1
    @ArturKędzior - Complain to the provider; 125ms might get you all the way to Alaska. – Rick James Nov 06 '22 at 22:57

0 Answers0