composer: Composer very slow to read & write cache files

When I run

composer update --profile --vvv

I get the following output: https://gist.github.com/tnorthcutt/770ba18a3f3f182354d85b7c80a91fe1

The dependency resolution itself is very fast, and (in this case) no packages are installed, updated, or removed (because I previously ran composer update). However, reading and writing the cache files seems extremely slow.

Is there something I can do to speed this up, or to further debug?

My composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "laravel/cashier": "~7.0",
        "laravel/spark": "*@dev",
        "yab/laracogs": "^1.9",
        "hashids/hashids": "^1.0",
        "barryvdh/laravel-cors": "^0.8.0",
        "barryvdh/laravel-debugbar": "^2.2",
        "barryvdh/laravel-ide-helper": "^2.1",
        "doctrine/dbal": "^2.5",
        "spatie/laravel-collection-macros": "^1.4",
        "league/csv": "^8.1",
        "guzzlehttp/guzzle": "^6.2"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "phpmd/phpmd": "@stable",
        "spatie/laravel-migrate-fresh": "^1.3"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "repositories": [
        {
            "type": "path",
            "url": "./spark"
        }
    ]
}

Output of composer diagnose:

Checking composer.json: WARNING
require.laravel/spark : unbound version constraints (*@dev) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 49 (19 by maintainers)

Most upvoted comments

This problem still exists for me, and none of the issues raised in this issue, does not resolve my problem.

same problem in docker arquitecture (php container 1GB ram and 4 cores)

restarted pc and rebuild docker image now

[330.7MB/6.22s] Memory usage: 330.71MB (peak: 383.52MB), time: 6.22s

so maybe you were right

Slowness for me on docker

composer require zendframework/zend-inputfilter -vvv --profile

[7.7MB/0.00s] Loading composer repositories with package information
[7.9MB/0.01s] Downloading https://repo.packagist.org/packages.json
[7.9MB/0.20s] Writing /root/.composer/cache/repo/https---repo.packagist.org/packages.json into cache
[8.0MB/0.21s] Updating dependencies (including require-dev)
[8.1MB/0.21s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2013.json from cache
[12.1MB/1.01s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2014.json from cache
[20.3MB/4.37s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2015.json from cache
[33.3MB/12.09s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2016.json from cache
[52.6MB/25.94s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2017.json from cache
[69.9MB/35.49s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2017-10.json from cache
[76.4MB/40.08s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-01.json from cache
[91.4MB/47.77s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-04.json from cache
[102.3MB/56.47s] Downloading http://repo.packagist.org/p/provider-2018-07%24bd48a4a312894b4b8c944cab441fe479f3ce547c949cf6e4c22546ff6a399f90.json
[119.5MB/62.95s] Writing /root/.composer/cache/repo/https---repo.packagist.org/p-provider-2018-07.json into cache
[115.8MB/63.43s] Reading /root/.composer/cache/repo/https---repo.packagist.org/p-provider-archived.json from cache
[115.6MB/63.70s] Downloading http://repo.packagist.org/p/provider-latest%2486b0f858d808d6a10b6f375c1e3842bfce12a7b84ca118737c1bf77bbcd42d4f.json
[122.7MB/65.42s] Writing /root/.composer/cache/repo/https---repo.packagist.org/p-provider-latest.json into cache
.....
[448.1MB/271.58s] Memory usage: 448.11MB (peak: 498.2MB), time: 271.58s

also I am not sure how much memory composer should eat but 500MB sounds too mutch to install one dependancy.

kernel host problem probably…

For me it’s always very slow, I tried to search everywhere without much success. I can’t pinpoint what’s the culprit, the download is most of the time slow, but sometimes it doesn’t seem to be any network activity or CPU for that matters and composer just stays there.

It’s normally slow, today is super super slow… maybe it’s a temporary thing.

-v hangs on Writing /Users/ariel/.composer/cache/repo/https---packagist.org/packages.json into cache but that mustn’t take that long.

I am running 1.4.2 and PHP 7.0.18, no container, OSX 10.12.5, SSD drive, FileVault enabled. Any help here?

@tnorthcutt I see you’re using Loading plugin Hirak\Prestissimo\Plugin in there, can you profile the same without the plugin? Also can you tell us what IP your DNS resolves packagist.org to and where you’re located?