Using BITS for updates Quick training session Goal
Using BITS for updates Quick training session
Goal / Purpose � Download and install takes a long time � End user just wants to work! � We want smooth updates …
Goal / Purpose � Download and install takes a long time � End user just wants to work! � We want smooth updates … Solution � Background downloads � Scheduled install
What is BITS? � Background Intelligent Transfer Service � Windows component � Foundation for Windows Update � Available from 2001 (XP and W 2000) � Version 1. 5 � Version 4. 0
How does it work? � Create a “job”, like download this file � Periodically check the status � When finished, save (copy) the file
BITS Advantages � Works everywhere � Asynchronous � Downloads even if CET is turned off � Uses idle network bandwidth
BITS Cons � Very slow response time (10 -300 ms) � Very sensitive to workload (jobs*files) � No support for directory listings (!) � No peer caching (in version < 4) � One file at a time feeling � Windows Update might interfere … � Narrow bandwidth – unknown …
Dealing with the cons � Job queue (limit to 5 jobs) � Webdirectory. exe � Defensive polling (only when idle)
What can YOU do with BITS? � Marbodal uses BITS for pricelist updates � BITS can also do uploads (like issue reports) � Easy to sync all files in a directory (*. db) � OO – you can subclass and customize � But – it’s still not mature … � So there will be stuff missing …
Single file example // Setup a handler Update. Handler handler = create. Update. Handler("cet-test-bits", "CET Test Handler"); handler. update. Interval = 3 minutes; handler. job. Interval = 30 s; handler. idle. Threshold = 5 s; // Setup an update group str remote. Dir = configura. Web. Root # relative. Dir; Url local. Dir = cm. Writable("data/"); Rt. Bits. Test. Group group("cet-test-bits-group", "Test Group", remote. Dir, local. Dir, wait. For. All=true); handler << group; // Setup a single file to keep updated Rt. Bits. Test. Update update(file. To. Download); group << update; // Start the timers handler. start. Timers();
Directory example � // Setup a handler � Update. Handler handler = create. Update. Handler("cet-test-bits", "CET Test Handler"); � handler. update. Interval = 3 minutes; � handler. job. Interval = 30 s; � handler. idle. Threshold = 5 s; � // Setup an update group � str remote. Dir = configura. Web. Root # relative. Dir; � Url local. Dir = cm. Writable("data/"); � Update. Directory. Group sync. My. Stuff("my-pricelists-sync", "Sync the pricelists directory", remote. Dir, local. Dir, wait. For. All=true); � � // Start the timers � handler. start. Timers();
Extension updates � Example of an advanced implementation � Header (info) files � Version numbers embedded � File dependencies & consistency � Only update Extensions the user has installed � Or Extensions selected manually by user
Extension updates example � Webdirectory. exe downloads dirlist (async) � New info files downloaded � Info files versions compared to installed � Download new Extensions � Notify user about new updates � And allow scheduled install
Errors � Files inconsistent (being uploaded) � Online file removed during download � Online file replaced during download
- Slides: 14