Tell me more ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

We have a very large scale enterprise level database. As part of our business model all web users hit our web servers at the same time each month which in turn hammer our sql box. The traffic is very heavy and continues to grow heavier the larger the company grows. sql proc optimization has been performed and hardware has already been scaled up to a very high level.

We are looking to shard the database now to ensure that we can handle company growth and future loads.

We have decided what particular data should be sharded. It is a subset of our database which is highly utilized.

However, my question is regarding the non sharded data which is common/universal. An example of data like this may be an Inventory table for instance or possibly an Employee table, user table etc .

I see two options to handle this common/universal data:

1) design 1 - Place the common/universal data in an external database. All writes will occur here. This data will then be replicated down to each shard allowing each shard to read this data and inner join to this data in t-sql procs.

2) design 2 - Give each shard its own copy of all common/universal data. Let each shard write locally to these tables and utilize sql merge replication to update/sync this data on all other shards.

concerns about design #1

1) Transactional issues: If you have a situation in which you must write or update data in a shard and then write/update a common/universal table in 1 stored proc for instance, you will no longer be able to do this easily. The data now exists on seperate sql instances and databases. You may need to involve MS DTS to see if you can wrap these writes into a transaction since they are in a separate database. Performance is a concern here and possible rewrites may be involved for procs that write to sharded and common data.

2)a loss of referential integrity. Not possible to do cross database referential integrity.

3) Recoding large areas of the system so that it knows to write common data to the new universal database but read common data from the shards.

4). increased database trips. Like #1 above, when you run into a situation in which you must update sharded data and common data you are going to make multiple round trips to accomplish this since the data is now in separate databases. Some network latency here but I am not worried about this issue as much as the above 3.

concerns about design #2

In design #2 each shard gets its own instance of all common/universal data. This means that all code that joins to or updates common data continues to work/run just like it does today. There is very little recoding/rewriting needed from the development team. However, this design completely depends on merge replication to keep data in sync across all shards. the dbas are highly skilled and are very concerned that merge replication may not be able to handle this and should merge replication fail, that recovery from this failure is not great and could impact us very negatively.

I am curious to know if anyone has gone with design option #2. I am also curious to know if i am overlooking a 3rd or 4th design option that I do not see.

thank you in advance.

share|improve this question
9  
In this instance, what is "a very large scale enterprise database" and hardware that "has already been scaled up to a very high level"? 10 times out of 10, sharding isn't the solution, so wondering what the problem you're solving is. – Mark Storey-Smith Dec 18 '12 at 23:31
5  
In all seriousness, you say your web servers "hammer" your SQL box. What ratio is read:write? There are many, many ways to scale out reads without sharding, with trade-offs for performance, cost or complexity depending on how current the data really needs to be. And of course there are ways to queue writes, again depending on how up-to-the-nanosecond the data at rest needs to be. – Aaron Bertrand Dec 18 '12 at 23:56
3  
This particular statement caught my attention, "hardware has already been scaled up to a very high level." What has gone into this hardware scale-up? – swasheck Dec 18 '12 at 23:59
the database server is running 500 gig of RAM and is one of the largest servers I have seen. The processor is equally as large but I do not know the exact specs on it. The business model is such that all customers hit us over the same 1-2 day period every month. As the customer base grows the hits grow on that same 1-2 day period and the traffic is not spread out throughout the month. We are currently handling 15,000 web connections a minute. A replicated sql box is in place which is handling read only data requests already. DB is 750 gig today. Processor is the bottleneck. – Matt Dec 19 '12 at 14:58
2  
You have 64 logical processors and CPU is the bottleneck? What is driving CPU exactly, recompiles? Do you know? – Aaron Bertrand Dec 19 '12 at 18:10
show 4 more comments

migrated from stackoverflow.com Dec 18 '12 at 22:07

1 Answer

A possible 3rd option. Using relational sharding (instead of black box sharding), you should be able to shard and distribute your entire database. Because it is built off of a traditional relational data model, the database knows what data is stored on what servers and thus where to find it, so all of your data can be considered 'common/universal'. Check out dbShards as a possibility to make the entire sharding process easier.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.