I am in the process of renaming ~2800 files, and it has been running all night. Here is the code:
namespace UpdateMetadata
{
class Program
{
static Workspace _ws;
static void Main(string[] args)
{
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://devtfserver:8080");
Console.WriteLine("User: {0}", tfs.AuthenticatedUserName );
VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof (VersionControlServer));
_ws = vcs.GetWorkspace(@"<my local workspace folder>");
DirectoryInfo di = new DirectoryInfo(@"<a subtree (containing the XML files to rename) of my local workspace>");
ProcessDirectory(di);
}
static void ProcessDirectory(DirectoryInfo di)
{
FileInfo[] files = di.GetFiles();
foreach (FileInfo file in files)
{
if (Path.GetExtension(file.Name).ToLower() != ".xml")
{
string newName = file.FullName + ".xml";
Logger.Info("PendRename {0} => {1}", file.Name, Path.GetFileName(newName));
_ws.PendRename(file.FullName, newName);
}
}
DirectoryInfo[] dirs = di.GetDirectories();
foreach (DirectoryInfo dir in dirs)
{
ProcessDirectory(dir);
}
}
}
}
It started off reasonably quickly - even over the VPN; however, it was still running 7 hours later when I awoke. I started it
again at the office, with a direct connection to the server, however it is taking roughly 35-40 seconds to rename a file. CPU
usage on my local machine is <1%, context switching is minimal.
It is evident that the server performance has significantly degraded over the duration of this operation, and therefore is the
cause of the performance issues - why?
Cheers,
Stuart
Stuart Carnie - 05 Feb 2007 17:52 GMT
We rebooted the server, to no avail. On a colleagues machine, a rename was instantaneous yet still 40-50 seconds on my machine.
Turns out that TFS does not scale very well with too many pending changes (perhaps it is particular to renames).
After committing what I had, it was fast again.
> I am in the process of renaming ~2800 files, and it has been running all
> night. Here is the code:
[quoted text clipped - 55 lines]
>
> Stuart
Stuart Carnie - 05 Feb 2007 17:52 GMT
We rebooted the server, to no avail. On a colleagues machine, a rename was instantaneous yet still 40-50 seconds on my machine.
Turns out that TFS does not scale very well with too many pending changes (perhaps it is particular to renames).
After committing what I had, it was fast again.
> I am in the process of renaming ~2800 files, and it has been running all
> night. Here is the code:
[quoted text clipped - 55 lines]
>
> Stuart