views:

135

answers:

3

Following on from this question...

... the client has reluctantly asked me to quote for option 3 (the expensive one), so they can compare prices to a company in India.

So, they want me to quote (hmm). In order for me to get this as accurate as possible, I will need to decide how I'm actually going to do it. Here's 3 scenarios...

Scenarios

Split the database

My original idea (perhaps the most tricky) will yield the best speed on both the website and the desktop application. However, it may require some synchronising between the two databases as the two "systems" so heavily connected. If not done properly and not tested thouroughly, I've learnt that synchronisation can be hell on earth.

Implement caching on the smallest system

To side-step the sync option (which I'm not fond of), I figured it may be more productive (and cheaper) to move the entire central database and web service to their office (i.e. in-house), and have the website (still on the hosted server) download data from the central office and store it in a small database (acting as a cache)...

  1. Set up a new server in the customer's office (in-house).
  2. Move the central database and web service to the new in-house server.
  3. Keep the web site on the hosted server, but alter the web service URL so that it points to the office server.
  4. Implement a simple cache system for images and most frequently accessed data (such as product information).

... the down-side is that when the end-user in the office updates something, their customers will effectively be downloading the data from a 60KB/s upload connection (albeit once, as it will be cached).

Also, not all data can be cached, for example when a customer updates their order. Also, connection redundancy becomes a huge factor here; what if the office connection is offline? Nothing to do but show an error message to the customers, which is nasty, but a necessary evil.

Mystery option number 3

Suggestions welcome!

SQL replication

I had considered MSSQL replication. But I have no experience with it, so I'm worried about how conflicts are handled, etc. Is this an option? Considering there are physical files involved, and so on. Also, I believe we'd need to upgrade from SQL express to SQL non-free, and buy two licenses.

Technical

Components

  • ASP.Net website
  • ASP.net web service
  • .Net desktop application
  • MSSQL 2008 express database

Connections

  • Office connection: 8 mbit down and 1 mbit up contended line (50:1)
  • Hosted virtual server: Windows 2008 with 10 megabit line
A: 

Splitting the database will not help a lot but it'll add a lot of nightmare. IMO, you should first try to optimize the database, update some indexes or may be add several more, optimize some queries and so on. For database performance tuning I recommend to read some articles from simple-talk.com.
Also in order to save bandwidth you can add bulk processing to your windows client and also add zipping (archiving) to your web service.
And probably you should upgrade to MS SQL 2008 Express, it's also free.

It's hard to recommend a good solution for your problem using the information I have. It's not clear where is the bottleneck. I strongly recommend you to profile your application to find exact place of the bottleneck (e.g. is it in the database or in fully used up channel and so on) and add a description of it to the question.

EDIT 01/03:
When the bottleneck is an up connection then you can do only the following:
1. Add archiving of messages to service and client
2. Implement bulk operations and use them
3. Try to reduce operations count per user case for the most frequent cases
4. Add a local database for windows clients and perform all operations using it and synchronize the local db and the main one on some timer.

And sql replication will not help you a lot in this case. The most fastest and cheapest solution is to increase up connection because all other ways (except the first one) will take a lot of time.
If you choose to rewrite the service to support bulking I recommend you to have a look at Agatha Project

zihotki
Oops, it is MSSQL 2008! My mistake. By the way, it's a bandwidth and connection reliability issue; when the desktop software is run locally on the server it's lightning fast. The bottleneck is the internet connection, not the database.
nbolton
+3  A: 

Having just read for the first time your original question related to this I'd say that you may have laid the foundation for resolving the problem simply because you are communicating with the database by a web service.

This web service may well be the saving grace as it allows you to split the communications without affecting the client.

A good while back I was involved in designing just such a system.

The first thing that we identified was that data which rarely changes - and immediately locked all of this out of consideration for distribution. A manual process for administering using the web server was the only way to change this data.

The second thing we identified was that data that should be owned locally. By this I mean data that only one person or location at a time would need to update; but that may need to be viewed at other locations. We fixed all of the keys on the related tables to ensure that duplication could never occur and that no auto-incrementing fields were used.

The third item was the tables that were truly shared - and although we worried a lot about these during stages 1 & 2 - in our case this part was straight-forwards.

When I'm talking about a server here I mean a DB Server with a set of web services that communicate between themselves.

As designed our architecture had 1 designated 'master' server. This was the definitive for resolving conflicts.

The rest of the servers were in the first instance a large cache of anything covered by item1. In fact it wasn't a large cache but a database duplication but you get the idea.

The second function of the each non-master server was to coordinate changes with the master. This involved a very simplistic process of actually passing through most of the work transparently to the master server.

We spent a lot of time designing and optimising all of the above - to finally discover that the single best performance improvement came from simply compressing the web service requests to reduce bandwidth (but it was over a single channel ISDN, which probably made the most difference).

The fact is that if you do have a web service then this will give you greater flexibility about how you implement this.

I'd probably start by investigating the feasability of implementing one of the SQL server replication methods

Usual disclaimers apply:

Richard Harrison
Yeah, I'm glad now that I used web services to separate the website and database -- I did design the system vaguely with this in mind. Also, SQL server replication may be the best bet, but there are also physical files to consider; but maybe I could write some sync software to take care of this.
nbolton
if you need to sync files between then rsync (or deltacopy) is much better than writing something yourself.Or be brave and move the files into the database...
Richard Harrison
A: 

Actually hearing how many they have on that one connection it may be time to up the bandwidth at the office (not at all my normal response) If you factor out the CRM system what else is a top user of the bandwidth? It maybe the they have reached the point of needing more bandwidth period.

But I am still curious to see how much information you are passing that is getting used. Make sure you are transferring efferently any chance you could add some easy quick measures to see how much people are actually consuming when looking at the data.

Jeff Beck