Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-13515 Improve performance when there are many thin clients per server #8307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
import static org.apache.ignite.internal.LongJVMPauseDetector.DEFAULT_JVM_PAUSE_DETECTOR_THRESHOLD;
import static org.apache.ignite.internal.LongJVMPauseDetector.DFLT_JVM_PAUSE_DETECTOR_LAST_EVENTS_COUNT;
import static org.apache.ignite.internal.LongJVMPauseDetector.DFLT_JVM_PAUSE_DETECTOR_PRECISION;
import static org.apache.ignite.internal.binary.streams.BinaryMemoryAllocatorChunk.DFLT_MARSHAL_BUFFERS_RECHECK;
import static org.apache.ignite.internal.binary.streams.BinaryMemoryAllocator.DFLT_MARSHAL_BUFFERS_PER_THREAD_POOL_SIZE;
import static org.apache.ignite.internal.binary.streams.BinaryMemoryAllocator.DFLT_MARSHAL_BUFFERS_RECHECK;
import static org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.DFLT_DISCOVERY_HISTORY_SIZE;
import static org.apache.ignite.internal.processors.affinity.AffinityAssignment.DFLT_AFFINITY_BACKUPS_THRESHOLD;
import static org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache.DFLT_AFFINITY_HISTORY_SIZE;
Expand Down Expand Up @@ -528,6 +529,13 @@ public final class IgniteSystemProperties {
type = Long.class, defaults = "" + DFLT_MARSHAL_BUFFERS_RECHECK)
public static final String IGNITE_MARSHAL_BUFFERS_RECHECK = "IGNITE_MARSHAL_BUFFERS_RECHECK";

/**
* System property to specify per thread binary allocator chunk pool size. Default value is {@code 32}.
*/
@SystemProperty(value = "Per thread binary allocator chunk pool size.",
type = Integer.class, defaults = "" + DFLT_MARSHAL_BUFFERS_PER_THREAD_POOL_SIZE)
public static final String IGNITE_MARSHAL_BUFFERS_PER_THREAD_POOL_SIZE = "IGNITE_MARSHAL_BUFFERS_PER_THREAD_POOL_SIZE";

/**
* System property to disable {@link HostnameVerifier} for SSL connections.
* Can be used for development with self-signed certificates. Default value is {@code false}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class ClientConnectorConfiguration {
/** Default size of thread pool. */
public static final int DFLT_THREAD_POOL_SIZE = IgniteConfiguration.DFLT_PUBLIC_THREAD_CNT;

/** Default selector count. */
public static final int DFLT_SELECTOR_CNT = Math.max(4, Runtime.getRuntime().availableProcessors() / 2);

/** Default handshake timeout. */
public static final int DFLT_HANDSHAKE_TIMEOUT = 10_000;

Expand Down Expand Up @@ -78,6 +81,9 @@ public class ClientConnectorConfiguration {
/** Thread pool size. */
private int threadPoolSize = DFLT_THREAD_POOL_SIZE;

/** Selector count. */
private int selectorCnt = DFLT_SELECTOR_CNT;

/** Idle timeout. */
private long idleTimeout = DFLT_IDLE_TIMEOUT;

Expand Down Expand Up @@ -297,21 +303,21 @@ public ClientConnectorConfiguration setMaxOpenCursorsPerConnection(int maxOpenCu
}

/**
* Size of thread pool that is in charge of processing SQL requests.
* Size of thread pool that is in charge of processing client requests.
* <p>
* Defaults {@link #DFLT_THREAD_POOL_SIZE}.
*
* @return Thread pool that is in charge of processing SQL requests.
* @return Thread pool that is in charge of processing client requests.
*/
public int getThreadPoolSize() {
return threadPoolSize;
}

/**
* Sets thread pool that is in charge of processing SQL requests. See {@link #getThreadPoolSize()} for more
* Sets thread pool that is in charge of processing client requests. See {@link #getThreadPoolSize()} for more
* information.
*
* @param threadPoolSize Thread pool that is in charge of processing SQL requests.
* @param threadPoolSize Thread pool that is in charge of processing client requests.
* @return This instance for chaining.
*/
public ClientConnectorConfiguration setThreadPoolSize(int threadPoolSize) {
Expand All @@ -320,6 +326,30 @@ public ClientConnectorConfiguration setThreadPoolSize(int threadPoolSize) {
return this;
}

/**
* Get count of selectors to use in TCP server.
* <p>
* Defaults {@link #DFLT_SELECTOR_CNT}.
*
* @return Count of selectors to use in TCP server.
*/
public int getSelectorCount() {
return selectorCnt;
}

/**
* Sets count of selectors to use in TCP server. See {@link #getSelectorCount()} for more
* information.
*
* @param selectorCnt Count of selectors to use in TCP server.
* @return This instance for chaining.
*/
public ClientConnectorConfiguration setSelectorCount(int selectorCnt) {
this.selectorCnt = selectorCnt;

return this;
}

/**
* Gets idle timeout for client connections.
* If no packets come within idle timeout, the connection is closed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class BinaryThreadLocalContext {
};

/** Memory chunk. */
private final BinaryMemoryAllocatorChunk chunk = BinaryMemoryAllocator.INSTANCE.chunk();
private final BinaryMemoryAllocatorChunk chunk = BinaryMemoryAllocator.THREAD_LOCAL.chunk();

/** Schema holder. */
private final BinaryWriterSchemaHolder schema = new BinaryWriterSchemaHolder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class BinaryHeapOutputStream extends BinaryAbstractOutputStream {
* @param cap Initial capacity.
*/
public BinaryHeapOutputStream(int cap) {
this(cap, BinaryMemoryAllocator.INSTANCE.chunk());
this(cap, BinaryMemoryAllocator.THREAD_LOCAL.chunk());
}

/**
Expand Down