Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_docs/monitoring-metrics/new-metrics-system.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ The metrics belong to the `snapshot` register, see link:monitoring-metrics/new-m
Metrics related to JDBC/ODBC or thin client connections.

* `ActiveSessionsCount`, `thin.ActiveSessions`, `jdbc.ActiveSessions`, `odbc.ActiveSessions` - The number of active connections, total and per client type (`client.connector` register, see link:monitoring-metrics/new-metrics#ignite-thin-client-connector[Ignite Thin Client Connector]).
* `ActiveComputeTasksOnBusiestConnection`, `MaxComputeTasksPerConnection` - The number of currently running compute tasks on the busiest thin client connection and the configured per-connection limit of concurrently running compute tasks; their ratio shows how close connections are to the limit (`client.connector` register, see link:monitoring-metrics/new-metrics#ignite-thin-client-connector[Ignite Thin Client Connector]).
* The link:monitoring-metrics/system-views#client_connections[CLIENT_CONNECTIONS] system view lists every connection with its user and addresses.
* `Connections` - Attribute of the `ClientProcessorMXBean` MBean, not available in the metric registers. A list of strings, each string containing information about a connection:

Expand Down
2 changes: 2 additions & 0 deletions docs/_docs/monitoring-metrics/new-metrics.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,13 @@ Register name: `client.connector`
[cols="2,1,3",opts="header"]
|===
|Name | Type | Description
|ActiveComputeTasksOnBusiestConnection | integer | Number of currently running compute tasks on the busiest thin client connection.
|ActiveSessionsCount | integer | Active TCP sessions count.
|AffinityKeyRequestsHits | long | The number of affinity-aware cache key requests that were sent to the primary node.
|AffinityKeyRequestsMisses | long | The number of affinity-aware cache key requests that were sent not to the primary node.
|AffinityQueryRequestsHits | long | The number of affinity-aware query requests that were sent to the primary node.
|AffinityQueryRequestsMisses | long | The number of affinity-aware query requests that were sent not to the primary node.
|MaxComputeTasksPerConnection | integer | Maximum number of concurrently running compute tasks allowed per thin client connection (0 if compute is disabled for thin clients).
|RejectedSessionsAuthenticationFailed | integer | TCP sessions count that were rejected due to failed authentication.
|RejectedSessionsTimeout | integer | TCP sessions count that were rejected due to handshake timeout.
|RejectedSessionsTotal | integer | Total number of rejected TCP connections.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.OdbcConfiguration;
import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.configuration.ThinClientConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.configuration.distributed.DistributedBooleanProperty;
import org.apache.ignite.internal.processors.configuration.distributed.DistributedThinClientConfiguration;
import org.apache.ignite.internal.processors.metric.MetricRegistryImpl;
import org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext;
import org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext;
import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
import org.apache.ignite.internal.systemview.ClientConnectionAttributeViewWalker;
import org.apache.ignite.internal.systemview.ClientConnectionViewWalker;
import org.apache.ignite.internal.util.GridSpinBusyLock;
Expand All @@ -71,6 +73,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.configuration.ThinClientConfiguration.DFLT_MAX_ACTIVE_COMPUTE_TASKS_PER_CONNECTION;
import static org.apache.ignite.internal.cluster.DistributedConfigurationUtils.newConnectionEnabledProperty;
import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLIENT_CONNECTOR_METRICS;
import static org.apache.ignite.internal.processors.metric.impl.MetricUtils.metricName;
Expand Down Expand Up @@ -100,6 +103,12 @@ public class ClientListenerProcessor extends GridProcessorAdapter {
/** */
public static final String METRIC_ACTIVE = "ActiveSessions";

/** Active compute tasks on the busiest thin client connection metric name. */
public static final String METRIC_ACTIVE_COMPUTE_TASKS = "ActiveComputeTasksOnBusiestConnection";

/** Max active compute tasks per connection (configured limit) metric name. */
public static final String METRIC_MAX_COMPUTE_TASKS = "MaxComputeTasksPerConnection";

/** Default client connector configuration. */
public static final ClientConnectorConfiguration DFLT_CLI_CFG = new ClientConnectorConfigurationEx();

Expand Down Expand Up @@ -350,6 +359,36 @@ private void registerClientMetrics(MetricRegistry mreg) {
"Number of active sessions for the " + cliTypeName + " client."
);
}

mreg.register(
METRIC_ACTIVE_COMPUTE_TASKS,
() -> {
int res = 0;

for (GridNioSession ses : srv.sessions()) {
ClientListenerConnectionContext connCtx = ses.meta(CONN_CTX_META_KEY);

if (connCtx instanceof ClientConnectionContext)
res = Math.max(res, ((ClientConnectionContext)connCtx).activeTasksCount());
}

return res;
},
"Number of currently running compute tasks on the busiest thin client connection."
);

ThinClientConfiguration thinCfg = cliConnCfg.getThinClientConfiguration();

int maxComputeTasks = thinCfg == null
? DFLT_MAX_ACTIVE_COMPUTE_TASKS_PER_CONNECTION
: thinCfg.getMaxActiveComputeTasksPerConnection();

mreg.register(
METRIC_MAX_COMPUTE_TASKS,
() -> maxComputeTasks,
"Maximum number of concurrently running compute tasks allowed per thin client connection " +
"(0 if compute is disabled for thin clients)."
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,12 @@ public void decrementActiveTasksCount() {

assert cnt >= 0 : "Unexpected active tasks count: " + cnt;
}

/**
* @return Number of active compute tasks for this connection. Never exceeds the configured limit: the counter may
* temporarily exceed it while a rejected task is being rolled back in {@link #incrementActiveTasksCount()}.
*/
public int activeTasksCount() {
return Math.min(activeTasksCnt.get(), maxActiveComputeTasks);
}
}
Loading
Loading