MaxParallelism

This commit is contained in:
christianwade 2016-12-28 16:58:53 -08:00
parent 9d7cf8160f
commit 4ca18d1960
6 changed files with 30 additions and 19 deletions

View File

@ -78,10 +78,10 @@ namespace AsPartitionProcessing.SampleClient
analysisServicesDatabase: "AdventureWorks", analysisServicesDatabase: "AdventureWorks",
initialSetUp: true, initialSetUp: true,
incrementalOnline: true, incrementalOnline: true,
incrementalParallelTables: true,
integratedAuth: true, integratedAuth: true,
userName: "", userName: "",
password: "", password: "",
maxParallelism: -1,
commitTimeout: -1, commitTimeout: -1,
tableConfigurations: tableConfigurations:
new List<TableConfiguration> new List<TableConfiguration>

View File

@ -30,8 +30,8 @@ namespace AsPartitionProcessing
,[AnalysisServicesDatabase] ,[AnalysisServicesDatabase]
,[InitialSetUp] ,[InitialSetUp]
,[IncrementalOnline] ,[IncrementalOnline]
,[IncrementalParallelTables]
,[IntegratedAuth] ,[IntegratedAuth]
,[MaxParallelism]
,[CommitTimeout] ,[CommitTimeout]
,[TableConfigurationID] ,[TableConfigurationID]
,[AnalysisServicesTable] ,[AnalysisServicesTable]
@ -70,8 +70,8 @@ namespace AsPartitionProcessing
modelConfig.AnalysisServicesDatabase = Convert.ToString(reader["AnalysisServicesDatabase"]); modelConfig.AnalysisServicesDatabase = Convert.ToString(reader["AnalysisServicesDatabase"]);
modelConfig.InitialSetUp = Convert.ToBoolean(reader["InitialSetUp"]); modelConfig.InitialSetUp = Convert.ToBoolean(reader["InitialSetUp"]);
modelConfig.IncrementalOnline = Convert.ToBoolean(reader["IncrementalOnline"]); modelConfig.IncrementalOnline = Convert.ToBoolean(reader["IncrementalOnline"]);
modelConfig.IncrementalParallelTables = Convert.ToBoolean(reader["IncrementalParallelTables"]);
modelConfig.IntegratedAuth = Convert.ToBoolean(reader["IntegratedAuth"]); modelConfig.IntegratedAuth = Convert.ToBoolean(reader["IntegratedAuth"]);
modelConfig.MaxParallelism = Convert.ToInt32(reader["MaxParallelism"]);
modelConfig.CommitTimeout = Convert.ToInt32(reader["CommitTimeout"]); modelConfig.CommitTimeout = Convert.ToInt32(reader["CommitTimeout"]);
modelConfig.ConfigDatabaseConnectionInfo = connectionInfo; modelConfig.ConfigDatabaseConnectionInfo = connectionInfo;

View File

