BITS

...a short introduction for .Net devs.

Created by Maciej Talaśka / @MaciekTalaska

B  I  T  S    is:

  • B

    ackground
  • I

    ntelligent
  • T

    ransfer
  • S

    ervice

History

  • 1.0 (October 2001), Initial release, Windows XP
  • 1.2 (July 2002), XP SP1, Windows 2000
  • 1.5 (September 2003), +Windows 2003
  • 2.0 (August 2004), XP, WS 2003 SP1, W2000
  • 2.5 (June 2007), IPv6!
  • 3.0 (November 2006), +Vista
  • 4.0 (July 2009), Windows 7, Windows Server 2008 R2

BITS 1.0

  • first release
  • prioritized, throttled and asynchronous downloads
  • download resume

BITS 1.2

  • internal update and improvements

BITS 1.5

  • upload, upload-reply
  • command line execution for events
  • explicit credentials

BITS 2.0

  • concurrent foreground downloads
  • downloading range of files

BITS 2.5

  • custom http headers
  • secure http transports
  • IPv6

BITS 3.0

  • peer caching
  • notification
  • control http redirects
  • diagnostics, troubleshooting -> system log
  • only for Vista+, Windows Server 2008

BITS 4.0

  • improved peer caching
  • BITS compact server
  • more granular bandwidth throttling
  • only for Windows7+, Windows Server 2008 R2

BITS 5.0

  • IBackgroundCopyJob5
  • only for Windows 8+, Windows Server 2012

BITS for Linux?

No! you can rsync with --bwlimit but...

Who uses bits?

  • Microsoft: Office updates
  • Google: Chrome updates

What is bits good for?

  • Microsoft: Office updates
  • Google: Chrome updates

Using BITS

BITS - introduction

  • what is job?
  • job == file?
  • may I use it for my own app?

BITS job priority

  • foreground
  • high
  • normal
  • low

what are the statuses for?
BITS 1.5 and earlier: only one job at a time.

BITS job state

  • queued
  • connecting
  • transferring
  • suspended
  • error
  • transient_error
  • transferred
  • acknowledged
  • cancelled

BITS job type

  • download
  • upload (BITS 1.5+)
  • upload reply (BITS 1.5+)

Robocopy vs BITS

  • Robocopy has nicer UI
  • Robocopy is capable of resuming downloads
  • Robocopy may synchronize whole folders
  • Robocopy for local networks, RDP connections...

BITS via cmd.exe?

  • bitsadmin.exe - (deprecated?)
  • you HAVE to *complete* job!

bitsadmin /MONITOR
bitsadmin /LIST 
bitsadmin /COMPLETE (id)
bitsadmin /CANCEL (id)
					

BITS via Powershell

  • Add-BitsFile
  • Complete-BitsTransfer
  • Get-BitsTransfer
  • Remove-BitsTransfer
  • Resume-BitsTransfer!
  • Set-BitsTransfer
  • Start-BitsTransfer
  • Suspend-BitsTransfer

I don't have any BITS* Cmdlets!


Import-Module BitsTransfer
					

BITS - best practices

  • 100 jobs per machine
  • 10 jobs per application
  • 10 files per job

BITS - best practices: job persistence

  • COMPLETE
  • CANCEL
  • JobInactivityTimeout (90 days)

BITS - best practices: foreground vs background

  • foreground - for critical tasks
  • foreground - size limit (2GB)
  • foreground - resume?

BITS via C#

“BITS is designed for C and C++ developers.”

Not really true...

BitsMonitor

https://bitsmonitor.codeplex.com/
Meny
  • cmd-line + GUI
  • autostart
  • auto-restart
  • shutdown when done
  • active jobs
  • AUTO-COMPLETE!

Fin

Q & A?

Maciej Talaśka