I just setup my Codebuild pipeline for PHP Symfony2 testing by phpunit.
Situation :
Some of our tests talk to a local Database (classic mysql-server)
Codebuild use our Custom Docker image that is based on php:5.6-apache
OS : Linux Alpine
PHP VERSION : 5.6
We execute these steps :
php app/console doctrine:schema:update --force
php app/console broadway:event-store:schema:init
On local environment (Docker with 6GB RAM Allow) everything is okey.
The whole process takes like 15 Minutes... perfect.
Problem :
When i launch the build on the same image on AWS-CodeBuild this is very much longer :
php app/console doctrine:schema:update --force
(14 min)php app/console broadway:event-store:schema:init
(Instant)Hypothesis :
It seems like all php process that access to the DB is super slow.
Classic MySQL requests have a 'normal' speed...
If someone got an idea ?
Thanks for your help
@Rops42
You can speed up subsequent builds by using local caching. This is a good option for large intermediate build artifacts because the cache is immediately available on the build host. Local caching increases build performance for: Projects with a large, monolithic source code repository.
For Image, choose aws/codebuild/standard:4.0. Because you use this build project to build a Docker image, select Privileged. By default, Docker containers do not allow access to any devices. Privileged mode grants a build project's Docker container access to all devices.
Currently you cannot run as a non-root user in CodeBuild, I have passed it to the team for further review. Your feedback is very much appreciated. Is this still the case? There's now a checkbox in the console...
PDFRSS. You can save time when your project builds by using a cache. A cache can store reusable pieces of your build environment and use them across multiple builds. Your build project can use one of two types of caching: Amazon S3 or local.
I recommend you first to confirm your hypothesis - since it could be the most likely issue - by enabling MySQL logs (Error Log, General Log, and Slow Queries Log) in your build process and analyze them during or after the build.
If you don't find anything relevant that explains the slowness in those log files, you could use something like Blackfire to profile the code in CodeBuild, and you will find what is precisely slowing down the execution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With