@ -33,11 +33,6 @@ namespace AsPartitionProcessing
/// </summary> /// </summary>
public bool IncrementalOnline { get; set; } public bool IncrementalOnline { get; set; }
/// <summary>
/// When initialSetUp=false, determines if separate tables are processed in parallel. Partitions within a table are always processed in parallel.
/// </summary>
public bool IncrementalParallelTables { get; set; }
/// <summary> /// <summary>
/// Should always set to true for SSAS implementations that will run under the current process account. For Azure AS, normally set to false. /// Should always set to true for SSAS implementations that will run under the current process account. For Azure AS, normally set to false.
/// </summary> /// </summary>
@ -53,6 +48,11 @@ namespace AsPartitionProcessing
/// </summary> /// </summary>
public string Password { get; set; } public string Password { get; set; }
/// <summary>
/// When initialSetUp=false, sets the maximum number of threads on which to run processing commands in parallel. -1 will not set the value.
/// </summary>
public int MaxParallelism { get; set; }
/// <summary> /// <summary>
/// Set to override of CommitTimeout server property value for the connection. -1 will not override; the server value will be used. /// Set to override of CommitTimeout server property value for the connection. -1 will not override; the server value will be used.
/// </summary> /// </summary>
@ -81,10 +81,11 @@ namespace AsPartitionProcessing
/// <param name="analysisServicesDatabase">Name of the Analysis Services database.</param> /// <param name="analysisServicesDatabase">Name of the Analysis Services database.</param>
/// <param name="initialSetUp">True for initial set up to create partitions and process them sequentially. False for incremental processing.</param> /// <param name="initialSetUp">True for initial set up to create partitions and process them sequentially. False for incremental processing.</param>
/// <param name="incrementalOnline">When initialSetUp=false, determines if processing is performed as an online operation, which may require more memory, but users can still query the model.</param> /// <param name="incrementalOnline">When initialSetUp=false, determines if processing is performed as an online operation, which may require more memory, but users can still query the model.</param>
/// <param name="incrementalParallelTables">When initialSetUp=false, determines if separate tables are processed in parallel. Partitions within a table are always processed in parallel.</param>
/// <param name="integratedAuth">Should always set to true for SSAS implementations that will run under the current process account. For Azure AS, normally set to false.</param> /// <param name="integratedAuth">Should always set to true for SSAS implementations that will run under the current process account. For Azure AS, normally set to false.</param>
/// <param name="userName">Only applies when integratedAuth=false. Used for Azure AD UPNs to connect to Azure AS.</param> /// <param name="userName">Only applies when integratedAuth=false. Used for Azure AD UPNs to connect to Azure AS.</param>
/// <param name="password">Only applies when integratedAuth=false. Used for Azure AD UPNs to connect to Azure AS.</param> /// <param name="password">Only applies when integratedAuth=false. Used for Azure AD UPNs to connect to Azure AS.</param>
/// <param name="maxParallelism">When initialSetUp=false, sets the maximum number of threads on which to run processing commands in parallel. -1 will not set the value.</param>
/// <param name="commitTimeout">Set to override of CommitTimeout server property value for the connection. -1 will not override; the server value will be used.</param>
/// <param name="tableConfigurations">Collection of partitioned tables containing configuration information.</param> /// <param name="tableConfigurations">Collection of partitioned tables containing configuration information.</param>
public ModelConfiguration( public ModelConfiguration(
int modelConfigurationID, int modelConfigurationID,
@ -92,10 +93,10 @@ namespace AsPartitionProcessing
string analysisServicesDatabase, string analysisServicesDatabase,
bool initialSetUp, bool initialSetUp,
bool incrementalOnline, bool incrementalOnline,
bool incrementalParallelTables,
bool integratedAuth, bool integratedAuth,
string userName, string userName,
string password, string password,
int maxParallelism,
int commitTimeout, int commitTimeout,
List<TableConfiguration> tableConfigurations List<TableConfiguration> tableConfigurations
) )
@ -105,10 +106,10 @@ namespace AsPartitionProcessing
AnalysisServicesDatabase = analysisServicesDatabase; AnalysisServicesDatabase = analysisServicesDatabase;
InitialSetUp = initialSetUp; InitialSetUp = initialSetUp;
IncrementalOnline = incrementalOnline; IncrementalOnline = incrementalOnline;
IncrementalParallelTables = incrementalParallelTables;
IntegratedAuth = integratedAuth; IntegratedAuth = integratedAuth;
UserName = userName; UserName = userName;
Password = password; Password = password;
MaxParallelism = maxParallelism;
CommitTimeout = commitTimeout; CommitTimeout = commitTimeout;
TableConfigurations = tableConfigurations; TableConfigurations = tableConfigurations;
ExecutionID = Guid.NewGuid().ToString(); ExecutionID = Guid.NewGuid().ToString();

View File

