NGINX Slabs API

The Slabs API from NGINX — 2 operation(s) for slabs.

OpenAPI Specification

nginx-slabs-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: NGINX njs Scripting Connections Slabs API
  version: '0.8'
  description: The NGINX njs module provides a JavaScript runtime embedded inside NGINX. It does not expose HTTP endpoints itself. Instead, it offers scripting objects (HTTP request, stream session, Fetch API, etc.) that are available within njs handler functions configured in the NGINX configuration file. This specification documents the key njs objects as OpenAPI schemas only; the paths object is intentionally empty because there are no REST endpoints to describe.
  x-generated-from: documentation
  contact:
    name: NGINX
    url: https://nginx.org/en/docs/njs/reference.html
  license:
    name: BSD-2-Clause
    url: https://nginx.org/LICENSE
tags:
- name: Slabs
paths:
  /slabs/:
    get:
      tags:
      - Slabs
      summary: NGINX Return Status of All Slabs
      description: Returns status of slabs for each shared memory zone with slab allocator.
      operationId: getSlabs
      produces:
      - application/json
      parameters:
      - in: query
        name: fields
        type: string
        description: Limits which fields of slab zones will be output. If the “<literal>fields</literal>” value is empty, then only zone names will be output.
        x-example: ''
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/NginxSlabZoneMap'
          examples:
            application/json:
              http_cache:
                pages:
                  used: 2
                  free: 2452
                slots:
                  8:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  16:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  32:
                    used: 1
                    free: 126
                    reqs: 1
                    fails: 0
                  64:
                    used: 2
                    free: 62
                    reqs: 2
                    fails: 0
                  128:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
              dns-backends:
                pages:
                  used: 1143
                  free: 2928
                slots:
                  8:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  16:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  32:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  64:
                    used: 1
                    free: 63
                    reqs: 1
                    fails: 0
                  128:
                    used: 0
                    free: 0
                    reqs: 0
                    fails: 0
                  256:
                    used: 18078
                    free: 178
                    reqs: 1635736
                    fails: 0
          x-microcks-refs:
          - name: getSlabs200Example
            x-microcks-default: true
        '404':
          description: Unknown version (*UnknownVersion*)
          schema:
            $ref: '#/definitions/NginxError'
          examples:
            application/json:
              error: {}
              request_id: example-request_id
              href: example-href
          x-microcks-refs:
          - name: getSlabs404Example
            x-microcks-default: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /slabs/{slabZoneName}:
    parameters:
    - name: slabZoneName
      in: path
      description: The name of the shared memory zone with slab allocator.
      required: true
      type: string
      x-example: example_slabZoneName
    get:
      tags:
      - Slabs
      summary: NGINX Return Status of a Slab
      description: Returns status of slabs for a particular shared memory zone with slab allocator.
      operationId: getSlabZone
      produces:
      - application/json
      parameters:
      - in: query
        name: fields
        type: string
        description: Limits which fields of the slab zone will be output.
        x-example: ''
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/NginxSlabZone'
          examples:
            application/json:
              pages:
                used: 1143
                free: 2928
              slots:
                8:
                  used: 0
                  free: 0
                  reqs: 0
                  fails: 0
                16:
                  used: 0
                  free: 0
                  reqs: 0
                  fails: 0
                32:
                  used: 0
                  free: 0
                  reqs: 0
                  fails: 0
                64:
                  used: 1
                  free: 63
                  reqs: 1
                  fails: 0
                128:
                  used: 0
                  free: 0
                  reqs: 0
                  fails: 0
                256:
                  used: 18078
                  free: 178
                  reqs: 1635736
                  fails: 0
          x-microcks-refs:
          - name: getSlabZone200Example
            x-microcks-default: true
        '404':
          description: 'Slab not found (*SlabNotFound*),

            unknown version (*UnknownVersion*)

            '
          schema:
            $ref: '#/definitions/NginxError'
          examples:
            application/json:
              error: {}
              request_id: example-request_id
              href: example-href
          x-microcks-refs:
          - name: getSlabZone404Example
            x-microcks-default: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      tags:
      - Slabs
      summary: NGINX Reset Slab Statistics
      description: Resets the “<literal>reqs</literal>” and “<literal>fails</literal>” metrics for each memory slot.
      operationId: deleteSlabZoneStats
      responses:
        '204':
          description: Success
        '404':
          description: 'Slab not found (*SlabNotFound*),

            unknown version (*UnknownVersion*)

            '
          schema:
            $ref: '#/definitions/NginxError'
          examples:
            application/json:
              error: &id001 {}
              request_id: example-request_id
              href: example-href
          x-microcks-refs:
          - name: deleteSlabZoneStats404Example
            x-microcks-default: true
        '405':
          description: Method disabled (*MethodDisabled*)
          schema:
            $ref: '#/definitions/NginxError'
          examples:
            application/json:
              error: *id001
              request_id: example-request_id
              href: example-href
          x-microcks-refs:
          - name: deleteSlabZoneStats405Example
            x-microcks-default: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
