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
Add a option to install and update command to controll whether loads provider listings #4269
Comments
|
In packagist's case, the provider listings help cache things because then composer knows if the hash of a file didn't change it doesn't have to redownload it, if we didn't have the listings it would mean every package you require has to be downloaded (indeed like in toran proxy). That said with the growing amount of packages maybe we need to revisit this and use a process like toran.. It needs to be investigated whether it'd be faster or slower on average. It's hard to know because with the current packagist model, if you run update twice in a row, the second one will most likely not download much since it has everything in cache. If we had parallel (like with the react PR or similar) downloads then it might be better to always hit packagist for every package and rely on e-tags or something to save bandwidth. Right now though that is not possible. |
|
From my view of source, this mechanism doesn't affect the cache of dist files. It affects the cache of providers data like |
|
@xjchengo I hope you can try this, I added an experimental flag now so you can enable lazy mode for packagist, I would love to get feedback from you on how well it works. You will need to run First it would be great if you could run: To enable it, run Then you can again run For me the 4 runs look like this: So it doesn't seem like a big win for me to enable this, but I do have a good connection to packagist so I am curious to see how it goes for people with other connection quality. |
|
@Seldaek These results were gotten when I connected to a vpn with best overseas communication link quality from my country. |
|
I tried in Japan. repository = laravel/laravel |
|
looks like the lazy way does not improve things but actually makes them slower |
|
@xjchengo @hirak can you two please try it again but this time the lazy mode use (note .com and not .org): You need the latest composer phar again so self-update. The .com uses cloudflare and has long term edge caching enabled which for now will cause delays when packages get updated, but if it seems to help I will migrate .org there too and add API calls to do cache busting at the cloudflare level when we update package metadata. This should make the if-modified-since requests a lot faster but there is still the overhead of creating an ssl connection every time so I'm not expecting extremely low numbers. Also curious to see what numbers you get on the regular non-lazy repo using the .com URL (just remove force-lazy-providers to try it). |
|
@Seldaek 👍 In my environment, I think Fast: Slow:
|
|
Regarding if modified since, this is handled purely by cloudlfare on
/p/package/name.json urls, as I enabled long edge cache on those. The
initial /packages.json is always revalidated though so it's not the best
file to test with.
Anyway glad to see cloudlfare helps already. I'll try to move forward with
that then I think, for the if modified since approach we will need more
changes to make it viable but that's for later then. Thanks for testing.
|
|
@Seldaek If-Non-Match and weak Etag are supported by cloudflare. It's worth a try. |
|
The problem is it seems it doesn't help enough as is.. Using e-tags or last modified date is the same, it's about the amount of requests and the time they take to get bootstrapped. I think once we have persistent curl connections then we can switch to the lazy mode and do If-Modified-Since, but this will of course have to be checked. |
|
@Seldaek Sorry, you are right. Did you change any settings for packagist.com? |
|
I didn't touch this in a while, but to be honest the CloudFlare approach isn't really feasible I think as their terms of services indicate it should only be used for web pages and they can shut us down without notice. I can't risk having our DNS provider shutting us down like that :/ I looked at other CDN providers though and there might be viable options but I check this further after summer holidays I think. Maybe even after introducing the curl-based parallel requests, as that would benefit already a lot and reduce the issue of latency. |
|
Fixed by composer 2 |
Most of time, the provider listings loading process needs a lot of time under my network.
Can we add a option to install and update command to indicate whether we need loads provider listings? In order to make this work, packagist needs to add
providers-lazy-urllike toran proxy does.The text was updated successfully, but these errors were encountered: