Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

How to reduce your download traffic by 75% or more

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
272 posts
  • Page 1 of 11
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 11
  • Next
Author
Message
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

How to reduce your download traffic by 75% or more

  • Quote

Post by blackpenguin » Fri Aug 27, 2004 7:59 pm

:D Announcement: dynamic deltup server goes public beta :D

Especially users on modem- or ISDN-dialin-lines or users who pay for the traffic-volume of their internet-connection will love this.

Some of you might remember deltup, a nice piece of software to reduce download-size, achieved by transfering the difference to the old version of an archive only. (Thanks to John Whitney, who brought deltup to us, and thanks to Joshua P. MacDonald who wrote the underlying xdelta)

Unfortunately deltup was removed from portage tree some weeks ago, since the number of available delta-files has been small and none of them were up-to-date anymore.

Now, situation has changed. I am happy to present you the "dynamic deltup server", and the getdelta.sh-downloadwrapper-script.

The dynamic-deltup-server holds many up-to-date delta-files (*.dtu) in cache and, that's the great news, it creates new dtu-files on demand.

Just curious how much traffic you can save with this update-method?
Have a look at these stats:
:arrow: http://linux01.gwdg.de/~nlissne/

This is how it works:
Just emerge deltup and install a small script written in bash as a download-wrapper in your /etc/make.conf using the FETCHCOMMAND variable.
Done. :)

When you emerge an update to your packages, the download-wrapper examines your DISTDIR if there is an old version of the source-archive and then asks the deltup-server to provide the dtu-file.

The server will either send back the requested dtu-file or it will put you on a waiting queue and starts to create the dtu-file for you (and others who might want the same file after you).

Once the download-wrapper got the dtu-file it automagically creates the new version of the archive. If it fails for any reason to get the dtu-file, it just will fall back to the normal download. So anything happens transparently to portage - there is no need to learn any new commands and no need to additional user intervention.

The behaviour of the download-wrapper can be configured by some variables inside the script - or - for your convenience - you can use the same variables in your /etc/make.conf (useful if you update the script later and do not want to set all variables again). You can chose how verbose the output should be, if you want colorful output, when to timeout a dtu-request, if you want to delete the old version of the source-archive after successfully creating the new and things like that.
So, please, have a look at and edit the script and change the variables to your needs before running it
All variables are documented in there. Variables set in /etc/make.conf have higher priority.

I hope this will be useful (actually it IS useful for some people already)

