Skip to main content

Configurations

Overview

This page describes different configurations available for Java KeySquare API and server components.
The easiest way to set configurations is by using Environment Variables.

KeySquare server components log all environment variables on start-up, e.g.

2025-07-29 21:20:17,230 INFO [main] t.k.a.m.Main [Main.java:92] KS_APP_KEY_ACCESS_URL .................... http://localhost:6800

Similary, KeySquare java API logs the configuration used to create KeySession on intialization, e.g.

2025-07-29 21:20:19,541 INFO [main] t.k.i.a.AbstractKeySession [AbstractKeySession.java:125] Context: KeySessionContext [applicationName=key-access, cpus=null
note

All configuration changes are applied on startup and a running instance must be restarted in order for configuration changes to take effect.

Common Configuration (Impacts multiple apps)

Licensing

PropertyDefaultDescription
KS_LICENCEKeySquare license key required for platform operation

Ingress/Load Balancer

PropertyDefaultDescription
KS_INGRESS_HOST${HOSTNAME}Ingress hostname (defaults to system hostname)
KS_INGRESS_HTTP_PORT6500Ingress HTTP port for routing requests
KS_INGRESS_STATS_HTTP_PORT6502Ingress statistics and monitoring port

Service Configuration

PropertyDefaultDescription
KS_KEY_UI_HOST0.0.0.0Host binding for Key UI application
KS_KEY_UI_HTTP_PORT6600HTTP port for Key UI application
KS_KEY_ACCESS_HOSTlocalhostHost for Key Access service
KS_KEY_ACCESS_HTTP_PORT6800HTTP port for KeyAccess service
KS_WEB_DATA_SERVER_HOSTlocalhostHost for WebDataServer
KS_WEB_DATA_SERVER_HTTP_PORT6900HTTP port for WebDataServer
KS_KEY_SQUARE_PROXY_GRPC_HOST<auto>Host for KeySquare Proxy gRPC service - auto resolves to KeyAccess FQN
KS_KEY_SQUARE_PROXY_GRPC_PORT6700gRPC port for KeySquare Proxy service

QuestDB Configuration

PropertyDefaultDescription
KS_QUESTDB_HOSTlocalhostQuestDB server hostname
KS_QUESTDB_HTTP_PORT5510QuestDB HTTP API port
KS_QUESTDB_HTTP_USERadminQuestDB HTTP API username
KS_QUESTDB_HTTP_PASSWORDksquestQuestDB HTTP API password
KS_QUESTDB_PG_PORT5512QuestDB PostgreSQL wire protocol port
KS_QUESTDB_MONITOR_PORT5514QuestDB monitoring port
KS_QUESTDB_PG_USERadminQuestDB PostgreSQL username
KS_QUESTDB_PG_PASSWORDksquestQuestDB PostgreSQL password

Database Connectivity

PropertyDefaultDescription
KS_QUESTDB_URL<auto>Complete QuestDB connection URL with parameters
datasource.driverClassNameorg.postgresql.DriverJDBC driver class for database connections
datasource.urljdbc:postgresql://${KS_QUESTDB_HOST}:${KS_QUESTDB_PG_PORT}/qdbJDBC URL for database connections
datasource.username${KS_QUESTDB_PG_USER}Database username
datasource.password${KS_QUESTDB_PG_PASSWORD}Database password

Grafana Configuration

PropertyDefaultDescription
KS_GRAFANA_HOSTlocalhostGrafana server hostname
KS_GRAFANA_HTTP_PORT5500Grafana HTTP port
KS_GRAFANA_ADMIN_PASSWORDadminGrafana admin user password

KeySession (KeySquare Java API)

Refer to KeySessionContext for most up to date list of properties and their description.

Application

PropertyDefaultDescription
APP_NAMEThis is the application name to use to connect to KeySquare. This app name must be pre-registered in KeyAccess and permissioned to access relevant data
APP_CPUSnullDefines the cpu(s) available to pin application threads
KS_APP_API_KEYThe api key to use when registering application on start up
KS_APP_APPLICATION_IDLE_STRATEGYSleepingMillisIdleStrategyThe idle strategy to use for the application thread when it has no messages to process
KS_APP_CONCURRENCY_MODECONCURRENTDefines the concurrency mode of the application - when more than one thread will be interacting with the session the CONCURRENT mode should be used. The EXCLUSIVE mode provides better performance and can be used when all interactions with the session are made using the "ks" thread provided by the session.
KS_APP_SESSION_THREAD_NAME"ks"Defines the thread name to use by the session
KS_APP_EDIT_API_SUPPORTEDtrueCan be used to disable the Edit API - this can provide slightly improved performance in certain cases
KS_APP_SHUTDOWN_HOOK_ENABLEDtrueCan be used to disable the shutdown hook that gets automatically registered by the session
KS_APP_AUTO_RECONNECTtrueCan be used to prevent automatic reconnection of the session following a disconnect
KS_APP_AUTO_RECONNECT_APPLY_SUBSCRIPTIONStrueCan be used to prevent the automatic application of subscriptions when an application is reconnected following a disconnect
KS_APP_AUTO_RECONNECT_REPUBLISHtrueCan be used to prevent the automatic republication of data when an application is reconnected following a disconnect
KS_APP_EXPERIMENTAL_FLAGSComma-separated list of experimental feature flags
KS_IR_REPLACE_SAME_VERSIONfalseFor subscribers, whether to replace local schema definition if the new schema has the same version - useful for development. Only applicable if explicitly subscribed to Schema

Transport

PropertyDefaultDescription
KS_APP_TRANSPORT_MODEIPC_UDPThe transport mode to use, e.g. IPC_UDP or TCP
KS_APP_TRANSPORT_EVENT_LIMIT1000Defines the batch size of events being processed
aeron.dirThe location of the aeron directory to use when in IPC_UDP mode
KS_APP_TRANSPORT_IPC_UDP_INTERFACEConfig.AUTOThe network interface to use when in IPC_UDP mode
KS_APP_TRANSPORT_TCP_BUFFER_SIZE67108864 (64MB)The TCP buffer size when operating in TCP mode

Monitoring

PropertyDefaultDescription
KS_APP_MONITORING_HEALTH_DIRECTORYnullDefines the health directory in which to write a health file once an application submits a LifeCycle Status of Online
KS_APP_MONITORING_BUFFER_SIZE67108864 (64MB)The monitoring buffer size
KS_APP_MONITORING_IDLE_STRATEGYSleepingMillisIdleStrategyThe monitoring thread idle strategy
KS_APP_MONITORING_HEARTBEAT_INTERVAL_MILLIS1000The heartbeat interval in milliseconds
KS_APP_MONITORING_HEARTBEAT_TIMEOUT_MILLIS5000The heartbeat timeout in milliseconds

KeyAccess

PropertyDefaultDescription
KS_APP_KEY_ACCESS_URLThe URL location of the Key Access application used for application registration

Aeron Media Driver

PropertyDefaultDescription
aeron.dir/dev/shm/aeron-ksAeron media driver directory location
aeron.spies.simulate.connectiontrueEnable Aeron spy connection simulation
aeron.threading.modeDEDICATEDAeron threading mode (SHARED, SHARED_NETWORK, DEDICATED)
aeron.media.conductorIdleStrategyorg.agrona.concurrent.BusySpinIdleStrategyIdle strategy for Aeron conductor thread
aeron.media.receiverIdleStrategyorg.agrona.concurrent.NoOpIdleStrategyIdle strategy for Aeron receiver thread
aeron.media.senderIdleStrategyorg.agrona.concurrent.NoOpIdleStrategyIdle strategy for Aeron sender thread

KeyAccess

PropertyDefaultDescription
KS_KEY_ACCESS_HOSTlocalhostHost for Key Access service
KS_KEY_ACCESS_HTTP_PORT6800HTTP port for KeyAccess service
KS_APP_KEY_ACCESS_SERVICE_KEYksadminService key - Clients must provide this key to register or make entitlement changes
KS_KEY_ACCESS_REGISTRATION_TIMEOUT_SECONDS10Number of seconds an application is considered 'registered' without heartbeats

And Database Connectivity

Sequencer

PropertyDefaultDescription
KS_SEQUENCER_INPUT_CHANNELaeron-spy:aeron:udp?endpoint=224.0.0.1:4096|ttl=8Aeron channel for sequencer input stream
KS_SEQUENCER_INPUT_STREAM_ID1Stream ID for sequencer input
KS_SEQUENCER_OUTPUT_CHANNELaeron-spy:aeron:udp?endpoint=224.0.0.3:4096|ttl=8Aeron channel for sequencer output stream
KS_SEQUENCER_OUTPUT_STREAM_ID3Stream ID for sequencer output

Relay Live

Common configuration only

Relay Cache

PropertyDefaultDescription
RELAY_CACHE_MESSAGE_BATCH_SIZE10_000Number of events relay-cache sends to a subscriber per batch. Batching allows consumers to 'catch-up' and gives relay opportunity to service other clients

KeySquare Proxy

PropertyDefaultDescription
KS_KEY_SQUARE_PROXY_GRPC_PORT6700gRPC port for KeySquare Proxy service
KS_KEY_SQUARE_PROXY_EVENT_LIMIT1000Event processing batch limit for KeySquare Proxy

WebDataServer

PropertyDefaultDescription
KS_WEBSOCKET_MESSAGES_PER_SECONDS2Number of unique events to send over web socket for a given topic
KS_APP_KEY_ACCESS_SERVICE_KEYksadminUsed to proxy requests on behalf of users with role = ADMIN
KS_KEY_ACCESS_TOPIC_SOURCEkey-accessTopic Source to use when subscribing to live permissions from KeyAccess
KS_WEB_DATA_SERVER_ADMIN_PASSWORDksadminAdmin password for Web Data Server
KS_APP_WEB_DATA_SERVER_SECURITYSecurity authentication method for WebDataServer
KS_APP_WEB_DATA_SERVER_LDAP_URLLDAP server URL for authentication
KS_APP_WEB_DATA_SERVER_LDAP_USER_SEARCH_FILTERLDAP search filter for user authentication
KS_APP_WEB_DATA_SERVER_LDAP_USER_SEARCH_BASELDAP base DN for user searches

And Database Connectivity

See Authentication for more details on the WebDataServer security settings

Key UI

Key UI needs to connect to WebDataServer to receive data. Key UI and WebDataServer should be run on the same server

PropertyDefaultDescription
KS_WEB_DATA_SERVER_HOSTlocalhostHost for WebDataServer
KS_WEB_DATA_SERVER_HTTP_PORT6900HTTP port for WebDataServer