Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
Web application with MVC ->Currently I have a database with customer data and product details.
The application has been using in only one country. Now going to globally use the web application.

But the customers doesn't want their customer data leave out of their country.
For example if we are going to support two countries, then we need to have two databases deployed(one for each).

What I have tried:

So I am thinking to use WCF to get the data from two different countries and display the same in our Web application.

Do you have any other suggestion on this?
Thanks in advance
Posted
Updated 2-Apr-18 8:01am
Comments
Afzaal Ahmad Zeeshan 4-Apr-18 14:27pm    
Where do you store the database? Are they needed to be in separate countries too?
vijay vettri 12-Apr-18 8:32am    
Yes. Because the data should not leave out of customer country. So we have servers with db in each country.

This is an extremely good question. Few things that come in mind:

If the databases are autonomous and do not need almost any information from each other, then separate database servers would probably be the easiest solution. The client application would only be configured so that it connects the correct server and instance

If the databases need to share small amount of information I would use a single master database containing the common data which is either accessed via linked servers or replicated if the reliability of the connection is not tolerable. Rest of the tables would be located on country specific databases.

Things get interesting if you need to access all the databases inside the same queries. If this is a requirement I would recommend investigating Understanding Federated Database Servers[^]. Using federated view would most likely require some logical changes in the application but if the database is going to be spread along multiple servers based on clients then small changes probably cannot be avoided.

Of course Azure would be one topic to discuss but you wrote
"But the customers doesn't want their customer data leave out of their country." so cloud based storage is probably out of question.

ADDITION:
---------
When the two servers are far away from each other, few things to take into consideration:
- Overall speed, how fast the connection between the servers really is
- Variance in speed, does the throughput vary a lot
- Reliability, has the connection connectivity problems
- Need for the link, do majority of the queries execute based on local data even though it's possible to fetch remote data. This applies mainly to the federated views.

All these factors affect the situation. For example if most of the queries need data from both local and remote servers, then it is probably best to 'cache' the remote data locally for example using replication.

On the other hand if the application needs to access most recent data then copying the data may not be the right choice and you need to fetch it when needed. This means links or other mechanism but also may introduce performance bottlenecks and reliability problems.

So in the end, there's no correct answer and what may be the best solution today may be second best tomorrow because connectivity and throughput evolves all the time. In order to decide what is best for your situation you need to go through all the requirements you have and compare different options against the required functionality. After all the decision is going to be a compromise, one way or another.
 
Share this answer
 
v2
Comments
vijay vettri 4-Apr-18 2:54am    
Thanks for the suggestion! I have looked into Partitioning of data.(Have check constraint in table,Create linked servers,create view).Yes. It will be helpful. But in case of having the database servers in different countries, is Linking servers possible? Because they will not be on the same network. rite. Please update your inputs !
Wendelius 4-Apr-18 13:46pm    
Please see the updated answer.
vijay vettri 12-Apr-18 8:31am    
Hi Wendelius, Is it possible to update the data(insert/delete row) via partitioned view in case of linked servers used?
Wendelius 12-Apr-18 23:23pm    
With some restrictions,, yes. Have a look at Modifying Data in Partitioned Views[^]
Look up database sharding. Essentially you'll have a catalog database and then shard databases (one per country). The service would wrap it up so that consumers do not need to worry about hitting the right DB.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900