140 likes | 211 Views
Improve download speeds and user experience with Background Intelligent Transfer Service (BITS). Understand BITS advantages, limitations, and best practices for efficient updates. Implement BITS for smooth updates and enhance overall user workflow.
E N D
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 W2000) • 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 UpdateHandler handler = createUpdateHandler("cet-test-bits", "CET Test Handler"); handler.updateInterval = 3 minutes; handler.jobInterval = 30 s; handler.idleThreshold = 5 s; // Setup an update group strremoteDir = configuraWebRoot # relativeDir; UrllocalDir = cmWritable("data/"); RtBitsTestGroupgroup("cet-test-bits-group", "Test Group", remoteDir, localDir, waitForAll=true); handler << group; // Setup a single file to keep updated RtBitsTestUpdateupdate(fileToDownload); group << update; // Start the timers handler.startTimers();
Directory example • // Setup a handler • UpdateHandler handler = createUpdateHandler("cet-test-bits", "CET Test Handler"); • handler.updateInterval = 3 minutes; • handler.jobInterval = 30 s; • handler.idleThreshold = 5 s; • // Setup an update group • strremoteDir = configuraWebRoot # relativeDir; • UrllocalDir = cmWritable("data/"); • UpdateDirectoryGroupsyncMyStuff("my-pricelists-sync", "Sync the pricelists directory", • remoteDir, localDir, waitForAll=true); • // Start the timers • handler.startTimers();
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