本文整理汇总了C#中Orleans.Runtime.Configuration.NodeConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# NodeConfiguration类的具体用法?C# NodeConfiguration怎么用?C# NodeConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeConfiguration类属于Orleans.Runtime.Configuration命名空间,在下文中一共展示了NodeConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageCenter
public MessageCenter(SiloInitializationParameters silo, NodeConfiguration nodeConfig, IMessagingConfiguration config, ISiloPerformanceMetrics metrics = null)
{
this.Initialize(silo.SiloAddress.Endpoint, nodeConfig.Generation, config, metrics);
if (nodeConfig.IsGatewayNode)
{
this.InstallGateway(nodeConfig.ProxyGatewayEndpoint);
}
}
示例2: Init
private void Init()
{
Globals = new GlobalConfiguration();
Defaults = new NodeConfiguration();
Overrides = new Dictionary<string, NodeConfiguration>();
overrideXml = new Dictionary<string, string>();
SourceFile = "";
IsRunningAsUnitTest = false;
}
示例3: SiloPerformanceMetrics
internal SiloPerformanceMetrics(RuntimeStatisticsGroup runtime, NodeConfiguration cfg = null)
{
runtimeStats = runtime;
reportFrequency = TimeSpan.Zero;
overloadLatched = false;
overloadValue = false;
NodeConfig = cfg ?? new NodeConfiguration();
StringValueStatistic.FindOrCreate(StatisticNames.RUNTIME_IS_OVERLOADED, () => IsOverloaded.ToString());
}
示例4: Create
/// <summary>Creates a new silo in a remote app domain and returns a handle to it.</summary>
public static SiloHandle Create(string siloName, Silo.SiloType type, ClusterConfiguration config, NodeConfiguration nodeConfiguration, Dictionary<string, GeneratedAssembly> additionalAssemblies)
{
AppDomainSetup setup = GetAppDomainSetupInfo();
var appDomain = AppDomain.CreateDomain(siloName, null, setup);
// Load each of the additional assemblies.
AppDomainSiloHost.CodeGeneratorOptimizer optimizer = null;
foreach (var assembly in additionalAssemblies.Where(asm => asm.Value != null))
{
if (optimizer == null)
{
optimizer =
(AppDomainSiloHost.CodeGeneratorOptimizer)
appDomain.CreateInstanceAndUnwrap(
typeof(AppDomainSiloHost.CodeGeneratorOptimizer).Assembly.FullName, typeof(AppDomainSiloHost.CodeGeneratorOptimizer).FullName, false,
BindingFlags.Default,
null,
null,
CultureInfo.CurrentCulture,
new object[] { });
}
optimizer.AddCachedAssembly(assembly.Key, assembly.Value);
}
var args = new object[] { siloName, type, config };
var siloHost = (AppDomainSiloHost)appDomain.CreateInstanceAndUnwrap(
typeof(AppDomainSiloHost).Assembly.FullName, typeof(AppDomainSiloHost).FullName, false,
BindingFlags.Default, null, args, CultureInfo.CurrentCulture,
new object[] { });
appDomain.UnhandledException += ReportUnobservedException;
appDomain.DoCallBack(RegisterPerfCountersTelemetryConsumer);
siloHost.Start();
var retValue = new AppDomainSiloHandle
{
Name = siloName,
SiloHost = siloHost,
NodeConfiguration = nodeConfiguration,
SiloAddress = siloHost.SiloAddress,
Type = type,
AppDomain = appDomain,
additionalAssemblies = additionalAssemblies,
#if !NETSTANDARD_TODO
AppDomainTestHook = siloHost.AppDomainTestHook,
#endif
};
retValue.ImportGeneratedAssemblies();
return retValue;
}
示例5: SiloStatisticsManager
internal SiloStatisticsManager(GlobalConfiguration globalConfig, NodeConfiguration nodeConfig)
{
MessagingStatisticsGroup.Init(true);
MessagingProcessingStatisticsGroup.Init();
NetworkingStatisticsGroup.Init(true);
ApplicationRequestsStatisticsGroup.Init(globalConfig.ResponseTimeout);
SchedulerStatisticsGroup.Init();
StorageStatisticsGroup.Init();
runtimeStats = new RuntimeStatisticsGroup();
logStatistics = new LogStatistics(nodeConfig.StatisticsLogWriteInterval, true);
MetricsTable = new SiloPerformanceMetrics(runtimeStats, nodeConfig);
perfCountersPublisher = new PerfCountersStatistics(nodeConfig.StatisticsPerfCountersWriteInterval);
}
示例6: OrleansPerformanceCounterInstaller
/// <summary>
/// Constructors -- Registers Orleans system performance counters,
/// plus any grain-specific activation conters that can be detected when this installer is run.
/// </summary>
public OrleansPerformanceCounterInstaller()
{
SerializationManager.InitializeForTesting();
Trace.Listeners.Clear();
var cfg = new NodeConfiguration { TraceFilePattern = null, TraceToConsole = false };
LogManager.Initialize(cfg);
consumer = new OrleansPerfCounterTelemetryConsumer();
if (GrainTypeManager.Instance == null)
{
var loader = new SiloAssemblyLoader(new Dictionary<string, SearchOption>());
var typeManager = new GrainTypeManager(false, null, loader); // We shouldn't need GrainFactory in this case
GrainTypeManager.Instance.Start(false);
}
}
示例7: OrleansPerformanceCounterInstaller
/// <summary>
/// Constructors -- Registers Orleans system performance counters,
/// plus any grain-specific activation conters that can be detected when this installer is run.
/// </summary>
public OrleansPerformanceCounterInstaller()
{
SerializationTestEnvironment.Initialize();
Trace.Listeners.Clear();
var cfg = new NodeConfiguration { TraceFilePattern = null, TraceToConsole = false };
LogManager.Initialize(cfg);
consumer = new OrleansPerfCounterTelemetryConsumer();
if (GrainTypeManager.Instance == null)
{
var loader = new SiloAssemblyLoader(new Dictionary<string, SearchOption>());
var typeManager = new GrainTypeManager(false, loader, new RandomPlacementDefaultStrategy());
GrainTypeManager.Instance.Start(false);
}
}
示例8: ApplicationRequestsStatisticsGroup_Perf
public void ApplicationRequestsStatisticsGroup_Perf()
{
var config = new NodeConfiguration();
config.StatisticsCollectionLevel = StatisticsLevel.Info;
StatisticsCollector.Initialize(config);
ApplicationRequestsStatisticsGroup.Init(TimeSpan.FromSeconds(30));
const long nIterations = 10000000;
const int nValues = 1000;
var rand = new Random();
var times = new TimeSpan[nValues];
for (int i = 0; i < 1000; i++)
{
times[i] = TimeSpan.FromMilliseconds(rand.Next(30000));
}
Stopwatch sw = Stopwatch.StartNew();
var tasks = new List<Task>();
for (int j = 0; j < 10; j++)
{
//int capture = j;
tasks.Add(Task.Run(() =>
{
//long tenPercent = nIterations/10;
for (long i = 0; i < nIterations; i++)
{
ApplicationRequestsStatisticsGroup.OnAppRequestsEnd(times[i % nValues]);
//if (i % tenPercent == 0)
// Console.WriteLine("Thread {0}: {1}% done", capture, i * 100 / nIterations);
}
}));
}
Task.WhenAll(tasks).Wait();
sw.Stop();
Console.WriteLine("Done.");
Console.WriteLine(sw.ElapsedMilliseconds);
}
示例9: SetSiloMetricsTableDataManager
internal async Task SetSiloMetricsTableDataManager(Silo silo, NodeConfiguration nodeConfig)
{
bool useAzureTable;
bool useExternalMetricsProvider = ShouldUseExternalMetricsProvider(silo, nodeConfig, out useAzureTable);
if (useExternalMetricsProvider)
{
var extType = nodeConfig.StatisticsProviderName;
var metricsProvider = silo.StatisticsProviderManager.GetProvider(extType);
var metricsDataPublisher = metricsProvider as ISiloMetricsDataPublisher;
if (metricsDataPublisher == null)
{
var msg = String.Format("Trying to create {0} as a silo metrics publisher, but the provider is not available."
+ " Expected type = {1} Actual type = {2}",
extType, typeof(IStatisticsPublisher), metricsProvider.GetType());
throw new InvalidOperationException(msg);
}
var configurableMetricsDataPublisher = metricsDataPublisher as IConfigurableSiloMetricsDataPublisher;
if (configurableMetricsDataPublisher != null)
{
var gateway = nodeConfig.IsGatewayNode ? nodeConfig.ProxyGatewayEndpoint : null;
configurableMetricsDataPublisher.AddConfiguration(
silo.GlobalConfig.DeploymentId, true, silo.Name, silo.SiloAddress, gateway, nodeConfig.DNSHostName);
}
MetricsTable.MetricsDataPublisher = metricsDataPublisher;
}
else if (useAzureTable)
{
// Hook up to publish silo metrics to Azure storage table
var gateway = nodeConfig.IsGatewayNode ? nodeConfig.ProxyGatewayEndpoint : null;
var metricsDataPublisher = AssemblyLoader.LoadAndCreateInstance<ISiloMetricsDataPublisher>(Constants.ORLEANS_AZURE_UTILS_DLL, logger);
await metricsDataPublisher.Init(silo.GlobalConfig.DeploymentId, silo.GlobalConfig.DataConnectionString, silo.SiloAddress, silo.Name, gateway, nodeConfig.DNSHostName);
MetricsTable.MetricsDataPublisher = metricsDataPublisher;
}
// else no metrics
}
示例10: Init
public static void Init(ClusterConfiguration config, NodeConfiguration nodeConfig)
{
// Consider adding a config parameter for this
maxRequestProcessingTime = config.Globals.ResponseTimeout.Multiply(5);
nodeConfiguration = nodeConfig;
}
示例11: NodeConfiguration
public NodeConfiguration(NodeConfiguration other)
{
creationTimestamp = other.creationTimestamp;
SiloName = other.SiloName;
HostNameOrIPAddress = other.HostNameOrIPAddress;
DNSHostName = other.DNSHostName;
Port = other.Port;
Generation = other.Generation;
AddressType = other.AddressType;
ProxyGatewayEndpoint = other.ProxyGatewayEndpoint;
MaxActiveThreads = other.MaxActiveThreads;
DelayWarningThreshold = other.DelayWarningThreshold;
ActivationSchedulingQuantum = other.ActivationSchedulingQuantum;
TurnWarningLengthThreshold = other.TurnWarningLengthThreshold;
InjectMoreWorkerThreads = other.InjectMoreWorkerThreads;
LoadSheddingEnabled = other.LoadSheddingEnabled;
LoadSheddingLimit = other.LoadSheddingLimit;
DefaultTraceLevel = other.DefaultTraceLevel;
TraceLevelOverrides = new List<Tuple<string, Severity>>(other.TraceLevelOverrides);
TraceToConsole = other.TraceToConsole;
TraceFilePattern = other.TraceFilePattern;
TraceFileName = other.TraceFileName;
LargeMessageWarningThreshold = other.LargeMessageWarningThreshold;
PropagateActivityId = other.PropagateActivityId;
BulkMessageLimit = other.BulkMessageLimit;
StatisticsProviderName = other.StatisticsProviderName;
StatisticsMetricsTableWriteInterval = other.StatisticsMetricsTableWriteInterval;
StatisticsPerfCountersWriteInterval = other.StatisticsPerfCountersWriteInterval;
StatisticsLogWriteInterval = other.StatisticsLogWriteInterval;
StatisticsWriteLogStatisticsToTable = other.StatisticsWriteLogStatisticsToTable;
StatisticsCollectionLevel = other.StatisticsCollectionLevel;
LimitManager = new LimitManager(other.LimitManager); // Shallow copy
Subnet = other.Subnet;
MinDotNetThreadPoolSize = other.MinDotNetThreadPoolSize;
Expect100Continue = other.Expect100Continue;
DefaultConnectionLimit = other.DefaultConnectionLimit;
UseNagleAlgorithm = other.UseNagleAlgorithm;
StartupTypeName = other.StartupTypeName;
AdditionalAssemblyDirectories = other.AdditionalAssemblyDirectories;
}
示例12: GetConfigurationForNode
/// <summary>
/// Returns the configuration for a given silo.
/// </summary>
/// <param name="name">Silo name.</param>
/// <returns>NodeConfiguration associated with the specified silo.</returns>
public NodeConfiguration GetConfigurationForNode(string name)
{
NodeConfiguration n;
if (Overrides.TryGetValue(name, out n)) return n;
n = new NodeConfiguration(Defaults) {SiloName = name};
InitNodeSettingsFromGlobals(n);
Overrides[name] = n;
return n;
}
示例13: InitNodeSettingsFromGlobals
private void InitNodeSettingsFromGlobals(NodeConfiguration n)
{
if (n.Endpoint.Equals(this.PrimaryNode)) n.IsPrimaryNode = true;
if (Globals.SeedNodes.Contains(n.Endpoint)) n.IsSeedNode = true;
}
示例14: CalculateOverrides
private void CalculateOverrides()
{
if (Globals.LivenessEnabled &&
Globals.LivenessType == GlobalConfiguration.LivenessProviderType.NotSpecified)
{
if (Globals.UseSqlSystemStore)
{
Globals.LivenessType = GlobalConfiguration.LivenessProviderType.SqlServer;
}
else if (Globals.UseAzureSystemStore)
{
Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
}
else if (Globals.UseZooKeeperSystemStore)
{
Globals.LivenessType = GlobalConfiguration.LivenessProviderType.ZooKeeper;
}
else
{
Globals.LivenessType = GlobalConfiguration.LivenessProviderType.MembershipTableGrain;
}
}
if (Globals.UseMockReminderTable)
{
Globals.SetReminderServiceType(GlobalConfiguration.ReminderServiceProviderType.MockTable);
}
else if (Globals.ReminderServiceType == GlobalConfiguration.ReminderServiceProviderType.NotSpecified)
{
if (Globals.UseSqlSystemStore)
{
Globals.SetReminderServiceType(GlobalConfiguration.ReminderServiceProviderType.SqlServer);
}
else if (Globals.UseAzureSystemStore)
{
Globals.SetReminderServiceType(GlobalConfiguration.ReminderServiceProviderType.AzureTable);
}
else if (Globals.UseZooKeeperSystemStore)
{
Globals.SetReminderServiceType(GlobalConfiguration.ReminderServiceProviderType.Disabled);
}
else
{
Globals.SetReminderServiceType(GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain);
}
}
foreach (var p in overrideXml)
{
var n = new NodeConfiguration(Defaults);
n.Load(ParseXml(new StringReader(p.Value)));
InitNodeSettingsFromGlobals(n);
Overrides[n.SiloName] = n;
}
}
示例15: Start
internal void Start(NodeConfiguration config)
{
perfCountersPublisher.Start();
logStatistics.Start();
runtimeStats.Start();
// Start performance metrics publisher
MetricsTable.MetricsTableWriteInterval = config.StatisticsMetricsTableWriteInterval;
}