Usage and Management

This chapter describes how to configure SQ in the Tmax configuration file and manage SQ using a management tool.

1. Configuration

To start the SQ system before developing an actual application, the following basic configuration must be set.

1.1. NODE Section

The SQ system is managed by node and must be set in NODE section of the Tmax configuration file. Specify SQKEY, SQSIZE, SQMAX, SQKEYMAX, and SQTIMEOUT in the section. SQKEY, SQSIZE, and SQMAX are mandatory.

For more information about the Tmax configuration file, refer to "Environment Configuration" in Tmax Administration Guide.

The following is the NODE section format.

* NODE
Node Name   SQKEY = 32768~262143 ,
                SQSIZE = 4 ~ 4000000,
                SQMAX= 2~MAX_INT-1,
                SQKEYMAX= 1 ~ MAX_INT,
                SQTIMEOUT=1 ~ MAX_INT
  • Node Name = string

    • Size: Up to 15 characters

    • Physical node name. Check this name with a UNIX command, "uname -n." The node name must be registered in the "/etc/hosts" file. Since a domain consists of one or more nodes, at least one node name must be defined in the NODE section.

  • SQKEY = numeric

    • Range: 32768 ~ 262143

    • Key for indicating a shared memory segment that will be used as SQ storage.

  • SQSIZE = numeric

    • Range: 4 ~ 4000000 (Unit: KB)

    • Size of a shared memory segment that will be used as SQ storage.

  • SQMAX = numeric

    • Range: 2 ~ MAX_INT-1 (Unit: KB)

    • Maximum number of SQs that can be created in a node. This must be set to an even number. If an odd number is set, 1 subtracted from the number is set.

  • SQKEYMAX = numeric

    • Default value: 1 ~ MAX_INT

    • Maximum number of keys that can be saved in an SQ.

  • SQTIMEOUT = numeric

    • Default value: 1 ~ MAX_INT (Unit: second)

    • Maximum time for maintaining SQ data. After the specified time, the data is automatically removed.

Example
*DOMAIN
tmax     ...

*NODE
tmax1     ...,
       SQKEY = 80000,
       SQSIZE = 8192,
       SQMAX = 1024,
       SQKEYMAX = 64,
       SQTIMEOUT = 30

2. System Management

Once the Tmax system starts, the system can be managed using a Tmax management tool, tmadmin.

For more information about a management tool, refer to Tmax Administration Guide .

2.1. SQ Management

tmadmin provides two commands related to SQ: sqinfo(sqi) and sqpurge(sqp).

Command Description

sqinfo(sqi)

Retrieves SQ and GQ usage and key information.

sqpurge(sqp)

Forcibly deletes a key.

sqinfo(sqi)

The sqinfo(sqi) command retrieves the current SQ and GQ usage and key information. This command retrieves the information by node in a multiple node environment. If the [-k] option is not used, all SQ and GQ usages and key information are retrieved.

  • Usage

    $ sqi [-k session_id]
    Option Description

    [-k session_id]

    Specifies a session and retrieves detailed information about keys saved in the session.

  • Example

    • The following example shows how to use the sqinfo(sqi) command and its result.

      $ tmax1 (tmadm): sqi
      -----------------------------------------------------------------------
      session_id   type   clhno   index       issuer      count   size
      -----------------------------------------------------------------------
      0xffffffff  GLOBAL      -       -               -      5    785
      0x00000327  SERVER      0     113         svr_ucs      0      0
      0x00004000  CLIENT      1       0   192.168.1.123      0      0
      0x00004327  SERVER      1     113         svr_ucs      0      0
      
      -----------------------------------------------------------------------
      allocated in total = 4096 bytes, actually used = 2208 bytes
      -----------------------------------------------------------------------
      Msg from rnode(tmax2):
      -----------------------------------------------------------------------
      session_id   type     clhno    index     issuer      count   size
      -----------------------------------------------------------------------
      0xffffffff  GLOBAL      -       -           -          0       0
      
      -----------------------------------------------------------------------
      allocated in total = 4096 bytes, actually used = 576 bytes
      -----------------------------------------------------------------------

      The following describes displayed items.

      Item Description

      session_id

      Session ID. It is "0xffffffff" for GQ.

      type

      Session type.

      • GLOBAL: GQ

      • CLIENT: When accessing a client

      • SERVER: When accessing a server

      clhno

      CLH number for SQ.

      index

      Session index for SQ.

      issuer

      Session information depending on a session type for SQ. If a session type is 'CLIENT,' an IP address is displayed. If 'SERVER,' a server name is displayed.

      count

      Number of created queues.

      size

      Queue data size.

      allocated in total

      Allocated memory size. This includes memory size internally used by a system.

      actually used

      Actually used memory size from total allocated memory size. This includes memory size internally used by a system.

    • The following example shows how to use the sqinfo(sqi) command with the [-k] option and its result.

      $ tmax1 (tmadm): sqi -k 0x00004000
      -----------------------------------------------------------------------
      ind key(hexa)                        key(string)      klen dlen  stime
      -----------------------------------------------------------------------
        1 61626331                          abcd               4   144 10:50:07

      The following describes displayed items.

      Item Description

      ind

      Order.

      key(hexa)

      Hexadecimal key value.

      key(string)

      Key string created by a user.

      klen

      Key string length.

      dlen

      Data length in bytes.

      stime

      Saved time.

sqpurge(sqp)

The sqpurge(sqp) command of master mode tmadmin deletes a key of SQ or GQ in a local node.

  • Usage

    $ sqp
  • Example

    The following example shows how to use the sqpurge(sqp) command and its result.

    $ tmax1 (tmadm): sqp 0x00000000
    -----------------------------------------------------------------------
    ind key(hexa)                        key(string)      klen dlen  stime
    -----------------------------------------------------------------------
      1 61626331                         abc1                4   144 10:47:47
    
    select?(1 - 1, 0 for all) 1
    
    1 will be purged.
    key = 61626331(abc1), klen(dlen) = 4(144).
    ok?(y or n) y
    
    purge ok