Thursday, September 27, 2007

TortoiseSVN's "Noisy" TSVNCache.exe

A co-worker of mine pointed me to a post by Travis Illig on his blog titled "Optimize Tortoise SVN Cache (TSVNCache.exe) Disk I/O"

A short synopsis:

TortoiseSVN has a shell-overlay that indicates the status of your files and folders within an SVN 'working folder'.

The background process that 'watches' your file system for SVN-related files and folders is TSVNCache.exe.

TSVNCache.exe, according to Travis, was bogging his system down with disk I/O.

Instead of disabling TSVNCache.exe entirely (and thereby disabling the icon-overlays) he found a way to limit what TSVNCache.exe 'watches' on the file system.

When I first read his post, I thought "How bad can TSVNCache.exe be?" So, as noted in the comments of Travis' post, I grabbed FileMon from SysInternals, and fired it up. After setting a filter so it would only display TSVNCache.exe-related events, I was amazed at just how much 'noise' it was causing -- and I wasn't doing anything at all! Just sitting there watching FileMon do it's thing.

What really caught my eye was when I sent my coworker an instant message, thanking him for the link. My IM client wrote the message to it's log file, and I saw TSVNCache note the change, and check the log file's location for the existence of a ".svn" folder. (The existence of such a folder would indicate that the folder is an SVN working folder.)

I was surprised to say the least, and wanted to see how bad it really got. I 'putzed ' around doing a whole lot of nothing other than navigating around my file system. I seemed ridiculous at just how much disk I/O TSVNCache.exe was inducing.

For example, look at the following screen shot. It's the TSVNCache activity imposed when I copied a folder on my desktop, which contains one file:

Thankfully, by limiting which folders TSVNCache.exe 'watches' you can greatly limit this superfluous disk I/O. In case you still haven't taken a moment to click-through and read Travis' post, here's the quick run-down:

  1. Open your TortoiseSVN settings (Right-click the desktop, TortoiseSVN -> Settings)

  2. Go to the "Icon Overlays" item in the treeview.

  3. Add "C:\*" to the "Exclude Paths" box

  4. Add the folders you do want included in the "Include Paths" box
    • I entered my 'work' folder: "C:\Work\*", for example.

  5. Save changes : Apply/Ok

  6. Restart TSVNCache.exe - kill TSVNCache.exe in your Task Manager. It will automatically restart when you open a Windows Explorer.

With these changes in place, within FileMon, you'll notice that TSVNCache is a lot less noisy. It will still receive "Change Notify" messages, but you won't see it access files/folders outside of your specified "Include" list.

Thanks for the great tip, Travis!


Anonymous said...

Thanks a lot!

Dennis said...

Thanks for running that down. Very helpful.

Anonymous said...

You have saved me so much time! It was killing my laptop.

felipe.archangelo said...

GREAT post =]

Very very very useful for anyone who uses TSVN

R Smith said...

Very, VERY cool. More annoying than the disk thrashing was the occasional locked folder that was impossible to delete w/o killing the TSVNCache process. Thanks! :)

MattieG said...

Excellent post. My whole team is making this change today.

Anonymous said...

Thanks a lot. Very very very helpful.

Anonymous said...

Do you comma, space, return, or semicolon-separate multiple directories?

Jason Poll said...

One directory per line, no delimiter. Just like what is shown in the bottom screenshot.

Dan said...

Thank you for posting this, it is very helpful.

Dan said...

Thank you for posting this, it is a big help.

Anonymous said...

Thanks for the very useful info.

If you uncheck "Fixed Drives" under Drive Types then it is not necessary to add "C:\*" to the Exclude Paths area. Of course, this doesn't give exactly the same result if you have fixed drives other than C:

sherwopj said...

Thanks old bean, you've lessened the load.