Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer installation very slow with mpdf #9626

Closed
shyim opened this issue Jan 18, 2021 · 9 comments
Closed

Composer installation very slow with mpdf #9626

shyim opened this issue Jan 18, 2021 · 9 comments

Comments

@shyim
Copy link
Contributor

shyim commented Jan 18, 2021

Output of composer diagnose:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.0.8
PHP version: 8.0.1
PHP binary path: /usr/bin/php8.0
OpenSSL version: OpenSSL 1.1.1i  8 Dec 2020
cURL version: 7.64.0 libz 1.2.11 ssl OpenSSL/1.1.1i
zip: extension present, unzip present

When I run this command: composer req mpdf/mpdf

I get the following output:

Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.
Something's changed, looking at all rules again (pass #1)
Dependency resolution completed in 0.000 seconds
Analyzed 148 packages to resolve dependencies
Analyzed 228 rules to resolve dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
Installs: myclabs/deep-copy:1.10.2, paragonie/random_compat:v9.99.100, setasign/fpdi:v2.3.5, psr/log:1.1.3, mpdf/mpdf:v8.0.10
  - Locking mpdf/mpdf (v8.0.10)
  - Locking myclabs/deep-copy (1.10.2)
  - Locking paragonie/random_compat (v9.99.100)
  - Locking psr/log (1.1.3)
  - Locking setasign/fpdi (v2.3.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Reading ./composer.lock
Package operations: 5 installs, 0 updates, 0 removals
Installs: setasign/fpdi:v2.3.5, psr/log:1.1.3, paragonie/random_compat:v9.99.100, myclabs/deep-copy:1.10.2, mpdf/mpdf:v8.0.10
  - Downloading setasign/fpdi (v2.3.5)
Downloading https://api.github.com/repos/Setasign/FPDI/zipball/f2246c8669bd25834f5c264425eb0e250d7a9312
  - Downloading psr/log (1.1.3)
Downloading https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc
  - Downloading paragonie/random_compat (v9.99.100)
Downloading https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a
  - Downloading myclabs/deep-copy (1.10.2)
Downloading https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220
  - Downloading mpdf/mpdf (v8.0.10)
Downloading https://api.github.com/repos/mpdf/mpdf/zipball/1333a962cd2f7ae1a127b7534b7734b58179186f
[302] https://api.github.com/repos/Setasign/FPDI/zipball/f2246c8669bd25834f5c264425eb0e250d7a9312
Following redirect (1) https://codeload.github.com/Setasign/FPDI/legacy.zip/f2246c8669bd25834f5c264425eb0e250d7a9312
[302] https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc
Following redirect (1) https://codeload.github.com/php-fig/log/legacy.zip/0f73288fd15629204f9d42b7055f72dacbe811fc
[302] https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220
Following redirect (1) https://codeload.github.com/myclabs/DeepCopy/legacy.zip/776f831124e9c62e1a2c601ecc52e776d8bb7220
[302] https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a
Following redirect (1) https://codeload.github.com/paragonie/random_compat/legacy.zip/996434e5492cb4c3edcb9168db6fbb1359ef965a
[302] https://api.github.com/repos/mpdf/mpdf/zipball/1333a962cd2f7ae1a127b7534b7734b58179186f
Following redirect (1) https://codeload.github.com/mpdf/mpdf/legacy.zip/1333a962cd2f7ae1a127b7534b7734b58179186f
[200] https://codeload.github.com/php-fig/log/legacy.zip/0f73288fd15629204f9d42b7055f72dacbe811fc
Writing /home/shyim/.cache/composer/files/psr/log/eba32e017e823df412a2fcdb3e04b6766157b3ad.zip into cache from /tmp/bla/foo/vendor/composer/tmp-0289391cfda6e5b07cb3c466fe3b3a30
[200] https://codeload.github.com/myclabs/DeepCopy/legacy.zip/776f831124e9c62e1a2c601ecc52e776d8bb7220
Writing /home/shyim/.cache/composer/files/myclabs/deep-copy/6cd2033a8224fe330c425e4a15202a6d42643dfc.zip into cache from /tmp/bla/foo/vendor/composer/tmp-01ab0e0eca45727c4708fafb34413ad2
[200] https://codeload.github.com/paragonie/random_compat/legacy.zip/996434e5492cb4c3edcb9168db6fbb1359ef965a
Writing /home/shyim/.cache/composer/files/paragonie/random_compat/65bef60142798f103b09e948c03c9a652c469254.zip into cache from /tmp/bla/foo/vendor/composer/tmp-f218314c930ef9a635fcafa5b664aef5
[200] https://codeload.github.com/Setasign/FPDI/legacy.zip/f2246c8669bd25834f5c264425eb0e250d7a9312
Writing /home/shyim/.cache/composer/files/setasign/fpdi/90df7a124abc6c644307e81a67af7341928dbb45.zip into cache from /tmp/bla/foo/vendor/composer/tmp-8c30aa74bef00687e0aaf3433c156676
[200] https://codeload.github.com/mpdf/mpdf/legacy.zip/1333a962cd2f7ae1a127b7534b7734b58179186f
Writing /home/shyim/.cache/composer/files/mpdf/mpdf/98bb175b4e5da5f9ee0ce56e5b11cf145b62dde9.zip into cache from /tmp/bla/foo/vendor/composer/tmp-75bf102a267c102ad5f32a6a951560f6
  - Installing setasign/fpdi (v2.3.5): Extracting archive
Executing async command (CWD): unzip -qq  '/tmp/bla/foo/vendor/composer/tmp-8c30aa74bef00687e0aaf3433c156676' -d '/tmp/bla/foo/vendor/composer/73ded6ff'
  - Installing psr/log (1.1.3): Extracting archive
Executing async command (CWD): unzip -qq  '/tmp/bla/foo/vendor/composer/tmp-0289391cfda6e5b07cb3c466fe3b3a30' -d '/tmp/bla/foo/vendor/composer/88bcd602'
  - Installing paragonie/random_compat (v9.99.100): Extracting archive
Executing async command (CWD): unzip -qq  '/tmp/bla/foo/vendor/composer/tmp-f218314c930ef9a635fcafa5b664aef5' -d '/tmp/bla/foo/vendor/composer/f1fea911'
  - Installing myclabs/deep-copy (1.10.2): Extracting archive
Executing async command (CWD): unzip -qq  '/tmp/bla/foo/vendor/composer/tmp-01ab0e0eca45727c4708fafb34413ad2' -d '/tmp/bla/foo/vendor/composer/e59de5cb'
  - Installing mpdf/mpdf (v8.0.10): Extracting archive
Executing async command (CWD): unzip -qq  '/tmp/bla/foo/vendor/composer/tmp-75bf102a267c102ad5f32a6a951560f6' -d '/tmp/bla/foo/vendor/composer/73ae84ab'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/setasign/fpdi'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/composer/73ded6ff'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/psr/log'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/composer/88bcd602'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/paragonie/random_compat'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/composer/f1fea911'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/myclabs/deep-copy'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/composer/e59de5cb'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/mpdf/mpdf'
Executing command (CWD): rm -rf '/tmp/bla/foo/vendor/composer/73ae84ab'
Downloading https://packagist.org/downloads/
[201] https://packagist.org/downloads/
2 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
3 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

And I expected this to happen:

Install faster.

Version Time
Composer 1 14s
Composer 2 2m59s

Maybe a specific header which throttles the downloads? 🤔

@alvaro-octal
Copy link

Also on MPDF repo mpdf/mpdf#1362

@stof
Copy link
Contributor

stof commented Jan 21, 2021

@shyim what happens if your remove your vendor folder (but not the composer cache) and you run composer install again ? Do you still see such difference ?
This would help identifying whether the slowness comes from the downloading step or from the extraction step.

@tinect
Copy link

tinect commented Jan 21, 2021

@stof it's the download process. I'm caching the vendor folder in ci and it's fast.

@stof
Copy link
Contributor

stof commented Jan 21, 2021

@tinect if you are caching the vendor folder, you are caching the result of the full process, not only the download of the zip (the vendor folder does not contain the zip but the extracted content). so that does not allow identifying which of the 2 steps is slow.

@tinect
Copy link

tinect commented Jan 21, 2021

@stof damn. I should learn reading. Sorry for that.

@shyim
Copy link
Contributor Author

shyim commented Jan 21, 2021

Removed vendor only and installed again took 2s

rm -rf vendor
composer cc
composer install takes again years to complete :D

@stof
Copy link
Contributor

stof commented Jan 21, 2021

OK, so the download is indeed the part taking time.

the main difference I see here is that composer 2 uses curl while composer 1 uses PHP streams.
I tried the same using the latest snapshot instead of the 2.0.8 release, and it seems fast again. So I suspect that #9604 fixed this (and mdpf is more affected than other packages because of the size of the zip archive)

@shyim
Copy link
Contributor Author

shyim commented Jan 21, 2021

Seems to be fixed in the master. Need only 3s

@Seldaek
Copy link
Member

Seldaek commented Jan 26, 2021

Yup this is a duplicate of #9604 - will be in a release this week sometime.

@Seldaek Seldaek closed this as completed Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants