How to keep Canadian and US customers database separate in their country

  • We have a need to keep MS SQL server data of users in their country, USA and Canada. We have servers in both country. We have a single web application that need to manage data for both and it has to be seamless. I don't want users to direct to separate country specific sub domains like http://ca.mysite.com and http://us.mysite.com. What would it take to achieve this? My front end web application is hosted in USA.

    What technologies do I need to know so that I can explore more? Is it something related to distributed transaction concept or some other useful features/tools are available in MS SQL server? Also, do you know if having VPN between 2 servers will help with the performance of the application when data is fetched from 2 servers?

    Chris

  • How will you tell where to send data? How can you tell if a user is from a country?

    You can certainly use something like bidirectional transaction replication to move data. You can also use Service Broker to build two one-way pipes, though preventing loops of changes can be an issue there.

    The VPN doesn't necessarily improve performance, and can hurt it. It's more about security.

  • Number one, you need to become very good friends with your network people!

    Where are the user names and passwords stored? If they can be stored in the USA database, and your network bandwidth, security, etc. etc. allow it, the simple answer is as follows:

    1. Store the users and passwords in the USA database.

    2. When the user logs on, determine if they are a Canadian or American user.

    3. If Canadian, then use a connection string that connects to the Canadian database.

    4. If American, then use a connection string that connects to the USA database.

    This is overly simplified, there are a number of questions that need to be asked of your network people.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • >>How will you tell where to send data? How can you tell if a user is from a country?

    This will be part of the sign up process and saved in USA database.

  • If you have database servers in each country, I believe that you're missing a prime opportunity for disaster recovery. All customers should be in the same database and the database should, obviously, be able to discriminate by the customer as to which country's information they should have access to. For Canada especially, there should also be a language preference.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Well, the simplest way would seem to be to just duplicate the SQL structure and code then have the application use an appropriate connection string depending on which country the user is from. Whenever you take that approach you need to make sure that it's somewhat locked down to ensure each instance stays in sync as far as code changes in SQL though.

    If the data only needs to be in its respective country, not necessarily completely separate, you might use the US DB as the "master" since that's where your site is hosted. Then just replicate the Canadian data to the SQL instance there like what Steve suggested. Or just replicated all of it and have a backup if that's not an issue.

  • A few more questions.

    Is there common data between the two databases that needs to be in sync? Or, is this data completely separate?

    If there is data that needs to be synced, does some of it need to be real time, and some of it can be synced on a schedule? This may simplify things.

    Are these servers in the same domain, or, trusted domains? Or are they completely separate boxes? The VPN question makes me think that there is no physical connection between these servers.

    Why do the different databases need to be in two different countries? If this is a web app, there is nothing stopping you from having these databases in the same physical location. They can even be on the same server.

    I had a similar situation where the application and database lived in the United States, and the application users were in China. The original plan was to implement a second server and bi-directional transactional replication. We threw that out, and had the users in China connect directly to the app in the US. We then implemented transactional replication as well as snapshot replication from the US to China. A separate "read only utility" application was created so that the China users could read the replicated data instead of pulling significant amounts of data over the VPN connection.

    Jeff's suggestion to use this as an opportunity to implement DR should also be taken into consideration. Some higher level assistance will likely be required.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • >>>Why do the different databases need to be in two different countries?

    This is a legal requirement, we cannot keep health records of US citizens in Canada or health records of Canadians in USA.

  • ChrisSut (7/25/2014)


    >>>Why do the different databases need to be in two different countries?

    This is a legal requirement, we cannot keep health records of US citizens in Canada or health records of Canadians in USA.

    I have seen non-US clients require that their data be stored outside of the US to prevent it from being subject to the Patriot Act.

    In practice, I doubt that would help if the entity hosting the data is a US company. They would simply turnover the data stored on the foreign servers if they were presented with a search warrant.

  • Here is the simples solution:

    1. Have two separate databases and two separate web servers servicing the requests

    2. Have the users login to a third common website

    3. Redirect the users to the appropriate website once authenticated and location is known.

    Always try and keep your web apps as close to the database as possible. Reduce latency.

    Let me know if that makes sense.

    Good Luck !!

  • Michael Valentine Jones (7/25/2014)


    ChrisSut (7/25/2014)


    >>>Why do the different databases need to be in two different countries?

    This is a legal requirement, we cannot keep health records of US citizens in Canada or health records of Canadians in USA.

    I have seen non-US clients require that their data be stored outside of the US to prevent it from being subject to the Patriot Act.

    In practice, I doubt that would help if the entity hosting the data is a US company. They would simply turnover the data stored on the foreign servers if they were presented with a search warrant.

    Here is some current news on this subject.

    US judge orders Microsoft to produce emails held abroad

    http://www.cnet.com/news/u-s-judge-orders-microsoft-to-produce-emails-held-abroad/

    Looks like our government is doing everything they can to drive customers with privacy concerns away from US companies. :crying:

  • >>> 1. Have two separate databases and two separate web servers servicing the requests

    >>> Always try and keep your web apps as close to the database as possible. Reduce latency.

    This is an issue. I can't have 2 web servers. Can I have just 1 web server that fetch the data from local and remote database servers? As you mentioned, any data fetching from remote server is too slow due to latency. Are there any solutions like VPN or something else that may help? Is there any kind of service or tool that can make a direct link between 2 data centers to reduce latency?

  • The service is a better connection between the two systems. You can lease a line at whatever speed, or get faster Internet service and hope it works.

    If you have to keep things separate, that's really your best option.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply