I asked someone the following question..

in the following code... ( from MSDN Mag 2010 issue ( thomas erl ))

[Description("PartitionKey=UserId, Rowkey=AccountId")]
public class UserAccountBalance : TableServiceEntity
public double Balance { get; set; }
public UserAccountBalance()
: base(Guid.NewGuid().ToString(), Guid.NewGuid().ToString())
public UserAccountBalance(Guid userId, Guid accountId)
: base(userId.ToString(), accountId.ToString())

is this creating 1 partition for every UserID in the system?

My understanding of partitions is that lets say I have 50 records for each user and I have 10,000 users.. my query doesnt have to do a table scan of the entire 10,000
to find the 50 records im interesting in for that query therebye improvign performance.
and that other tricks can be done with the 50 recrods like moving them around maybe closer to where they are queried the most.. e.g if my user is coming from California then he hits the Webrole instance in the west coast datacenter and somehow Azure is able to learn to move the Cali user data closer to that WebRole instance.
But a guy from New Yorks records would be moved to the Chicago datacenter as he would mostlikey acccess the Chicago WebRole instance doing the query.

that being said.
THe wouldnt the UserId as Partition key fragment the data all over the place?
or does Azure begin to seperate records out to servers based on performance even though I started with 1 record per partition?

I can see how a table that keeps track of a users historical bank transactions can be partitioned based on UserId
but bank balances seem to be 1 record per user.


and got the following answer.....

Usually, you choose a PartitionKey based on 2 factors.

1. Entities within the same partition are usually stored on the same server. Obviously, a search across several servers (even in the same data center) is slower than a search on a single server.

2. PartitionKey is indexed. That means if you query entities for a particular partition, you don't need to perform a table scan.

Both factors need to be considered. And sometimes, they may interdict with each other. For example, if you have too many entities in a partition, you must scan more data when you want to query a particular partition. But if you divide the partition into several small partitions, there's no guarantee that they will be stored on a single server (they may or may not)...

On the other hand, if your query doesn't contain a PartitionKey or RowKey, you're always required to do a table scan, because only PartitionKey and RowKey are indexed. So for the bank balance table, I'm not sure why the author chooses UserID as PartitionKey, but probably because most queries are done per user, so it is desired to index the UserID.

As for data centers, we do not automatically store the data in a data center that is near the user's request location. When creating the storage account, you're required to choose a data center. If you want to serve global users with great performance, you need to create serveral different storage accounts targeting different data centers.

Views: 23


You need to be a member of Azure User Groups to add comments!

Join Azure User Groups

Latest Activity

chandupatla joined Mike Holdorf's group

Dallas Azure User Group

Dallas Azure User Group - Meetings held at the Microsoft Technology Center in Las Colinas
Apr 20, 2017
Ani Arth posted an event

Live! 360 Orlando at Loew's Royal Pacific Resort

November 17, 2014 to November 21, 2014
Live! 360 brings together five conferences, and the brightest minds in IT and Dev, to explore leading edge technologies and conquer current ones. These co-located events will incorporate knowledge transfer and networking, along with out-of-this-world education and training, as you create your own custom conference, mixing and matching sessions and workshops to best suit your needs. Whether you are a developer who uses Visual Studio, SQL Server, and SharePoint;…See More
Jun 6, 2014
Ani Arth posted an event

Visual Studio Live! DC at Washington Marriott at Metro Center

October 6, 2014 to October 9, 2014
To Boldly Code where No Visual Studio Live! has ever Coded Before!That's right. We are transporting Visual Studio Live! to our nation's capital for the first time in 21 years. From Oct 6 – 9, 2014, developer, software architect, engineer and designer pioneers will gather in our country's headquarters for 4 days of cutting-edge education on the Microsoft Platform. Join us on this special journey to explore topics covering all-things WCF, ALM, Web Development, Data Management, Visual Studio and…See More
Mar 31, 2014
Ani Arth posted events
Jan 28, 2014

© 2019   Created by Azure Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service