Thin Clients Overview
Overview
A thin client is a lightweight GridGain client that connects to the cluster via a standard socket connection. It does not become a part of the cluster topology, never holds any data, and is not used as a destination of compute grid calculations. What it does is simply establish a socket connection to a standard GridGain node and perform all operations through that node.
The thin clients are based on binary client protocol making it possible to support GridGain connectivity from any programming language.
GridGain provides the following thin clients:
Thin Client Features
The following table outlines features supported by each client.
| Thin Client Feature | Java | .Net | C++ | Python | Node.js | PHP |
|---|---|---|---|---|---|---|
Scan Query |
yes |
yes |
No |
yes |
yes |
yes |
Scan Query with a filter |
yes |
yes |
No |
No |
No |
No |
SqlFieldsQuery |
yes |
yes |
No |
yes |
yes |
yes |
Binary Object API |
yes |
yes |
No |
No |
yes |
yes |
Async Operations |
No |
yes |
No |
yes |
yes |
yes |
SSL/TLS |
yes |
yes |
yes |
yes |
yes |
yes |
Authentication |
yes |
yes |
yes |
yes |
yes |
yes |
Best Effort Affinity |
No |
yes |
yes |
No |
No |
No |
Failover |
yes |
No |
yes |
yes |
yes |
yes |
Client Connection Failover
All thin clients (except for .NET thin client) support a connection failover mechanism, whereby the client automatically switches to an available node in case of the current node or connection failure. For this mechanism to work, you need to provide a list of node addresses you want to use for failover purposes in the client configuration. Refer to the specific client documentation for details.
Best Effort Affinity
As explained in the Data Partitioning section, data in the cluster is distributed between the nodes in a balanced manner for scallability and performance reasons. Each cluster node maintains a partition map and uses it to send data requrest directly to the right node.
Unlike a regular cluster node, a thin client maintains connection to one node at a time and is not aware of data distribution in the cluster. All requests that the client sends to the cluster are re-routed to the node or nodes that host the requested data. To eliminate the latency associated with rerouting client requests, we introduce the concept of best effort affinity. With the best effort affinity feature enabled, the client maintains connection to all cluster nodes and requests partition mapping for the caches.
To make use of the best effort affinity feature, you will have to provide the addresses of all nodes in the client connection properties.
Cluster Configuration
Thin client connection parameters are controlled by the client connector configuration. By default, GridGain accepts client connections on port 10800. You can change the port, connection buffer size and timeout, enable SSL/TLS, etc.
Configuring Thin Client Connector
The following example shows how to configure thin client connection parameters:
<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
<property name="clientConnectorConfiguration">
<bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
<property name="port" value="10000"/>
</bean>
</property>
</bean>
ClientConnectorConfiguration clientConnectorCfg = new ClientConnectorConfiguration();
// set a port range from 10000 to 10005
clientConnectorCfg.setPort(10000);
clientConnectorCfg.setPortRange(10);
IgniteConfiguration cfg = new IgniteConfiguration().setClientConnectorConfiguration(clientConnectorCfg);
//Start a node
Ignite ignite = Ignition.start(cfg);
The following table describes some parameters that you may want to change.
| Parameter | Description | Default Value |
|---|---|---|
|
Enables or disables thin client connectivity. |
|
|
The port for thin client connections. |
10800 |
|
This parameters sets a range of ports for thin client connections. For example, if |
100 |
|
Set this property to |
|
See the complete list of parameters in the ClientConnectorConfiguration javadoc.
Enabling SSL/TLS for Thin Clients
To enable SSL/TLS for thin client connections, set the sslEnabled property to true and provide an SslContextFactory in the client connector configuration. You can re-use a global SSLContextFactory if you have configured it for communication between nodes, or you can configure one for thin client connection exclusively. This will enable SSL on the cluster side. Then, configure SSL on the client side in a similar fashion. Refer to the specific client documentation for details.
Below is an example configuration that sets SslContextFactory for thin client connection.
<property name="clientConnectorConfiguration">
<bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
<property name="sslEnabled" value="true"/>
<property name="useIgniteSslContextFactory" value="false"/>
<property name="sslContextFactory">
<bean class="org.apache.ignite.ssl.SslContextFactory">
<property name="keyStoreFilePath" value="/path/to/server.jks"/>
<property name="keyStorePassword" value="123456"/>
<property name="trustStoreFilePath" value="/path/to/trust.jks"/>
<property name="trustStorePassword" value="123456"/>
</bean>
</property>
</bean>
</property>
IgniteConfiguration igniteCfg = new IgniteConfiguration();
ClientConnectorConfiguration clientCfg = new ClientConnectorConfiguration();
clientCfg.setSslEnabled(true);
clientCfg.setUseIgniteSslContextFactory(false);
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreFilePath("/path/to/server.jks");
sslContextFactory.setKeyStorePassword("123456".toCharArray());
sslContextFactory.setTrustStoreFilePath("/path/to/trust.jks");
sslContextFactory.setTrustStorePassword("123456".toCharArray());
clientCfg.setSslContextFactory(sslContextFactory);
igniteCfg.setClientConnectorConfiguration(clientCfg);
If you want to use the global SSLContext, you only need to set the sslEnabled property to true, and ClientConnectorConfiguration will look for the SSLContext configured in IgniteConfiguration:
<property name="clientConnectorConfiguration">
<bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
<property name="sslEnabled" value="true"/>
</bean>
</property>
ClientConnectorConfiguration clientConnectionCfg = new ClientConnectorConfiguration();
clientConnectionCfg.setSslEnabled(true);
© 2021 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.