Enjoy!
blackpenguin (see me on freenode for feedback or questions **UPDATE**: I've opened a channel #dynamic-deltup-server for discussions and questions)

If you are interested in running another dynamic-deltup-server (idea is a network of deltup-servers that know about the cache-contents of the others) please contact me.
Last edited by blackpenguin on Sun Aug 29, 2004 12:28 am, edited 1 time in total.
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Fri Aug 27, 2004 10:09 pm

Great! Works for me!
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Top
deelkar
n00b
n00b
Posts: 8
Joined: Fri Aug 27, 2004 11:23 pm

  • Quote

Post by deelkar » Fri Aug 27, 2004 11:31 pm

assuming you have not yet enabled your portage overlay, use these steps to emerge and start using dynamic deltup:

be root for this:

Code: Select all

 echo 'PORTDIR_OVERLAY="/usr/local/portage"'>> /etc/make.conf    # enable Portage overlay
 mkdir -p /usr/local/portage/app-portage/deltup                  # create dir for deltup in overlay 
 cd /usr/local/portage/app-portage/deltup 
 wget http://linux01.gwdg.de/~nlissne/deltup-0.4.0.ebuild        # download deltup ebuild to overlay
 ebuild deltup-0.4.0.ebuild digest                               # fetch package and build digest
 cd /usr/local/bin                      
 wget http://linux01.gwdg.de/~nlissne/getdelta.sh                # get the getdelta.sh script
 chmod 755 getdelta.sh                                           # make executable
 mkdir -p /etc/portage                                           # make portage config dir (for keywords file)
 echo "app-portage/deltup ~x86" >> /etc/portage/package.keywords # add deltup to keywords
 emerge deltup                                                   # emerge deltup
 echo 'FETCHCOMMAND="/usr/local/bin/getdelta.sh \${URI}"' >> /etc/make.conf # enable getdelta.sh as new fetchcommand
 getdelta.sh                                                     # run getdelta.sh once to initialize config (optional)
make sure you look into the /etc/deltup directory to set up getdelta.sh and deltup to your needs. (the default values should do fine though)

done!
Last edited by deelkar on Tue Sep 21, 2004 3:50 am, edited 6 times in total.
Top
asph
l33t
l33t
User avatar
Posts: 741
Joined: Mon Aug 25, 2003 8:52 am
Location: Barcelona, Spain

  • Quote

Post by asph » Sat Aug 28, 2004 12:33 am

the script seems to work fine, but the ebuild its like broken:

Code: Select all

nastassja ~ # emerge deltup-0.4.0.ebuild
Calculating dependencies \!!! aux_get(): ebuild for '/deltup-0.4.0' does not exist at:
!!!            /usr/portage//deltup/deltup-0.4.0.ebuild
emerge: create(): aux_get() error on /deltup-0.4.0; aborting...
gentoo sex is updatedb; locate; talk; date; cd; strip; look; touch; finger; unzip; uptime; gawk; head; emerge --oneshot condom; mount; fsck; gasp; more; yes; yes; yes; more; umount; emerge -C condom; make clean; sleep
Top
ew8home
n00b
n00b
Posts: 4
Joined: Tue Feb 17, 2004 10:57 pm

  • Quote

Post by ew8home » Sat Aug 28, 2004 2:15 am

Hi!

Try putting the deltup-0.4.0.ebuild into /usr/local/portage/app-portage/deltup/

along with "ebuild /usr/local/portage/app-portage/deltup/deltup-0.4.0.ebuild digest" a following ACCEPT_KEYWORDS="~x86" emerge deltup will work pretty fine.
Top
tomaw
Guru
Guru
User avatar
Posts: 429
Joined: Wed Mar 26, 2003 7:53 am
Location: UK

  • Quote

Post by tomaw » Sat Aug 28, 2004 10:04 am

Works very nicely here too. Is the server capable of taking the load of people testing this out? Hopefully Gentoo will incorporate something similar to this officially for the poor slow connection users out there :)
Tom Wesley
Top
asph
l33t
l33t
User avatar
Posts: 741
Joined: Mon Aug 25, 2003 8:52 am
Location: Barcelona, Spain

  • Quote

Post by asph » Sat Aug 28, 2004 10:09 am

that worked, thanks :P

also when downloading packages, sometimes i get a "ls de*" not found (when it seems to search for already downloaded packages, if it can find it it echoes the ls error msg).. except for that works fine
gentoo sex is updatedb; locate; talk; date; cd; strip; look; touch; finger; unzip; uptime; gawk; head; emerge --oneshot condom; mount; fsck; gasp; more; yes; yes; yes; more; umount; emerge -C condom; make clean; sleep
Top
TPC
Tux's lil' helper
Tux's lil' helper
Posts: 135
Joined: Tue Sep 16, 2003 2:01 pm
Location: Sweden
Contact:
Contact TPC
Website

  • Quote

Post by TPC » Sat Aug 28, 2004 10:10 am

