Synchronize for SyncDirectionOrder.Download works slower than SyncDirectionOrder.Upload ?

Pergunta Synchronize for SyncDirectionOrder.Download works slower than SyncDirectionOrder.Upload ?

  • 06 Agustus 2012 19:38
     
      Memiliki Kode

    I am developing a small windows service which looks up at a remote location folder and sync files into a temp location(upload). These temp location files are moved to a different drive.

    After this step happens I want to get rid of the files at the remote location. For which I sync back to the remote location.(download)

    Following is the code snippet of my sync.

    		FileSyncProvider sourceProvider = null;
    		FileSyncProvider destinationProvider = null;
    
    		FileSyncOptions options = FileSyncOptions.ExplicitDetectChanges |   //an explicit DetectChanges need to call on FileSyncProvider to get new changes      
                       FileSyncOptions.RecycleDeletedFiles |                         FileSyncOptions.RecycleConflictLoserFiles;          
    
                	FileSyncScopeFilter filter = new FileSyncScopeFilter();
                filter.FileNameExcludes.Add("*.lnk");
    
                	SyncOperationStatistics uploadStat;
                	SyncOperationStatistics downloadStat;
    
    
                    sourceProvider = new FileSyncProvider(this.FromPath, filter, options);
                    destinationProvider = new FileSyncProvider(this.TempPath, filter, options);
    
                    //Detect changes in source and destination
                    sourceProvider.DetectChanges();
                    destinationProvider.DetectChanges();
    
                    //Sync agent for synchronizing source and destination. Upload
                    SyncOrchestrator agent = new SyncOrchestrator();
                    agent.LocalProvider = sourceProvider;
                    agent.RemoteProvider = destinationProvider;
                    agent.Direction = SyncDirectionOrder.Upload; // Sync source to destination
    
                    //start Synchronization
                    uploadStat = agent.Synchronize();
    
    
    		//move all files from the Temp location to the final destination. regular file system Move is used.
               	MoveAll(this.FromPath,this.TempPath,this.ToPath);
    
                    //Detect changes in source and destination
                    sourceProvider.DetectChanges();
                    destinationProvider.DetectChanges();
    
                    //Sync agent for synchronizing source and destination. Download
                    agent.Direction = SyncDirectionOrder.Download; //Sync destination to source
                    downloadStat = agent.Synchronize();
    
     

    I have like more than 2 GB of data at a given instant to sync. The first step i.e. upload takes a while but copies the files comparatively fast to the temp location.

    The next step which is just a move from one drive location to other is fast.

    Last, step where I do a download to get rid of the initially sync(upload) files to the remote location takes really long time and sometimes like freezes for a while. Which I could not figure out why is that so.

    Can anything be done to speed up the process? This is slowing down my backup service.

    Is there any better way?

Semua Balasan

  • 07 Agustus 2012 1:42
    Moderator
     
     

    where are you keeping the metadata files?

    see if the file sync part here helps: http://social.technet.microsoft.com/wiki/contents/articles/sync-framework-tips-and-troubleshooting.aspx

  • 07 Agustus 2012 12:26
     
     

    The metadata files are stored in the respective sync locations.

    In my case I have 2 metadata files one at each location

    - //remote location/folder name/filesync.metadata

    - D:/temp location/folder name/filesync.metadata

    Is this right?

  • 07 Agustus 2012 12:46
    Moderator
     
     
    if you follow the link i posted above, it suggests putting the remote location's metadata file on the client side.
  • 07 Agustus 2012 13:11
     
     
    I'll do that and see if it works for me or not.
    • Diedit oleh arm007 07 Agustus 2012 13:11
    •  
  • 28 Agustus 2012 20:58
     
     

    Using the tips mentioned in the link did help me to some extend, but the performance is still not that promising. 

    Do you have any more thoughts over this, which can improve the performance?

  • 30 Agustus 2012 11:16
    Moderator
     
     

    have you tried removing your second DetectChanges on the source provider?