Skip to main content

Troubleshooting

Too Many Incoming Requests Cannot Be Processed

Problem

Under high load, a web service may receive more requests than it can handle concurrently. This can lead to:

  • Increased response times
  • Timeout errors
  • Rejected requests

Configuration Options

To control concurrency, adjust the following properties in the instance configuration:

PropertyDescription
jditoWebserviceMaxThreadCountMaximum number of threads that can process HTTP requests simultaneously. Default: 10.
jditoWebserviceMaxQueuedMaximum number of requests that can be queued while threads are busy. Default: 0.

Background

The underlying Restlet framework uses a thread pooling mechanism:

  1. Requests are served by a limited thread pool (jditoWebserviceMaxThreadCount).
  2. If all threads are busy, incoming requests are queued (jditoWebserviceMaxQueued).
  3. If the queue is full, further requests are rejected.

Example Configuration

# Increase parallel processing
jditoWebserviceMaxThreadCount: 20

# Enable overflow queue
jditoWebserviceMaxQueued: 10
warning

Excessive thread counts may cause resource exhaustion. Large queues may increase response latency.

info

For technical details, refer to the Restlet documentation.


File Download via REST Web Services

REST web services can deliver binary content as downloadable files. This enables integration scenarios like document export, report delivery, or file archive access.

Requirements

To enable file download:

  • The response must include binary content.
  • Set response.isBase64 to true to indicate Base64 encoding.
  • Use the Content-Disposition header to control download behavior.

Example Implementation

import { db, logging } from "@aditosoftware/jdito-types";

function restget(pRequestAsJson) {
// Parse incoming request
pRequestAsJson = JSON.parse(pRequestAsJson);

// Example file ID (stored in ASYS_BINARIES)
const fileId = "20350d7f-bce7-4902-8a89-43db0ffc117a";

// Load binary content from database
const fileContent = db.getBinaryContent(fileId, "AO_DATEN");

// Set response body to binary data
pRequestAsJson.response.body = fileContent;

// Enable Base64 encoding for response
pRequestAsJson.response.isBase64 = true;

// Set HTTP headers to define download behavior
pRequestAsJson.response.header = {
"Content-Disposition": "inline; filename=example.txt",
"content-type": "text/plain"
};

return JSON.stringify(pRequestAsJson);
}
note

Use attachment in the Content-Disposition header to enforce file download instead of inline display.