@ -169,8 +169,8 @@ namespace AsPartitionProcessing
} }
} }
//If processing tables sequentially (but all partitions being done in parallel), then save changes now //If initital setup, process tables sequentially
if (!_modelConfiguration.IncrementalParallelTables) if (_modelConfiguration.InitialSetUp)
{ {
LogMessage($"Save changes for table {tableConfiguration.AnalysisServicesTable} ...", true); LogMessage($"Save changes for table {tableConfiguration.AnalysisServicesTable} ...", true);
database.Model.SaveChanges(); database.Model.SaveChanges();
@ -183,12 +183,22 @@ namespace AsPartitionProcessing
LogMessage("Final operations", false); LogMessage("Final operations", false);
LogMessage(new String('-', 16), false); LogMessage(new String('-', 16), false);
if (_modelConfiguration.IncrementalParallelTables) //Save changes setting MaxParallelism if necessary
if (!_modelConfiguration.InitialSetUp)
{ {
LogMessage("Save changes ...", true); if (_modelConfiguration.MaxParallelism == -1)
database.Model.SaveChanges(); {
LogMessage("Save changes ...", true);
database.Model.SaveChanges();
}
else
{
LogMessage($"Save changes with MaxParallelism={Convert.ToString(_modelConfiguration.MaxParallelism)}...", true);
database.Model.SaveChanges(new SaveOptions() { MaxParallelism = _modelConfiguration.MaxParallelism });
}
} }
//Perform recalc if necessary
if (_modelConfiguration.InitialSetUp || (!_modelConfiguration.InitialSetUp && !_modelConfiguration.IncrementalOnline)) if (_modelConfiguration.InitialSetUp || (!_modelConfiguration.InitialSetUp && !_modelConfiguration.IncrementalOnline))
{ {
LogMessage("Recalc model to bring back online ...", true); LogMessage("Recalc model to bring back online ...", true);

View File

@ -9,8 +9,8 @@ CREATE TABLE [dbo].[ModelConfiguration](
[AnalysisServicesDatabase] [varchar](255) NOT NULL, [AnalysisServicesDatabase] [varchar](255) NOT NULL,
[InitialSetUp] [bit] NOT NULL, [InitialSetUp] [bit] NOT NULL,
[IncrementalOnline] [bit] NOT NULL, [IncrementalOnline] [bit] NOT NULL,
[IncrementalParallelTables] [bit] NOT NULL,
[IntegratedAuth] [bit] NOT NULL, [IntegratedAuth] [bit] NOT NULL,
[MaxParallelism] [int] NOT NULL,
[CommitTimeout] [int] NOT NULL, [CommitTimeout] [int] NOT NULL,
CONSTRAINT [PK_ModelConfiguration] PRIMARY KEY CLUSTERED CONSTRAINT [PK_ModelConfiguration] PRIMARY KEY CLUSTERED
( (
@ -105,8 +105,8 @@ SELECT m.[ModelConfigurationID]
,m.[AnalysisServicesDatabase] ,m.[AnalysisServicesDatabase]
,m.[InitialSetUp] ,m.[InitialSetUp]
,m.[IncrementalOnline] ,m.[IncrementalOnline]
,m.[IncrementalParallelTables]
,m.[IntegratedAuth] ,m.[IntegratedAuth]
,m.[MaxParallelism]
,m.[CommitTimeout] ,m.[CommitTimeout]
,t.[TableConfigurationID] ,t.[TableConfigurationID]
,t.[AnalysisServicesTable] ,t.[AnalysisServicesTable]

View File

@ -5,8 +5,8 @@ VALUES(
,'AdventureWorks' --[AnalysisServicesDatabase] ,'AdventureWorks' --[AnalysisServicesDatabase]
,1 --[InitialSetUp] ,1 --[InitialSetUp]
,1 --[IncrementalOnline] ,1 --[IncrementalOnline]
,1 --[IncrementalParallelTables]
,1 --[IntegratedAuth] ,1 --[IntegratedAuth]
,-1 --[MaxParallelism]
,-1 --[CommitTimeout] ,-1 --[CommitTimeout]
); );