Monday, March 5, 2007

Mailbox Load Balancing Made Simple - Part 2

In part one of this three part article I discussed load balancing mailbox databases based upon file size. In part two I will discuss balancing databases based upon the number of users per database.

Equal Number of Users Per Database

The second approach is to assign an equal number of users per database. Statistically, if the majority of your users have the same quota, database sizes should be similar. Obviously some databases will be larger than others but theoretically the database sizes should fall within a bell curve. To find the smallest database (in terms of mailboxes) we can group mailboxes by database and sort accordingly:

[PS] C:\Temp>Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count

Name Count
---- -----
EVS2\SG9\MDB9 27
EVS3\SG19\MDB19 36
EVS3\SG9\MDB9 37
EVS3\SG4\MDB4 38
EVS3\SG2\MDB2 39

Assuming your edb file name is the same as the mailbox database name you can easily extract this information for mailbox provisioning:

[PS] C:\>$TargetDatabase = (((Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count)[0].Name).Split(”.edb”))[0]
[PS] C:\>Enable-Mailbox -Database:$TargetDatabase

Pros: This method is ideal for load-balancing new mailboxes on multiple servers. When/if new mailbox databases are added to the Exchange system they will quickly be populated to match existing databases.

Cons: When you have a large number of mailboxes, grouping mailboxes by database can take quite a few seconds, even minutes. This time delay can become quite a bottleneck if you are creating a large number of mailboxes.

In part three I will detail randomly distributing mailboxes.



Jason said...

This is very good stuff, Nick, thanks. Can you break down the [0].name and .split(".edb"))[0] parts of the expression? I'm not sure where .edb comes into play since the results from the get-mailbox and subsequent piped commands don't return anything with .edb. Thanks!

Jason said...

Ah, nevermind Nick. I see you're not active with this blog anymore and I figured out what I was after. For me, I modified the last part of the command to: