Skip to content

Occasionally Connected Smart Clients

Featured Image

I completely agree that we live in connected world. Now-a-days everything is connected, we cannot even imagine smart phone without internet connectivity. However, in many case we cannot expect connectivity to server. Even in some case the nature of application itself demands to work in disconnected mode especially desktop application. Say for example, there is an application which uses large resources like high resolution images and high definition video files and these resources are needed frequently. Now every time downloading resources from server is not advisable architecture. We need to store those resources in local system and application should access only local resource for better performance and better usability. Another real time example would be for sales representative where he is on client side and could not connect to server even though he needed latest prices and catalogues to close the deal.

There are multiple examples of applications where occasionally connected smart clients are required which download needed data in local and do synchronization with server whenever necessary. Synchronizing between two applications in such architecture is crucial part. Microsoft itself provides practices for th

is type of application. But for a small and simple application designing such architecture is overkill.

This type of application should be developed to take maximum advantage of connectivity when it is available to make sure that both applications and data are as up to date as possible, without compromising performance of the application.

Proven Approaches:

SQL Server Replication

According to MSDN documentation on SQL Server Replication is:

“Replication is a set of technologies for copying and distributing data and database objects from one database to another and then synchronizing between databases to maintain consistency.”

When your application depends on SQL Database only and your all data are stored in the database itself (meaning there is no file comes into picture which is stored on the physical hard drive). SQL Server Replication is best way to achieve synchronization between two SQL Databases.

Advantages

  • Adapters connect themselves on connectivity, on manual effort needed.
  • Proven technology – Microsoft support
  • Even if your table design changes your clients will update automatically
  • HTTP protocol for Synchronization

Disadvantages

  • Only supports SQL Server
  • Requires SQL Server paid version which affects client infrastructure
  • Requires expertise in SQL
  • Difficult to diagnose problems during development

Microsoft Sync Framework

Microsoft provides very smart and efficient framework for this type of application where you can synchronize between any databases or even with file system.

As Wikipedia quote,

“Microsoft Sync Framework is a data synchronization platform from Microsoft that can be used to synchronize data across multiple data stores”.

Advantages

  • Works with any database
  • Provides conflict resolution policy
  • Works with both upload and download strategy

 

Disadvantages

  • Network Requirement – While synchronizing, constant connection required
  • Scalability – It relays on a single server so, at a time of synchronization if server is down synchronization is not possible.
  • Limited conflict resolution possibility

Custom Synchronization

In Custom Synchronization, you can develop your own synchronization framework according to the requirements of your project. This type of synchronization gives you full flexibility. You can develop conflict resolution policy on your own. Say for example, in case of conflict between server and client Microsoft sync framework only provides whether you want server data or you want client data. But In custom synchronization you can give an option to merge columns based on rules.

Advantages

  • Flexibility
  • Focused on project specific requirement
  • Avoids complexity

Disadvantages

  • Required more effort
  • In depth testing required
  • Need to manage every worst case scenario
SQL Server Replication Microsoft Sync Framework Custom Framework
Flexibility Yes
Maintainability Yes Yes
Scalability Yes
High Infrastructure cost Yes
Conflict Resolution Yes Yes Yes
Control over process Yes Yes
High Development effort Yes Yes

Image Source: msdn.microsoft.com

Related Insights