Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 808A6200CB0 for ; Thu, 8 Jun 2017 14:32:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7F6D2160BE7; Thu, 8 Jun 2017 12:32:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AB9F9160BE8 for ; Thu, 8 Jun 2017 14:32:57 +0200 (CEST) Received: (qmail 17939 invoked by uid 500); 8 Jun 2017 12:32:56 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 17833 invoked by uid 99); 8 Jun 2017 12:32:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2017 12:32:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9222CF4A4E; Thu, 8 Jun 2017 12:32:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: akuznetsov@apache.org To: commits@ignite.apache.org Date: Thu, 08 Jun 2017 12:33:20 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [27/43] ignite git commit: IGNITE-5400 .NET: IgniteConfiguration.SqlConnectorConfiguration archived-at: Thu, 08 Jun 2017 12:32:59 -0000 IGNITE-5400 .NET: IgniteConfiguration.SqlConnectorConfiguration This closes #2085 Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86d0049b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86d0049b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86d0049b Branch: refs/heads/ignite-5414 Commit: 86d0049b7a248cf6f9fe2532b63d0e22baaa659e Parents: 56768a2 Author: Pavel Tupitsyn Authored: Wed Jun 7 12:08:34 2017 +0300 Committer: Pavel Tupitsyn Committed: Wed Jun 7 12:08:34 2017 +0300 ---------------------------------------------------------------------- .../utils/PlatformConfigurationUtils.java | 86 ++++++++++ .../IgniteConfigurationSerializerTest.cs | 26 ++- .../IgniteConfigurationTest.cs | 56 +++++++ .../Apache.Ignite.Core.csproj | 2 + .../Configuration/Package-Info.cs | 26 +++ .../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++++++++++++ .../Apache.Ignite.Core/IgniteConfiguration.cs | 164 +++++++++++++++++++ .../IgniteConfigurationSection.xsd | 92 +++++++++++ .../Common/IgniteConfigurationXmlSerializer.cs | 10 ++ 9 files changed, 620 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java index 7f23b85..40dafbd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java @@ -58,6 +58,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.MemoryConfiguration; import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.configuration.SqlConnectorConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.binary.BinaryRawReaderEx; import org.apache.ignite.internal.binary.BinaryRawWriterEx; @@ -562,6 +563,26 @@ public class PlatformConfigurationUtils { if (in.readBoolean()) cfg.setClientFailureDetectionTimeout(in.readLong()); + // Thread pools. + if (in.readBoolean()) + cfg.setPublicThreadPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setStripedPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setServiceThreadPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setSystemThreadPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setAsyncCallbackPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setManagementThreadPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setDataStreamerThreadPoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setUtilityCachePoolSize(in.readInt()); + if (in.readBoolean()) + cfg.setQueryThreadPoolSize(in.readInt()); + readCacheConfigurations(in, cfg); readDiscoveryConfiguration(in, cfg); @@ -650,6 +671,9 @@ public class PlatformConfigurationUtils { if (in.readBoolean()) cfg.setMemoryConfiguration(readMemoryConfiguration(in)); + if (in.readBoolean()) + cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in)); + readPluginConfiguration(cfg, in); } @@ -978,6 +1002,26 @@ public class PlatformConfigurationUtils { w.writeBoolean(true); w.writeLong(cfg.getClientFailureDetectionTimeout()); + // Thread pools. + w.writeBoolean(true); + w.writeInt(cfg.getPublicThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getStripedPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getServiceThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getSystemThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getAsyncCallbackPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getManagementThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getDataStreamerThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getUtilityCacheThreadPoolSize()); + w.writeBoolean(true); + w.writeInt(cfg.getQueryThreadPoolSize()); + CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration(); if (cacheCfg != null) { @@ -1084,6 +1128,8 @@ public class PlatformConfigurationUtils { writeMemoryConfiguration(w, cfg.getMemoryConfiguration()); + writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration()); + w.writeString(cfg.getIgniteHome()); w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit()); @@ -1371,7 +1417,47 @@ public class PlatformConfigurationUtils { } } + /** + * Reads the SQL connector configuration. + * + * @param in Reader. + * @return Config. + */ + private static SqlConnectorConfiguration readSqlConnectorConfiguration(BinaryRawReader in) { + return new SqlConnectorConfiguration() + .setHost(in.readString()) + .setPort(in.readInt()) + .setPortRange(in.readInt()) + .setSocketSendBufferSize(in.readInt()) + .setSocketReceiveBufferSize(in.readInt()) + .setTcpNoDelay(in.readBoolean()) + .setMaxOpenCursorsPerConnection(in.readInt()) + .setThreadPoolSize(in.readInt()); + } + + /** + * Writes the SQL connector configuration. + * + * @param w Writer. + */ + private static void writeSqlConnectorConfiguration(BinaryRawWriter w, SqlConnectorConfiguration cfg) { + assert w != null; + + if (cfg != null) { + w.writeBoolean(true); + w.writeString(cfg.getHost()); + w.writeInt(cfg.getPort()); + w.writeInt(cfg.getPortRange()); + w.writeInt(cfg.getSocketSendBufferSize()); + w.writeInt(cfg.getSocketReceiveBufferSize()); + w.writeBoolean(cfg.isTcpNoDelay()); + w.writeInt(cfg.getMaxOpenCursorsPerConnection()); + w.writeInt(cfg.getThreadPoolSize()); + } else { + w.writeBoolean(false); + } + } /** * Private constructor. http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs index c726f85..7ba4ed2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -40,6 +40,7 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Cache.Store; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Communication.Tcp; + using Apache.Ignite.Core.Configuration; using Apache.Ignite.Core.DataStructures.Configuration; using Apache.Ignite.Core.Deployment; using Apache.Ignite.Core.Discovery.Tcp; @@ -140,6 +141,7 @@ namespace Apache.Ignite.Core.Tests + "; var cfg = IgniteConfiguration.FromXml(xml); @@ -278,6 +280,17 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval); Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode); + + var sql = cfg.SqlConnectorConfiguration; + Assert.IsNotNull(sql); + Assert.AreEqual("bar", sql.Host); + Assert.AreEqual(10, sql.Port); + Assert.AreEqual(11, sql.PortRange); + Assert.AreEqual(12, sql.SocketSendBufferSize); + Assert.AreEqual(13, sql.SocketReceiveBufferSize); + Assert.IsTrue(sql.TcpNoDelay); + Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection); + Assert.AreEqual(15, sql.ThreadPoolSize); } /// @@ -839,7 +852,18 @@ namespace Apache.Ignite.Core.Tests } } }, - PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain + PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain, + SqlConnectorConfiguration = new SqlConnectorConfiguration + { + Host = "foo", + Port = 2, + PortRange = 3, + MaxOpenCursorsPerConnection = 4, + SocketReceiveBufferSize = 5, + SocketSendBufferSize = 6, + TcpNoDelay = false, + ThreadPoolSize = 7 + } }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs index 80b271d..9d19a23 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests using Apache.Ignite.Core.Cache.Eviction; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Communication.Tcp; + using Apache.Ignite.Core.Configuration; using Apache.Ignite.Core.DataStructures.Configuration; using Apache.Ignite.Core.Discovery.Tcp; using Apache.Ignite.Core.Discovery.Tcp.Multicast; @@ -81,6 +82,7 @@ namespace Apache.Ignite.Core.Tests CheckDefaultValueAttributes(new MemoryEventStorageSpi()); CheckDefaultValueAttributes(new MemoryConfiguration()); CheckDefaultValueAttributes(new MemoryPolicyConfiguration()); + CheckDefaultValueAttributes(new SqlConnectorConfiguration()); } /// @@ -173,6 +175,16 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout); Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout); + Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize); + Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize); + Assert.AreEqual(cfg.ServiceThreadPoolSize, resCfg.ServiceThreadPoolSize); + Assert.AreEqual(cfg.SystemThreadPoolSize, resCfg.SystemThreadPoolSize); + Assert.AreEqual(cfg.AsyncCallbackThreadPoolSize, resCfg.AsyncCallbackThreadPoolSize); + Assert.AreEqual(cfg.ManagementThreadPoolSize, resCfg.ManagementThreadPoolSize); + Assert.AreEqual(cfg.DataStreamerThreadPoolSize, resCfg.DataStreamerThreadPoolSize); + Assert.AreEqual(cfg.UtilityCacheThreadPoolSize, resCfg.UtilityCacheThreadPoolSize); + Assert.AreEqual(cfg.QueryThreadPoolSize, resCfg.QueryThreadPoolSize); + var binCfg = cfg.BinaryConfiguration; Assert.IsFalse(binCfg.CompactFooter); @@ -218,6 +230,18 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(plc.Name, resPlc.Name); Assert.AreEqual(plc.SwapFilePath, resPlc.SwapFilePath); } + + var sql = cfg.SqlConnectorConfiguration; + var resSql = resCfg.SqlConnectorConfiguration; + + Assert.AreEqual(sql.Host, resSql.Host); + Assert.AreEqual(sql.Port, resSql.Port); + Assert.AreEqual(sql.PortRange, resSql.PortRange); + Assert.AreEqual(sql.MaxOpenCursorsPerConnection, resSql.MaxOpenCursorsPerConnection); + Assert.AreEqual(sql.SocketReceiveBufferSize, resSql.SocketReceiveBufferSize); + Assert.AreEqual(sql.SocketSendBufferSize, resSql.SocketSendBufferSize); + Assert.AreEqual(sql.TcpNoDelay, resSql.TcpNoDelay); + Assert.AreEqual(sql.ThreadPoolSize, resSql.ThreadPoolSize); } } @@ -455,6 +479,17 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout); Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout, cfg.ClientFailureDetectionTimeout); + + // Thread pools. + Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.PublicThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.StripedThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.ServiceThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.SystemThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.AsyncCallbackThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.DataStreamerThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.UtilityCacheThreadPoolSize); + Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.QueryThreadPoolSize); } /// @@ -466,6 +501,7 @@ namespace Apache.Ignite.Core.Tests var props = obj.GetType().GetProperties(); foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" && + !p.Name.Contains("ThreadPoolSize") && !(p.Name == "MaxSize" && p.DeclaringType == typeof(MemoryPolicyConfiguration)))) { @@ -615,6 +651,26 @@ namespace Apache.Ignite.Core.Tests MetricsEnabled = true } } + }, + PublicThreadPoolSize = 3, + StripedThreadPoolSize = 5, + ServiceThreadPoolSize = 6, + SystemThreadPoolSize = 7, + AsyncCallbackThreadPoolSize = 8, + ManagementThreadPoolSize = 9, + DataStreamerThreadPoolSize = 10, + UtilityCacheThreadPoolSize = 11, + QueryThreadPoolSize = 12, + SqlConnectorConfiguration = new SqlConnectorConfiguration + { + Host = "127.0.0.2", + Port = 1081, + PortRange = 3, + SocketReceiveBufferSize = 2048, + MaxOpenCursorsPerConnection = 5, + ThreadPoolSize = 4, + TcpNoDelay = false, + SocketSendBufferSize = 4096 } }; } http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj index b37b685..82bb5ca 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj @@ -98,6 +98,8 @@ + + http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs new file mode 100644 index 0000000..f2dfb53 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs @@ -0,0 +1,26 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma warning disable 1587 // invalid XML comment + +/// +/// General configuration APIs. +/// +namespace Apache.Ignite.Core.Configuration +{ + // No-op. +} http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs new file mode 100644 index 0000000..0a9b7e5 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Configuration +{ + using System.ComponentModel; + using System.Diagnostics; + using Apache.Ignite.Core.Binary; + + /// + /// SQL connector configuration (for ODBC and JDBC). + /// + public class SqlConnectorConfiguration + { + /// + /// Default port. + /// + public const int DefaultPort = 10800; + + /// + /// Default port range. + /// + public const int DefaultPortRange = 100; + + /// + /// Default socket buffer size. + /// + public const int DefaultSocketBufferSize = 0; + + /// + /// Default value of property. + /// + public const bool DefaultTcpNoDelay = true; + + /// + /// Default maximum number of open cursors per connection. + /// + public const int DefaultMaxOpenCursorsPerConnection = 128; + + /// + /// Default SQL connector thread pool size. + /// + public static readonly int DefaultThreadPoolSize = IgniteConfiguration.DefaultThreadPoolSize; + + /// + /// Initializes a new instance of the class. + /// + public SqlConnectorConfiguration() + { + Port = DefaultPort; + PortRange = DefaultPortRange; + SocketSendBufferSize = DefaultSocketBufferSize; + SocketReceiveBufferSize = DefaultSocketBufferSize; + TcpNoDelay = DefaultTcpNoDelay; + MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection; + ThreadPoolSize = DefaultThreadPoolSize; + } + + /// + /// Initializes a new instance of the class. + /// + internal SqlConnectorConfiguration(IBinaryRawReader reader) + { + Debug.Assert(reader != null); + + Host = reader.ReadString(); + Port = reader.ReadInt(); + PortRange = reader.ReadInt(); + SocketSendBufferSize = reader.ReadInt(); + SocketReceiveBufferSize = reader.ReadInt(); + TcpNoDelay = reader.ReadBoolean(); + MaxOpenCursorsPerConnection = reader.ReadInt(); + ThreadPoolSize = reader.ReadInt(); + } + + /// + /// Writes to the specified writer. + /// + internal void Write(IBinaryRawWriter writer) + { + Debug.Assert(writer != null); + + writer.WriteString(Host); + writer.WriteInt(Port); + writer.WriteInt(PortRange); + writer.WriteInt(SocketSendBufferSize); + writer.WriteInt(SocketReceiveBufferSize); + writer.WriteBoolean(TcpNoDelay); + writer.WriteInt(MaxOpenCursorsPerConnection); + writer.WriteInt(ThreadPoolSize); + } + + /// + /// Gets or sets the host. + /// + public string Host { get; set; } + + /// + /// Gets or sets the port. + /// + [DefaultValue(DefaultPort)] + public int Port { get; set; } + + /// + /// Gets or sets the port range. + /// + [DefaultValue(DefaultPortRange)] + public int PortRange { get; set; } + + /// + /// Gets or sets the size of the socket send buffer. When set to 0, operating system default is used. + /// + [DefaultValue(DefaultSocketBufferSize)] + public int SocketSendBufferSize { get; set; } + + /// + /// Gets or sets the size of the socket receive buffer. When set to 0, operating system default is used. + /// + [DefaultValue(DefaultSocketBufferSize)] + public int SocketReceiveBufferSize { get; set; } + + /// + /// Gets or sets the value for TCP_NODELAY socket option. Each + /// socket will be opened using provided value. + /// + /// Setting this option to true disables Nagle's algorithm + /// for socket decreasing latency and delivery time for small messages. + /// + /// For systems that work under heavy network load it is advisable to set this value to false. + /// + [DefaultValue(DefaultTcpNoDelay)] + public bool TcpNoDelay { get; set; } + + /// + /// Gets or sets the maximum open cursors per connection. + /// + [DefaultValue(DefaultMaxOpenCursorsPerConnection)] + public int MaxOpenCursorsPerConnection { get; set; } + + /// + /// Gets or sets the size of the thread pool. + /// + public int ThreadPoolSize { get; set; } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs index 8fab8a4..40bab15 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs @@ -34,6 +34,7 @@ namespace Apache.Ignite.Core using Apache.Ignite.Core.Communication; using Apache.Ignite.Core.Communication.Tcp; using Apache.Ignite.Core.Compute; + using Apache.Ignite.Core.Configuration; using Apache.Ignite.Core.DataStructures.Configuration; using Apache.Ignite.Core.Deployment; using Apache.Ignite.Core.Discovery; @@ -103,6 +104,16 @@ namespace Apache.Ignite.Core /// public static readonly TimeSpan DefaultClientFailureDetectionTimeout = TimeSpan.FromSeconds(30); + /// + /// Default thread pool size. + /// + public static readonly int DefaultThreadPoolSize = Math.Max(8, Environment.ProcessorCount); + + /// + /// Default management thread pool size. + /// + public const int DefaultManagementThreadPoolSize = 4; + /** */ private TimeSpan? _metricsExpireTime; @@ -139,6 +150,33 @@ namespace Apache.Ignite.Core /** */ private TimeSpan? _clientFailureDetectionTimeout; + /** */ + private int? _publicThreadPoolSize; + + /** */ + private int? _stripedThreadPoolSize; + + /** */ + private int? _serviceThreadPoolSize; + + /** */ + private int? _systemThreadPoolSize; + + /** */ + private int? _asyncCallbackThreadPoolSize; + + /** */ + private int? _managementThreadPoolSize; + + /** */ + private int? _dataStreamerThreadPoolSize; + + /** */ + private int? _utilityCacheThreadPoolSize; + + /** */ + private int? _queryThreadPoolSize; + /// /// Default network retry count. /// @@ -222,6 +260,17 @@ namespace Apache.Ignite.Core writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout); writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout); + // Thread pools + writer.WriteIntNullable(_publicThreadPoolSize); + writer.WriteIntNullable(_stripedThreadPoolSize); + writer.WriteIntNullable(_serviceThreadPoolSize); + writer.WriteIntNullable(_systemThreadPoolSize); + writer.WriteIntNullable(_asyncCallbackThreadPoolSize); + writer.WriteIntNullable(_managementThreadPoolSize); + writer.WriteIntNullable(_dataStreamerThreadPoolSize); + writer.WriteIntNullable(_utilityCacheThreadPoolSize); + writer.WriteIntNullable(_queryThreadPoolSize); + // Cache config var caches = CacheConfiguration; @@ -371,6 +420,17 @@ namespace Apache.Ignite.Core writer.WriteBoolean(false); } + // SQL + if (SqlConnectorConfiguration != null) + { + writer.WriteBoolean(true); + SqlConnectorConfiguration.Write(writer); + } + else + { + writer.WriteBoolean(false); + } + // Plugins (should be last) if (PluginConfigurations != null) { @@ -438,6 +498,17 @@ namespace Apache.Ignite.Core _failureDetectionTimeout = r.ReadTimeSpanNullable(); _clientFailureDetectionTimeout = r.ReadTimeSpanNullable(); + // Thread pools + _publicThreadPoolSize = r.ReadIntNullable(); + _stripedThreadPoolSize = r.ReadIntNullable(); + _serviceThreadPoolSize = r.ReadIntNullable(); + _systemThreadPoolSize = r.ReadIntNullable(); + _asyncCallbackThreadPoolSize = r.ReadIntNullable(); + _managementThreadPoolSize = r.ReadIntNullable(); + _dataStreamerThreadPoolSize = r.ReadIntNullable(); + _utilityCacheThreadPoolSize = r.ReadIntNullable(); + _queryThreadPoolSize = r.ReadIntNullable(); + // Cache config var cacheCfgCount = r.ReadInt(); CacheConfiguration = new List(cacheCfgCount); @@ -509,6 +580,12 @@ namespace Apache.Ignite.Core { MemoryConfiguration = new MemoryConfiguration(r); } + + // SQL + if (r.ReadBoolean()) + { + SqlConnectorConfiguration = new SqlConnectorConfiguration(r); + } } /// @@ -995,5 +1072,92 @@ namespace Apache.Ignite.Core /// Peer loading is enabled for functionality. /// public PeerAssemblyLoadingMode PeerAssemblyLoadingMode { get; set; } + + /// + /// Gets or sets the size of the public thread pool, which processes compute jobs and user messages. + /// + public int PublicThreadPoolSize + { + get { return _publicThreadPoolSize ?? DefaultThreadPoolSize; } + set { _publicThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the striped thread pool, which processes cache requests. + /// + public int StripedThreadPoolSize + { + get { return _stripedThreadPoolSize ?? DefaultThreadPoolSize; } + set { _stripedThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the service thread pool, which processes Ignite services. + /// + public int ServiceThreadPoolSize + { + get { return _serviceThreadPoolSize ?? DefaultThreadPoolSize; } + set { _serviceThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the system thread pool, which processes internal system messages. + /// + public int SystemThreadPoolSize + { + get { return _systemThreadPoolSize ?? DefaultThreadPoolSize; } + set { _systemThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the asynchronous callback thread pool. + /// + public int AsyncCallbackThreadPoolSize + { + get { return _asyncCallbackThreadPoolSize ?? DefaultThreadPoolSize; } + set { _asyncCallbackThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the management thread pool, which processes internal Ignite jobs. + /// + [DefaultValue(DefaultManagementThreadPoolSize)] + public int ManagementThreadPoolSize + { + get { return _managementThreadPoolSize ?? DefaultManagementThreadPoolSize; } + set { _managementThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the data streamer thread pool. + /// + public int DataStreamerThreadPoolSize + { + get { return _dataStreamerThreadPoolSize ?? DefaultThreadPoolSize; } + set { _dataStreamerThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the utility cache thread pool. + /// + public int UtilityCacheThreadPoolSize + { + get { return _utilityCacheThreadPoolSize ?? DefaultThreadPoolSize; } + set { _utilityCacheThreadPoolSize = value; } + } + + /// + /// Gets or sets the size of the query thread pool. + /// + public int QueryThreadPoolSize + { + get { return _queryThreadPoolSize ?? DefaultThreadPoolSize; } + set { _queryThreadPoolSize = value; } + } + + /// + /// Gets or sets the SQL connector configuration (for JDBC and ODBC). + /// + public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd index fae4ebb..0cd58ed 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd @@ -1247,6 +1247,53 @@ + + + + SQL connector configuration (JDBC and ODBC). + + + + + Connector port. + + + + + Connector host. + + + + + Connector port range. + + + + + Size of the socket send buffer. + + + + + Size of the socket receive buffer. + + + + + TCP_NODELAY socket option. + + + + + Maximum open cursors per connection. + + + + + SQL connector thread pool size. + + + @@ -1433,6 +1480,51 @@ Indicates whether user assemblies should be loaded on remote nodes automatically. + + + Size of the public thread pool, which processes compute jobs and user messages. + + + + + Size of the striped thread pool. + + + + + Size of the service thread pool. + + + + + Size of the system thread pool. + + + + + Size of the async callback thread pool. + + + + + Size of the management thread pool. + + + + + Size of the data streamer thread pool. + + + + + Size of the utility cache thread pool. + + + + + Size of the query thread pool. + + http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs index 6c5d620..775add4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs @@ -529,12 +529,22 @@ namespace Apache.Ignite.Core.Impl.Common var attr = property.GetCustomAttributes(true).OfType().FirstOrDefault(); if (attr != null) + { return attr.Value; + } + + var declType = property.DeclaringType; + if (declType != null && !declType.IsAbstract && declType.GetConstructor(new Type[0]) != null) + { + return property.GetValue(Activator.CreateInstance(declType), null); + } var propertyType = property.PropertyType; if (propertyType.IsValueType) + { return Activator.CreateInstance(propertyType); + } return null; }