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",
initialSetUp: true,
incrementalOnline: true,
incrementalParallelTables: true,
integratedAuth: true,
userName: "",
password: "",
maxParallelism: -1,
commitTimeout: -1,
tableConfigurations:
new List<TableConfiguration>

View File

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

View File

@ -33,11 +33,6 @@ namespace AsPartitionProcessing
/// </summary>
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>
/// Should always set to true for SSAS implementations that will run under the current process account. For Azure AS, normally set to false.
/// </summary>
@ -53,6 +48,11 @@ namespace AsPartitionProcessing
/// </summary>
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>
/// Set to override of CommitTimeout server property value for the connection. -1 will not override; the server value will be used.
/// </summary>
@ -81,10 +81,11 @@ namespace AsPartitionProcessing
/// <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="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="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="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>
public ModelConfiguration(
int modelConfigurationID,
@ -92,10 +93,10 @@ namespace AsPartitionProcessing
string analysisServicesDatabase,
bool initialSetUp,
bool incrementalOnline,
bool incrementalParallelTables,
bool integratedAuth,
string userName,
string password,
int maxParallelism,
int commitTimeout,
List<TableConfiguration> tableConfigurations
)
@ -105,10 +106,10 @@ namespace AsPartitionProcessing
AnalysisServicesDatabase = analysisServicesDatabase;
InitialSetUp = initialSetUp;
IncrementalOnline = incrementalOnline;
IncrementalParallelTables = incrementalParallelTables;
IntegratedAuth = integratedAuth;
UserName = userName;
Password = password;
MaxParallelism = maxParallelism;
CommitTimeout = commitTimeout;
TableConfigurations = tableConfigurations;
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 (!_modelConfiguration.IncrementalParallelTables)
//If initital setup, process tables sequentially
if (_modelConfiguration.InitialSetUp)
{
LogMessage($"Save changes for table {tableConfiguration.AnalysisServicesTable} ...", true);
database.Model.SaveChanges();
@ -183,12 +183,22 @@ namespace AsPartitionProcessing
LogMessage("Final operations", false);
LogMessage(new String('-', 16), false);
if (_modelConfiguration.IncrementalParallelTables)
//Save changes setting MaxParallelism if necessary
if (!_modelConfiguration.InitialSetUp)
{
LogMessage("Save changes ...", true);
database.Model.SaveChanges();
if (_modelConfiguration.MaxParallelism == -1)
{
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))
{
LogMessage("Recalc model to bring back online ...", true);

View File

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

View File

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