In file included from deltup.cpp:25:
file.h: In member function `virtual int Injectable_IStream::read(void*, int)':
file.h:132: error: ISO C++ forbids cast to non-reference type used as lvalue
file.h:142: error: ISO C++ forbids cast to non-reference type used as lvalue
make: *** [deltup] Error 1
I guess the thing needs to be fixed to work with gcc 3.4 :roll:
Top
PrakashP
Veteran
Veteran
User avatar
Posts: 1249
Joined: Mon Oct 27, 2003 4:10 pm
Location: C.C.A.A., Germania

  • Quote

Post by PrakashP » Sat Aug 28, 2004 1:23 pm

It was easy to fix.

Look into source. There are two instances of

(char*)foo+=bar;

change that to
foo=(char*)foo+bar;
Top
TPC
Tux's lil' helper
Tux's lil' helper
Posts: 135
Joined: Tue Sep 16, 2003 2:01 pm
Location: Sweden
Contact:
Contact TPC
Website

  • Quote

Post by TPC » Sat Aug 28, 2004 2:07 pm

it worked, thanks.

What about resuming downloads? does thing thing support that? What should my RESUMECOMMAND be in make.conf?
Top
Greven
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 138
Joined: Sun Jul 28, 2002 10:50 pm

  • Quote

Post by Greven » Sat Aug 28, 2004 9:03 pm

Will it work with other downloaders??

AKA Snarf?

Code: Select all

#Snarf
FETCHCOMMAND="/usr/bin/snarf -b \${URI} \${DISTDIR}/\${FILE}"
RESUMECOMMAND="/usr/bin/snarf -rb \${URI} \${DISTDIR}/\${FILE}"
veritas vos liberabit...
Linux User Number: 346805
Wine-Wiki
AMD 64 3500+ | MSI "K8T NEO2-FIR" | mushkin Dual Channel DDR 400
Top
Wiebel
n00b
n00b
User avatar
Posts: 60
Joined: Wed Feb 05, 2003 5:15 pm
Location: Bad Homburg, Germany

  • Quote

Post by Wiebel » Sat Aug 28, 2004 9:32 pm

@Greven not yet tested but should work fine, can you report your experience?
but anyway you must use FETCH= instead of FETCHCOMMAND= because gedelta.sh must be the script emerge will start aas FETCHCOMMAND. FETCH on the other hand advices getdelta.sh itself ti use the proper command.
Top
Vanquirius
Retired Dev
Retired Dev
User avatar
Posts: 1297
Joined: Fri Jun 14, 2002 9:07 pm
Location: Ethereal plains
Contact:
Contact Vanquirius
Website

  • Quote

Post by Vanquirius » Sat Aug 28, 2004 9:38 pm

I installed it and it looks promising. I couldn't put in action just yet (it just fell back to normal downloading), however.

edit: got it to work with gaim-encryption-2.29.tar.gz-gaim-encryption-2.30.tar.gz.dtu. Awesome job!
Hello.
Top
Greven
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 138
Joined: Sun Jul 28, 2002 10:50 pm

  • Quote

Post by Greven » Sat Aug 28, 2004 9:54 pm

@Wiebel

Sure.... I just emerge synced so I will be adding deltup on soon.
veritas vos liberabit...
Linux User Number: 346805
Wine-Wiki
AMD 64 3500+ | MSI "K8T NEO2-FIR" | mushkin Dual Channel DDR 400
Top
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

  • Quote

Post by blackpenguin » Sun Aug 29, 2004 12:34 am

Greven wrote:Will it work with other downloaders??

AKA Snarf?
YES, nothing depends on the output or behaviour of wget - that's the reason why there is a variable named FETCH in the script.

But, do *not* change your RESUMECOMMAND in your make.conf - getdelta.sh *cannot* handle resumes. So if you have already parts of an archive in your $DISTDIR, just delete it or let portage use your RESUMECOMMAND to get the rest.

This is also a trick, to prevent portage using getdelta.sh for a specific download (if ever needed) - just "touch $DISTDIR/$filename" - and portage will use RESUMECOMMAND instead of getdelta.sh
Top
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

  • Quote

Post by blackpenguin » Sun Aug 29, 2004 12:37 am

TPC wrote:What about resuming downloads? does thing thing support that? What should my RESUMECOMMAND be in make.conf?
Do not change it. getdelta.sh cannot resume.
Top
riksta
n00b
n00b
Posts: 73
Joined: Fri Apr 16, 2004 12:51 pm
Location: Manchester, UK

  • Quote

Post by riksta » Sun Aug 29, 2004 2:28 am

forgive me if i am wrong, but why not just use RSYNC for this?
Top
PrakashP
Veteran
Veteran
User avatar
Posts: 1249
Joined: Mon Oct 27, 2003 4:10 pm
Location: C.C.A.A., Germania

  • Quote

Post by PrakashP » Sun Aug 29, 2004 1:59 pm

I wonder why it doesn't always work:

GOT gnupg-1.2.5.tar.bz2-gnupg-1.2.6.tar.bz2.failed

$
{RED}The server could not build the dtu-file for gnupg-1.2.6.tar.bz2

reason:

sorry, could not get gnupg-1.2.6.tar.bz2


After that the original archive is downloaded instead of the delta.

(edit) Happened to me two more times with other files. Something wrong with the server? Too much of traffic?

There are cases where the delta fails miserably (ie gets way too big), usually with very small files:


pcre-4.4.tar.bz2-pcre-4.5.tar.bz2.dtu 54.4 kB 280.0 B -19797.86% -55434.0 B 2004-08-29 15:30 1

I think here the server software should rather throw away the delte and give a error/info back to download the original file.
Last edited by PrakashP on Sun Aug 29, 2004 2:33 pm, edited 3 times in total.
Top
skipjack
Tux's lil' helper
Tux's lil' helper
Posts: 75
Joined: Thu Mar 20, 2003 11:56 pm

  • Quote

Post by skipjack » Sun Aug 29, 2004 2:26 pm

Hi, blackpenguin ..
Hello World! ;-)

yeah public beta .. that's great!

I can say to everyone thta script is very cool. it works fine and fast ;-)
I was one of the beta tester before the public test starts ;-)
I will say taht tool is great and I think it will help gentoo, because I read sometimes that the distfiles and ebuild of gentoo portage makes to many traffic.

What will say the gentoo developer to this tool?

Happy beta testing ;-)
Top
NoUseForAName
Tux's lil' helper
Tux's lil' helper
Posts: 84
Joined: Sat Feb 22, 2003 12:39 pm
Location: Sweden

  • Quote

Post by NoUseForAName » Sun Aug 29, 2004 4:59 pm

Looks like a great thing, but I'm having problems using it :(

This is what i get:

Code: Select all

richard distfiles # emerge -f =development-sources-2.6.8.1
Calculating dependencies ...done!
>>> emerge (1 of 1) sys-kernel/development-sources-2.6.8.1 to /
>>> Downloading http://gentoo.osuosl.org/distfiles/linux-2.6.8.1.tar.bz2
Checking if a Thirdparty-Mirror is used ...

No third-party mirror.

Searching for a previosly downloaded file in /usr/portage/distfiles

/usr/local/bin/getdelta.sh: line 305: [: too many arguments
We have following candidates to choose from
links-2.1pre14.tar.bz2
linux-2.4.22.tar.bz2
linux-2.6.3.tar.bz2
linux-2.6.7.tar.bz2

The best of all is ... linux-2.6.7.tar.bz2

Trying to download linux-2.6.7.tar.bz2-linux-2.6.8.1.tar.bz2.dtu

--18:55:20--  http://linux01.gwdg.de/%7Enlissne/deltup.php?have=linux-2.6.7.tar.bz2&want=linux-2.6.8.1.tar.bz2&version=0.5.2
           => `deltup.php?have=linux-2.6.7.tar.bz2&want=linux-2.6.8.1.tar.bz2&version=0.5.2'
