locked
Am I using Sync Services right? Performance seems really bad... RRS feed

  • Question

  • My scenario:

    SQL Express 2008, VS2010, WPF / .NET 4.0, ADO.NET, Sync Services 2.0.

    We currently have 13 tables. My small test data set is very small. There is no table with > 30 rows. As you can see, VERY SMALL tables right now. Eventually, 2 of the tables will contain 3M rows each. So my panic is already setting in...

    With my small dataset (my SDF file is 348k), it takes about 3 - 5 seconds to load & save the database. So a user pushes the "Save" button and has to wait for 5 seconds before the UI comes back. Kind of defeats the whole purpose of using the SyncFramework IMHO.

    As a frame of reference, BEFORE switching to the SyncFramework, a save was "instant" (but one way).
     
    We are not using any stored procs. Everything is ADO.NET tables / record sets. A save happens like this:

    // tblMarkup delete

    SharedPrivateData.taMarkup.Update(SharedPrivateData.ds.tblMarkup.Select(null, null, DataViewRowState.Deleted));

    // tblBaseline delete

    SharedPrivateData.taBaseline.Update(SharedPrivateData.ds.tblBaseline.Select(null, null, DataViewRowState.Deleted));

    // tblTemplateSets delete

    SharedPrivateData.taTemplateSets.Update(SharedPrivateData.ds.tblTemplateSets.Select(null, null, DataViewRowState.Deleted));

    // tblTemplateSet insert, update, delete

    SharedPrivateData.taTemplateSet.Update(SharedPrivateData.ds.tblTemplateSet.Select(null, null, DataViewRowState.Deleted));
    SharedPrivateData.taTemplateSet.Update(SharedPrivateData.ds.tblTemplateSet.Select(null, null, DataViewRowState.ModifiedCurrent));
    SharedPrivateData.taTemplateSet.Update(SharedPrivateData.ds.tblTemplateSet.Select(null, null, DataViewRowState.Added));

    .
    .
    .

    SharedPrivateData.ds.AcceptChanges();

    // syncronize with the server

    xxxCacheSyncAgent syncAgent = new xxxCacheSyncAgent();

    syncAgent.SessionProgress += new EventHandler<SessionProgressEventArgs>(syncAgent_SessionProgress);
    syncAgent.Synchronize();


    My sync agent has all the tables bidirectional:

     public partial class xxxCacheSyncAgent
     {
      partial void OnInitialized()
      {
       tblBaseline.SyncDirection = SyncDirection.Bidirectional;
       tblField.SyncDirection = SyncDirection.Bidirectional;
       tblFieldCategories.SyncDirection = SyncDirection.Bidirectional;
       tblFieldFieldReferences.SyncDirection = SyncDirection.Bidirectional;
       tblMarkup.SyncDirection = SyncDirection.Bidirectional;
       tblScript.SyncDirection = SyncDirection.Bidirectional;
       tblScriptCategories.SyncDirection = SyncDirection.Bidirectional;
       tblTemplate.SyncDirection = SyncDirection.Bidirectional;
       tblTemplateCategories.SyncDirection = SyncDirection.Bidirectional;
       tblTemplateFieldReferences.SyncDirection = SyncDirection.Bidirectional;
       tblTemplateSet.SyncDirection = SyncDirection.Bidirectional;
       tblTemplateSets.SyncDirection = SyncDirection.Bidirectional;
       tblTokenSubst.SyncDirection = SyncDirection.Bidirectional;

       ((RubiSoftCacheClientSyncProvider)LocalProvider).AddHandlers();
      }
     }

    It seems like its doing the full tables both ways. Is that right??

    Monday, July 26, 2010 6:17 PM

All replies

  • Any ideas guys?
    Thursday, July 29, 2010 5:06 PM
  • to give you an idea of what's happening when you sync, Sync Fx will fire a query to check for a new anchor value. It will also fire queries to check for incremental changes for each table from the client side (insert, update, delete) and the same thing happens on the server side.

    And this is just for change enumeration, when changes are detected, they need to be serialized/deserialized when uploading/downloading.

    Then change application happens where the actual insert/update/deletes are applied.

    you may want to enable Sync Fx tracing to see what's happening underneath.

    Thursday, July 29, 2010 11:23 PM