Replies: 5 comments 7 replies
-
ConflictsConflicts algorithm has been reworked to be more efficient with more performances and less queries Before this version, usually, for each conflict we had between 1 and 3 queries executed. That been said, here is a quick overview of the improvement with the Worht it :) |
Beta Was this translation helpful? Give feedback.
-
Orchestrators public methodsAll the orchestrators public methods have been enhanced to allow you to use only one Here is a comparison between the // v0.6
public virtual Task<long> GetLocalTimestampAsync(
CancellationToken cancellationToken = default, IProgress<ProgressArgs> progress = null)
// v0.6.1
public virtual Task<long> GetLocalTimestampAsync(
DbConnection connection = default, DbTransaction transaction = default,
CancellationToken cancellationToken = default, IProgress<ProgressArgs> progress = null) Here is a small benchmark, using SQL Server, SQLite and MySQL: // v0.6
for (int i = 0; i < 1000; i++)
{
await orchestrator.GetEstimatedChangesCountAsync().ConfigureAwait(false);
await orchestrator.ExistTableAsync(agent.Setup.Tables[0]).ConfigureAwait(false);
await orchestrator.GetLocalTimestampAsync().ConfigureAwait(false);
await orchestrator.GetSchemaAsync().ConfigureAwait(false);
await orchestrator.GetChangesAsync().ConfigureAwait(false);
}
// v0.6.1
using (var c = agent.LocalOrchestrator.Provider.CreateConnection())
{
c.Open();
using (var t = connection.BeginTransaction())
{
for (int i = 0; i < 1000; i++)
{
await orchestrator.GetEstimatedChangesCountAsync(connection: c, transaction: t).ConfigureAwait(false);
await orchestrator.ExistTableAsync(agent.Setup.Tables[0], connection: c, t: transaction).ConfigureAwait(false);
await orchestrator.GetLocalTimestampAsync(connection: c, transaction: t).ConfigureAwait(false);
await orchestrator.GetSchemaAsync(connection: c, transaction: t).ConfigureAwait(false);
await orchestrator.GetChangesAsync(connection: c, transaction: t).ConfigureAwait(false);
}
t.Commit();
}
c.Close();
} And here are the results: SQL Server [Connection Pooling, Connection not shared]: 0:45.504
SQL Server [Connection Pooling, Connection shared]: 0:42.855
SQLite [Connection not shared]: 0:21.632
SQLite [Connection shared]: 0:8.525
MySQL Server [Connection Pooling, Connection not shared]: 3:59.944
MySQL Server [Connection Pooling, Connection shared]: 3:7.833 |
Beta Was this translation helpful? Give feedback.
-
Scope Info QueriesAll scope info queries have been cached and prepared to be more efficient. for (int i = 0; i < loop; i++)
{
await orchestrator.ExistScopeInfoTableAsync(Dotmim.Sync.Builders.DbScopeType.Client, options.ScopeInfoTableName).ConfigureAwait(false);
await orchestrator.ExistTableAsync(agent.Setup.Tables[0]).ConfigureAwait(false);
await orchestrator.GetClientScopeAsync();
} # v0.6
SQL Server [Connection Pooling, Connection not shared]: 0:12.592
SQLite [Connection not shared]: 1:4.161
#v0.6.1
SQL Server [Connection Pooling, Connection not shared]: 0:10.959
SQL Server [Connection Pooling, Connection shared]: 0:8.94
SQLite [Connection not shared]: 0:43.362
SQLite [Connection shared]: 0:3.901
|
Beta Was this translation helpful? Give feedback.
-
Progress percentage: It's about time !You have all requested it. The overall Percentage is finally here :) Here is a quick overview of what you can get with this kind of code: var localProgress = new SynchronousProgress<ProgressArgs>(s =>
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"{s.PogressPercentageString}:\t{s.Message}");
Console.ResetColor();
});
var s = await agent.SynchronizeAsync(localProgress);
Console.WriteLine(s); TCP ModeHere is the result of a TCP first call (initialization of a new empty database): 0%: 0b6dda78-21e7-433c-b346-93d32598fb2b: Session Begins.
0%: Client: Provisioned 9 Tables. Provision:Table, TrackingTable, StoredProcedures, Triggers.
57%: AdventureWorks: [ProductDescription] [Total] Upserts:762. Deletes:0. Total:762.
59%: AdventureWorks: [ProductCategory] [Total] Upserts:4041. Deletes:0. Total:4041.
61%: AdventureWorks: [ProductModel] [Total] Upserts:128. Deletes:0. Total:128.
63%: AdventureWorks: [Product] [Total] Upserts:295. Deletes:0. Total:295.
66%: AdventureWorks: [Address] [Total] Upserts:450. Deletes:0. Total:450.
68%: AdventureWorks: [Customer] [Total] Upserts:847. Deletes:0. Total:847.
70%: AdventureWorks: [CustomerAddress] [Total] Upserts:417. Deletes:0. Total:417.
72%: AdventureWorks: [SalesOrderHeader] [Total] Upserts:32. Deletes:0. Total:32.
75%: AdventureWorks: [SalesOrderDetail] [Total] Upserts:542. Deletes:0. Total:542.
75%: AdventureWorks: [Total] Upserts:7514. Deletes:0. Total:7514
77%: Client: [ProductDescription] [Modified] Applied:(762) Total:(762/7514).
90%: Client: [ProductCategory] [Modified] Applied:(4041) Total:(4803/7514).
91%: Client: [ProductModel] [Modified] Applied:(128) Total:(4931/7514).
92%: Client: [Product] [Modified] Applied:(295) Total:(5226/7514).
93%: Client: [Address] [Modified] Applied:(450) Total:(5676/7514).
96%: Client: [Customer] [Modified] Applied:(847) Total:(6523/7514).
98%: Client: [CustomerAddress] [Modified] Applied:(417) Total:(6940/7514).
98%: Client: [SalesOrderHeader] [Modified] Applied:(32) Total:(6972/7514).
100%: Client: [SalesOrderDetail] [Modified] Applied:(542) Total:(7514/7514).
100%: Client: [Total] Applied:7514. Conflicts:0.
100%: 0b6dda78-21e7-433c-b346-93d32598fb2b: Session Ended.
Synchronization done.
Total changes uploaded: 0
Total changes downloaded: 7514
Total changes applied: 7514
Total resolved conflicts: 0
Total duration :0:0:4.209 As you can see, the But let's see what happens now if we are inserting rows in both server and client databases: 0%: 847c6e93-8992-4218-88b3-741663d07533: Session Begins.
12%: Client: [ProductDescription] [Total] Upserts:10000. Deletes:0. Total:10000.
21%: Client: [Address] [Total] Upserts:4. Deletes:0. Total:4.
23%: Client: [Customer] [Total] Upserts:1. Deletes:0. Total:1.
30%: Client: [SalesOrderDetail] [Total] Upserts:0. Deletes:16. Total:16.
30%: Client: [Total] Upserts:10005. Deletes:16. Total:10021
30%: AdventureWorks: [SalesOrderDetail] [Deleted] Applied:(13) Total:(13/10021).
52%: AdventureWorks: [ProductDescription] [Modified] Applied:(8828) Total:(8841/10021).
54%: AdventureWorks: [ProductDescription] [Modified] Applied:(10000) Total:(10013/10021).
54%: AdventureWorks: [Address] [Modified] Applied:(4) Total:(10017/10021).
54%: AdventureWorks: [Customer] [Modified] Applied:(0) Total:(10017/10021).
54%: AdventureWorks: [Total] Applied:10017. Conflicts:4.
59%: AdventureWorks: [ProductCategory] [Total] Upserts:10000. Deletes:0. Total:10000.
68%: AdventureWorks: [Customer] [Total] Upserts:5. Deletes:0. Total:5.
75%: AdventureWorks: [SalesOrderDetail] [Total] Upserts:0. Deletes:14. Total:14.
75%: AdventureWorks: [Total] Upserts:10005. Deletes:14. Total:10019
75%: Client: [SalesOrderDetail] [Deleted] Applied:(11) Total:(11/10019).
94%: Client: [ProductCategory] [Modified] Applied:(7938) Total:(7949/10019).
99%: Client: [ProductCategory] [Modified] Applied:(10000) Total:(10011/10019).
99%: Client: [Customer] [Modified] Applied:(5) Total:(10016/10019).
99%: Client: [Total] Applied:10016. Conflicts:4.
100%: 847c6e93-8992-4218-88b3-741663d07533: Session Ended.
Synchronization done.
Total changes uploaded: 10021
Total changes downloaded: 10019
Total changes applied: 10016
Total resolved conflicts: 4
Total duration :0:0:2.652 Regarding the rows count, if you look this kind of line
Ok now; we see that we have a more linear progress since the sync has rows to 0%: e05e0346-38f9-4ae9-9da4-84e612c5bd68: Session Begins.
21%: Client: [Address] [Total] Upserts:7. Deletes:0. Total:7.
23%: Client: [Customer] [Total] Upserts:7. Deletes:0. Total:7.
30%: Client: [SalesOrderDetail] [Total] Upserts:0. Deletes:12. Total:12.
30%: Client: [Total] Upserts:14. Deletes:12. Total:26
41%: AdventureWorks: [SalesOrderDetail] [Deleted] Applied:(12) Total:(12/26).
48%: AdventureWorks: [Address] [Modified] Applied:(7) Total:(19/26).
54%: AdventureWorks: [Customer] [Modified] Applied:(7) Total:(26/26).
54%: AdventureWorks: [Total] Applied:26. Conflicts:0.
100%: e05e0346-38f9-4ae9-9da4-84e612c5bd68: Session Ended.
Synchronization done.
Total changes uploaded: 26
Total changes downloaded: 0
Total changes applied: 0
Total resolved conflicts: 0
Total duration :0:0:0.377 Http ModeThe Http mode is almost the same, a part that we have the Batches Count as well. 0%: Session Begins.
0%: Getting Server Schema. Scope Name:DefaultScope.
0%: Provisioned 9 Tables. Provision:Table, TrackingTable, StoredProcedures, Triggers.
10%: Getting All Changes
42%: Sending All Changes. Rows:0. Waiting Server Response...
57%: Getting Batch Changes. (2/8).
60%: Getting Batch Changes. (3/8).
62%: Getting Batch Changes. (4/8).
65%: Getting Batch Changes. (5/8).
67%: Getting Batch Changes. (6/8).
70%: Getting Batch Changes. (7/8).
72%: Getting Batch Changes. (8/8).
78%: [ProductDescription] [Modified] Applied:(8611) Total:(8611/67437).
81%: [ProductDescription] [Modified] Applied:(17439) Total:(17439/67437).
84%: [ProductDescription] [Modified] Applied:(26267) Total:(26267/67437).
86%: [ProductDescription] [Modified] Applied:(30762) Total:(30762/67437).
89%: [ProductCategory] [Modified] Applied:(7947) Total:(38709/67437).
92%: [ProductCategory] [Modified] Applied:(15885) Total:(46647/67437).
95%: [ProductCategory] [Modified] Applied:(23823) Total:(54585/67437).
98%: [ProductCategory] [Modified] Applied:(31761) Total:(62523/67437).
99%: [ProductCategory] [Modified] Applied:(34041) Total:(64803/67437).
99%: [ProductModel] [Modified] Applied:(128) Total:(64931/67437).
99%: [Product] [Modified] Applied:(295) Total:(65226/67437).
99%: [Address] [Modified] Applied:(450) Total:(65676/67437).
99%: [Customer] [Modified] Applied:(847) Total:(66523/67437).
99%: [CustomerAddress] [Modified] Applied:(417) Total:(66940/67437).
99%: [SalesOrderHeader] [Modified] Applied:(32) Total:(66972/67437).
100%: [SalesOrderDetail] [Modified] Applied:(465) Total:(67437/67437).
100%: [Total] Applied:67437. Conflicts:0.
100%: Session Ended.
Synchronization done.
Total changes uploaded: 0
Total changes downloaded: 67437
Total changes applied: 67437
Total resolved conflicts: 0
Total duration :0:0:20.934 As you can see we have all the Rows Count, and Batches Count to download. 0%: Session Begins.
0%: Getting Server Scope. Scope Name:DefaultScope.
12%: [ProductDescription] [Total] Upserts:10000. Deletes:0. Total:10000.
30%: [Total] Upserts:10000. Deletes:0. Total:10000
40%: Sending Batch Changes. Batches: (1/2). Rows: (8828/10000). Waiting Server Response...
50%: Sending Batch Changes. Batches: (2/2). Rows: (10000/10000). Waiting Server Response...
65%: Getting Batch Changes. (2/2).
94%: [ProductCategory] [Modified] Applied:(7938) Total:(7938/10000).
100%: [ProductCategory] [Modified] Applied:(10000) Total:(10000/10000).
100%: [Total] Applied:10000. Conflicts:0.
100%: Session Ended.
Synchronization done.
Total changes uploaded: 10000
Total changes downloaded: 10000
Total changes applied: 10000
Total resolved conflicts: 0
Total duration :0:0:5.887 Now, feel free to design a mobile application with a smart and cool progress bar (and easy to implement !) Ok, my UI is not really shinny, you will be better than me I guess, but you get the idea ! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
The version V0.6.1 is released !
Nuget packages : https://www.nuget.org/packages?q=Dotmim.Sync
This discussion thread will summarize some of the new functionalities available:
Beta Was this translation helpful? Give feedback.
All reactions