definitions:
  NginxSlabZone:
    title: Shared memory zone with slab allocator
    description: 'Shared memory zone with slab allocator

      '
    type: object
    properties:
      pages:
        type: object
        description: The number of free and used memory pages.
        properties:
          used:
            type: integer
            description: The current number of used memory pages.
            example: 0
          free:
            type: integer
            description: The current number of free memory pages.
            example: 0
        example: {}
      slots:
        type: object
        title: Memory Slots
        description: Status data for memory slots (8, 16, 32, 64, 128, etc.)
        additionalProperties:
          $ref: '#/definitions/NginxSlabZoneSlot'
        example: {}
    example:
      pages:
        used: 1143
        free: 2928
      slots:
        8:
          used: 0
          free: 0
          reqs: 0
          fails: 0
        16:
          used: 0
          free: 0
          reqs: 0
          fails: 0
        32:
          used: 0
          free: 0
          reqs: 0
          fails: 0
        64:
          used: 1
          free: 63
          reqs: 1
          fails: 0
        128:
          used: 0
          free: 0
          reqs: 0
          fails: 0
        256:
          used: 18078
          free: 178
          reqs: 1635736
          fails: 0
  NginxSlabZoneMap:
    title: Slab Zones
    description: 'Status zones that use slab allocator.

      '
    type: object
    additionalProperties:
      $ref: '#/definitions/NginxSlabZone'
    example:
      http_cache:
        pages:
          used: 2
          free: 2452
        slots:
          8:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          16:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          32:
            used: 1
            free: 126
            reqs: 1
            fails: 0
          64:
            used: 2
            free: 62
            reqs: 2
            fails: 0
          128:
            used: 0
            free: 0
            reqs: 0
            fails: 0
      dns-backends:
        pages:
          used: 1143
          free: 2928
        slots:
          8:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          16:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          32:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          64:
            used: 1
            free: 63
            reqs: 1
            fails: 0
          128:
            used: 0
            free: 0
            reqs: 0
            fails: 0
          256:
            used: 18078
            free: 178
            reqs: 1635736
            fails: 0
  NginxError:
    title: Error
    description: 'nginx error object.

      '
    type: object
    properties:
      error:
        type: object
        properties:
          status:
            type: integer
            description: HTTP error code.
            example: 200
          text:
            type: string
            description: Error description.
            example: example-text
          code:
            type: string
            description: Internal nginx error code.
            example: 200
        example: {}
      request_id:
        type: string
        description: The ID of the request, equals the value of the <a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_id">$request_id</a> variable.
        example: example-request_id
      href:
        type: string
        description: Link to reference documentation.
        example: example-href
  NginxSlabZoneSlot:
    title: Memory Slot
    type: object
    properties:
      used:
        type: integer
        description: The current number of used memory slots.
        example: 0
      free:
        type: integer
        description: The current number of free memory slots.
        example: 0
      reqs:
        type: integer
        description: The total number of attempts to allocate memory of specified size.
        example: 0
      fails:
        type: integer
        description: The number of unsuccessful attempts to allocate memory of specified size.
        example: 0
externalDocs:
  description: NGINX njs Reference
  url: https://nginx.org/en/docs/njs/reference.html