Introduction
This chapter describes the Tmax session and Session Queue (SQ) with its components and features.
1. Overview
The Tmax session is established to allow a client to connect to (tpstart()) and disconnect from (tpend()) a Tmax system. A session includes services initiated by the client and is maintained within a domain.

User Control Server (UCS) service creates a new session when a request is executed in the usermain() routine. The session is regarded as a long term session because its outbound channel remains connected to the Client Handler (CLH). A new session is created for each new request.
Session Queue (SQ) provides a data storage to enable efficient data sharing between client and service of a session. The data storage can only be accessed within the session, and the resource is released when the session terminates.
Global Queue (GQ), which can be accessed globally regardless of sessions, is also provided. GQ data is released when the engine terminates. Tmax SQ system uses a shared memory storage that enables a more efficient and fast data sharing.
2. Components
The Tmax SQ system consists of system storage, SQS, and SQ APIs.

-
System Storage
To use the Tmax SQ system, specify shared memory key and size in the configuration file. When specifying the size, consider that the shared memory size cannot exceed the physical memory size and limit the size of large data.
System Storage Description SQ(Session Queue)
Session data storage that can be accessed in a session between client and service for data sharing. The resources are automatically released when the session terminates.
GQ(Global Queue)
Session data storage that can be globally accessed regardless of sessions. The resources are released when the engine terminates.
-
SQS
SQS manages and controls the process of saving and reading SQ data through CLH.
-
RQ API
Tmax provides APIs to develop applications. For more information about SQ APIs, refer to API.
3. Features
Tmax SQ system provides the following features.
-
Key-based queue
Keys used in a queue are divided into the following two types:
-
System key (SYSKEY)
A unique key created in the SQ system. The key is 16 bytes (specified in SQ_SYSKEY_SIZE). It starts with "$SQID" (5 bytes) and the remaining 11 bytes are reserved for system use. Users cannot use a key that starts with "$SQID."
-
User key (USERKEY)
Can be specified by a user. Each user key must be unique.
Since SQ is a key-based queue unlike other general-purpose queues, a key must be used for input/output. If there is a duplicate key entry when entering new data (PUT), an error (TPEMATCH) is returned because SQ guarantees key uniqueness. Use the update flag (TPSQ_UPDATE) to overwrite the existing data using a duplicate key.
GQ guarantees system key uniqueness. For system efficiency, it is left to the user to guarantee user key uniqueness.
-
-
Temporary distributed storage
Shared memory storage is used to support rapid and efficient I/O in SQ. Scalability is provided by distributing data across a multiple node environment. In this case, temporary data used during a session is automatically deleted when the session terminates. If an engine failure occurs, recovery is not supported.
GQ data is deleted when the engine terminates.
It is recommended to use RQ if transactions are used or data loss causes a critical issue.
-
GQ support
GQ data can be globally shared regardless of sessions. GQ can be used in a multi node environment within a domain. GQ supports system and user keys, but it is recommended to use system keys for better performance.
-
Monitoring and management function support
SQ can be monitored and managed through the Tmax management tool (tmadmin).