Showing posts with label partitioning. Show all posts
Showing posts with label partitioning. Show all posts

Wednesday, 9 March 2016

Partitioning a Database

Partitioning means breaking up a database into sections - to make it more performant, easier to manage or for load balancing.

Partitioning Criteria (Key-Partition Pairs)

RDBMS's support a range of partitioning criteria. 

They take a partitioning key and assign a partition based on certain criteria. 

Example criteria are:
  • Hash partitioning - membership of a partition is determined by the value of a hash function. This function might return numbers between 0 to 4, for example, if there are 5 partitions.
  • Range partitioning - selects partition if partitioning key lies within a given range. For example, if you have a list of countries, you may split on a country with the letter M, say Malawi, Malta or the Maldives.
  • List partitioning - the partition is assigned a list of values. If the row satisfies the criteria (e.g. Country column is contained in List A) then it goes into, say, partition A.
  • Composite partitioning - hybrid of the above approaches.
Means of Partitioning

"Horizontal partitioning" or "horizontal sharding" involves putting different rows into different tables. A view with a union may be used to create a unified view.

"Vertical partitioning" involves taking normalisation to the next level. It involves creating tables with fewer columns and using additional tables to store the extra columns - a bit like normalisation, except vertical partitioning can be effected even when the tables are normalised. Infrequently used columns might be stored on a different device. This type of partitioning is also known as "row splitting" - the row is split by the columns.

Sunday, 29 September 2013

AppDomains in .NET and why Threads are Special

AppDomains in .NET and Their Relationship to Processes, Assemblies and Threads

An Application Domain , or AppDomain, in .NET, provides a boundary wall between running .NET applications, to enhance reliability and security. They are like discrete pinball machines.

AppDomains and Processes; Plus Points of Partitioning Arrangement

AppDomains are structured such that several of these domains may be run in a single process; in math terms, the process space is partitioned into AppDomain space i.e. can have several of these non-intersecting AppDomains that make up the process space. This avoids the "resident" applications from the overhead of making inter-process calls when they need to communicate (everyone is in the same process "locale").

AppDomains and Assemblies

A .NET assembly must be loaded into an AppDomain in order to be able to run. A typical application will load several assemblies into a single AppDomain.

AppDomains and Threads

A thread must run in an AppDomain, but has the ability to cross into other AppDomains. They are bit like electrons within atoms.(Thread.GetDomain will tell you what AppDomain a thread is currently running in).