[REST] making list-upgrades faster
| From: | Tias | Date: | Mon, 26 Mar 2007 22:24:46 +0000 |
| Subject: | [REST] making list-upgrades faster | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-46043@lists.php.net to get a copy of this message | ||
Hello,
This is a proposition for a new XML file for the REST server, which can
speed up the 'list-upgrades' command significantly.
First off, I like REST: It's a conceptually simple idea and it works
great. The only current disavdvantage is that some PEAR commands need to
open a lot of different XML-files, which makes it slow.
Let's investigate the 'list-upgrades' command, which shows if there is
an upgrade available for a package you have installed. In
REST/10.php::listLatestUpgrades()
p/packages.xml is fetched (~10k)
for every package you have installed:
r/<package>/allreleases.xml is fetched (~1k)
r/<package/<state>.xml is fetched (poss. cached) (~5B)
done
A minimal amount of data is downloaded, _but_ the amount of files opened
grows with the amount of packages installed.
If you have 4 packages installed (everybody has) you download up to 9
files each time(~14k). If you have 15 packages installed, you download
up to 31 files each time(~25k) !
I will presume you know the cost of opening/closing connections and
files, it is significant, and certainly in todays broadband times.
The listLatestUpgrades() command uses only the package names, and the
different states with its latest version of these packages. For one
server, this information could be gathered in one file, eg.
latestpackages.xml
<!-- example xml file with packages and latest version info -->
<!-- full descriptive names used for clarity -->
<channel>pear.php.net</channel>
<package>
<name>Example_Tias</name>
<latest>
<row><state>stable</state><version>1.3.2</version></row>
<row><state>beta</state><version>1.4.0a2</version></row>
</latest>
</package>
<package>
...
This file would contain for every package its name, and every 'highest'
state which has a different version number. The latest is needed for
state-friendly package management: only the highest state and its
version are shown, if a lower state has a higher version than that one,
it is shown too.
This file would be at most 3 times as big as the current allpackages.xml
file (thus ~30k), yet listLatestUpgrades() would only need 1 file to
download: a significant speedup.
If there are any questions, do ask.
Greetings,
Tias
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc