vote up 5 vote down
star

What algorithms (the simpler, the better) are there for balancing items across multiple containers? In this particular case, the "items" are actually SharePoint site collections and the "containers" are SharePoint content databases. We have some content databases that are very large, and some that are quite small. We'd like to figure out some way to migrate sites from heavily-loaded content databases to the smaller ones. I'm hoping I can do this automatically, like some script (IronRuby?) that I can trigger and then it will in turn trigger the movement of sites between the various content databases. Of course the end result should be that each content database would have roughly the same size. Thanks!

flag

2 Answers

vote up 5 vote down

I think what you want is a solution for balancing the sizes of the content databases?

I think your best bet would be create a script that you run N-times a day/week (N is determined by your project specifics) that would balance the size of your content databases by shifting sites to less used content databases.

here is a link to a site that discusses how to export some of the content databases.

http://www.mssqltips.com/tip.asp?tip=1777

from the said site link here

Moving Site Collections Between Content Databases

If you have a content database that is getting too big, you can move one of more of its site collections to a different content database. Run the STSADM -o enumsites command described above and redirect the output to a

STSADM.EXE -o enumsites -url http://biwsssql2008:6666 > sites.xml

Edit the output file using Notepad and delete the sites that you do not want to move; i.e. edit the sites.xml file so that it contains the list of site collections in a single content database that you want to move to another content database. You can then use a command like the following to move the site collections to another content database:

STSADM.EXE
-o mergecontentdbs
-url http://biwsssql2008:6666
-sourcedatabase <databasename>
-destinationdatabase <databasename>
-operation 3
-filename sites.xml

Please note the following caveats on the mergecontentdbs operation:

* You should have your SharePoint administrator take care of this.
* Moving large site collections can take a long time.
* The mergecontentdbs operation was added in SharePoint service pack

Although what the site shows is something to be done by someone, you can easily modify what he did and create a windows service out of it. You could simply add all sizes of all the content databases and transfer some of the entries of the large databases to the smaller ones, depends on your strategy.

link|flag
Thanks...I already know how to do this manually, what I was looking for was an algorithm that will allow me to do this automatically :) – cruizer Feb 2 at 3:18
1 
this falls into a Load Balancing Type of Problem/Algorithm. A variety of scheduling algorithms are used by load balancers to determine which backend server to send a request to. Simple algorithms include random choice or round robin. More sophisticated load balancers may take into account additional factors, such as a server's reported load, recent response times, up/down status (determined by a monitoring poll of some kind), number of active connections, geographic location, capabilities, or how much traffic it has recently been assigned. (From wikipedia Load Balancing(Computing)) – AnGoL Feb 2 at 9:15
vote up 4 vote down

Simplest would be round robin. Create a list of all the containers, store the last container used and pick the next one on the list. This is probably the easiest to implement but the end result will not guarantee similar sizes.

The next simplest algo (IMO) would be to keep a counter of all the remaining spaces per container and pick the container with the most free space.

link|flag

Your Answer

Get an OpenID
or

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