views:

248

answers:

6

Related question: What is the most efficient way to break up a centralised database?

I'm going to try and make this question fairly general so it will benefit others.

About 3 years ago, I implemented an integrated CRM and website. Because I wanted to impress the customer, I implemented the cheapest architecture I could think of, which was to host the central database and website on the web server. I created a desktop application which communicates with the web server via a web service (this application runs from their main office).

In hindsight this was rather foolish, as now that the company has grown, their internet connection becomes slower and slower each month. Now, because of the speed issues, the desktop software times out on a regular basis, the customer is left with 3 options:

  1. Purchase a faster internet connection.
  2. Move the database (and website) to an in-house server.
  3. Re-design the architecture so that the CRM and web databases are separate.

The first option is the "easiest", but certainly not the cheapest long term. Second option; if we move the website to in-house hosting, the client has to combat issues like overloaded/poor/offline internet connection, loss of power, etc. And the final option; the client is loathed to pay a whole whack of cash for me to re-design and re-code the architecture, and I can't afford to do this for free (I need to eat).

Is there any way to recover from when you've screwed up the design of a distributed system so bad, that none of the options work? Or is it a case of cutting your losses and just learning from the mistake? I feel terrible that there's no quick fix for this problem.

+12  A: 
  1. You didn't screw up. The customer wanted the cheapest option, you gave it to them, this is the cost that they put off. I hope you haven't assumed blame with your customer. If they're blaming you, it's a classic case of them paying for a Chevy while wanting a Mercedes.

    Pursuant to that:

  2. Your customer needs to make a business decision about what to do. Your job is to explain to them the consequences of each of the choices in as honest and professional a way as possible and leave the choice up to them.

Just remember, you didn't screw up! You provided for them a solution that served their needs for years, and they were happy with it until they exceeded the system's design basis. If they don't want to have to maintain the system's scalability again three years from now, they're going to have to be willing to pay for it now. Software isn't magic.

Greg D
+1  A: 

First things first how much of the code do you really have to throw away? What language did you use for the Desktop client? Something .NET and you may be able to salvage a good chuck of the logic of the system and only need to redo the UI and some of the connections.

My thoughts are that 1 and 2 are out of the question, while 1 might be a good idea it doesn't solve the real problem. And we as engineers should try and build solutions not dependent on the client when ever possible. And 2 makes them get into something they aren't experts at and it is better to keep the hosting else where.

Also since you mention a web service is all you are really losing the UI? You can alway reuse the webservices for the web server interface.

Lastly you could look at using a framework to help provide a simple web based CRUD to start and then expand from there.

Jeff Beck
It's C# .Net, all 3 systems (desktop, web service, and web site). I'm hoping that I can separate the web service and database, but as always there *will* be complications, so it will be very expensive for them, plus I'm not sure I have time. Tough position!
nbolton
Check out Kragens post, I'm still wondering if it is really the internet connection. Could the Database need optimization? Is the server underpowered?
Jeff Beck
We've ordered a RAM upgrade. It's slow on my computer, but I never get timeouts. I think it's slow because of bandwidth -- observing my download meter, it's only slow when the application is maxing out my internet connection. When it loads something with a small amount of download required, it's fairly responsive. When I run the desktop application on the local database computer, it's lightning fast.
nbolton
Sounds like you are returning too much data, can you think about returning things in more chunks? Do you have paging in your webservices?
Jeff Beck
+6  A: 

I wouldn't call it a screw up unless:

  1. It was known how much traffic or performance requirements would grow. And
  2. You deliberately designed the system to under-perform. And
  3. You deliberately designed the system to be rigid and non adaptable to change.

A screw up would have been to over-engineer a highly complex system costing more than what the scale at the time demanded.

In fact it is good practice to only invest as much as can currently be leveraged by the business, using growth to fund further investment in scalability, should it be required. It is simple risk management.

Surely as the business has grown over time, presumably with the help of your software, they have also set aside something for the next level up. They should be thanking you for helping grow their business beyond expectations, and throwing money at you so you can help them carry through to the next level of growth.

All of those three options could be good. Which one is the best depends on cost benefits analysis, ROI etc. It is partially a technical decision but mostly a business one.

Congratulations on helping build a growing business up til now, and on to the future.

Kurt
Hmm, well I knew that their traffic would grow, but I had no idea just how hungry .Net web services were -- I really should have benchmarked the software first, before handing it over.
nbolton
+1 for risk management
jk
+2  A: 

Are you sure that the cause of the timeouts is the internet connection, and not some performance issues in the web service / CRM system? By timeout I'm going to assume you mean something like ~30 seconds, in which case:

  • Either the internet connection is to blame and so you would see these sorts of timeouts to other websites (e.g. google), which is clearly unacceptable and so sorting the internet is your only real option.
  • Or the timeout is caused either by the desktop application, the web serice, or due to exessively large amounts of information being passed backwards and forwards, in which case you should either address the performance issue how you might any other bug, or look into ways of optimising the Desktop application so that less information is passed backwards and forwards.

In sort: the architecture that you currently have seems (fundamentally) fine to me, on the basis that (performance problems aside) access for the company to the CRM system should be comparable to accesss for the public to the system - as long as your customers have reasonable response times, so should the company.

Kragen
The application is very slow for me, but rarely times out; I made some poor design decisions on the UI, so when they open a customer account, it downloads a load of non-cached data each time -- and all this data is depended on so I can't cut any of it out. If this was running over the LAN then it wouldn't be an issue, but their internet is like 2 megabit, so it's dog slow.
nbolton
@nbolton I'd probably say that should be cached locally then - if it is necessary to have it 100% up to date then you need to come up with a method of only transferring changes in the data, and run that each time. Your fundamental archetecture still looks fine to me - solutions 2 and 3 will bring their own problems to solve anyway! :-)
Kragen
+1  A: 

Install a copy of the database on the local network. Then let the client software communicate with the local copy and let the database software do the synchronization between the local database server and the database on the webserver. It depends on which database you use, but some of them have tools to make that work. In MSSQL it is called replication.

Frans
Yeah, I had considered MSSQL replication. But I have no experience with it, so I'm worried about how conflicts are handled, etc.
nbolton
A: 

Are you sure the connection is saturated? You could be hitting all sorts of network, I/O and database problems... Unless you've already done so, use wireshark to analyze the traffic; measure the throughput and share the results with us.

hobbit
Traffic throughput is through the roof; it's a bandwidth issue.
nbolton