AWS codebuild containers are very very slow

I just installed the Codebuild pipeline for testing PHP Symfony2 on phpunit.


Situation:
Some of our tests speak with a local database (classic mysql server)

Codebuild uses our custom Docker image based on php:5.6-apache
OS : Linux Alpine PHP VERSION : 5.6

We perform the following steps:

  • Extract sources
  • Database setup (all inactivity).
  • Composer Installation ( 5 minutes )
  • php app/console doctrine:schema:update --force
  • php app/console broadway:event-store:schema:init
  • Run phpUnit.

In the local environment (Docker with a resolution of 6 GB of RAM), it is still okey.
The whole process takes like 15 minutes ... perfect.


Problem:

When I run assembly on the same image in AWS-CodeBuild , this is a lot more:

  • Extract Sources ( Instant )
  • Database Setup ( Instant )
  • Composer Installation ( 5 minutes )
  • php app/console doctrine:schema:update --force ( 14 minutes )
  • php app/console broadway:event-store:schema:init ( Instant )
  • phpUnit ( Infinity CodeBuild Timeout)

Hypothesis:
It seems that the whole php process provides access to the database very slowly.
Classic MySQL queries have a "normal" speed ...

If someone got an idea?
thank you for your help
@ Rops42

+5
source share
1 answer

I recommend that you first confirm your hypothesis - as this may be the most likely problem - by including the MySQL logs (error log, general log and slow query log) during the build process and analyze them during or after the build.

If you find nothing that explains the slowness in these log files, you can use something like Blackfire to profile code in CodeBuild, and you will find something that definitely slows down execution.

0
source

Source: https://habr.com/ru/post/1272346/


All Articles