Resolving linux01.gwdg.de... 134.76.13.21
Connecting to linux01.gwdg.de[134.76.13.21]:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: ftp://134.102.120.44/deltup/linux-2.6.7.tar.bz2-linux-2.6.8.1.tar.bz2.dtu [following]
--18:55:23--  ftp://134.102.120.44/deltup/linux-2.6.7.tar.bz2-linux-2.6.8.1.tar.bz2.dtu
           => `linux-2.6.7.tar.bz2-linux-2.6.8.1.tar.bz2.dtu'
/usr/local/bin/getdelta.sh: line 431: 23152 Aborted                 $FETCH "${DELTUP_SERVER}${query}"
The dtu could not be fetched, downloading full file from original URL
Any idea what could be wrong?
Top
NoUseForAName
Tux's lil' helper
Tux's lil' helper
Posts: 84
Joined: Sat Feb 22, 2003 12:39 pm
Location: Sweden

  • Quote

Post by NoUseForAName » Sun Aug 29, 2004 5:12 pm

Ok, got rid of the first error:

Code: Select all

/usr/local/bin/getdelta.sh: line 305: [: too many arguments 
by changing line 305 from

Code: Select all

        if ! [ -z $filelist ]
to

Code: Select all

        if ! [ -z "$filelist" ]
but that doesn't seem to matter to much, I'm still getting the last error, even though the file seems to exist.
Top
NoUseForAName
Tux's lil' helper
Tux's lil' helper
Posts: 84
Joined: Sat Feb 22, 2003 12:39 pm
Location: Sweden

  • Quote

Post by NoUseForAName » Sun Aug 29, 2004 5:29 pm

Sorry for the noise, remerged wget and now it works fine.

Looks like a really useful program. Thanks!
Top
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

  • Quote

Post by blackpenguin » Sun Aug 29, 2004 5:44 pm

NoUseForAName wrote:Ok, got rid of the first error:

Code: Select all

/usr/local/bin/getdelta.sh: line 305: [: too many arguments 
by changing line 305 from

Code: Select all

        if ! [ -z $filelist ]
to

Code: Select all

        if ! [ -z "$filelist" ]
but that doesn't seem to matter to much, I'm still getting the last error, even though the file seems to exist.
It worked even with the "too many arguments" problem (therefore i didn't fixed it before, since there were other - more severe problems before ;-)), but you've fixed that problem. Thanks - change applied.
Top
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

  • Quote

Post by blackpenguin » Sun Aug 29, 2004 6:13 pm

PrakashKC wrote:I wonder why it doesn't always work:

GOT gnupg-1.2.5.tar.bz2-gnupg-1.2.6.tar.bz2.failed

$
{RED}The server could not build the dtu-file for gnupg-1.2.6.tar.bz2

reason:

sorry, could not get gnupg-1.2.6.tar.bz2
Well, the reason is given there - the server tried to get gnupg-1.2.6.tar.bz2 but failed. Sometimes this happens because the mirror-type given to the server is "gentoo", but the file was not found on any gentoo mirror known to the server.

Set GENTOO_MIRRORS="" in make.conf to avoid such problems (with this setting, portage always will give the original-server-url to getdelta.sh - and getdelta.sh will fail less in finding the correct mirror-group) - the problem is - once the server failed on all mirrors of the given mirror-group it will not try again (with another mirror-group) until I delete the "failed"-file.
But as long as it downloads the original archive in cases like that, IMHO it's not a severe problem.
PrakashKC wrote: There are cases where the delta fails miserably (ie gets way too big), usually with very small files:

pcre-4.4.tar.bz2-pcre-4.5.tar.bz2.dtu 54.4 kB 280.0 B -19797.86% -55434.0 B 2004-08-29 15:30 1

I think here the server software should rather throw away the delte and give a error/info back to download the original file.
Well, in THIS case (pcre) it probably just failed to see the correct original-size (could happen with local symlinks on the server itself) - 280 Bytes is too small for pcre-4.5.tar.bz2

However, there *are* cases, where the dtu is *really* bigger than the original file - and you are right, it should throw away these dtu.
I have put this on my todo-list - its easy to do that - so it will be done soon.

Thanks for your feedback,
blackpenguin
Last edited by blackpenguin on Sun Aug 29, 2004 7:12 pm, edited 1 time in total.
Top
blackpenguin
n00b
n00b
User avatar
Posts: 43
Joined: Tue Mar 09, 2004 5:27 pm
Location: Germany
Contact:
Contact blackpenguin
Website

  • Quote

Post by blackpenguin » Sun Aug 29, 2004 6:22 pm

riksta wrote:forgive me if i am wrong, but why not just use RSYNC for this?
Uhm.... what? I am not sure if I catch your idea. - If you mean to unpack the local old version to somewhere and then rsync with the wanted version - well - that cannot be done with a downloadwrapper since you will fail to get the same MD5SUM again when compressing back to an archive again.

That is, because you do cannot know anything about the parameters and (for gzipped files timestamp) originally used.

Just try it - untar a gzipped file and tar it again - portage will not accept the result, since the MD5SUM will have changed.

That is the great thing about John Whitney's deltup, it reads the needed information from the fileheaders of the destination-file to be able to create a patch that makes a bit-identical destination-archive and therefore pass the md5sum-check.

blackpenguin
Top
Post Reply

272 posts
  • Page 1 of 11
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 11
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic