You can change the API properties by editing the app.db.api.properties file.
The API properties file is located at the following location: /usr/local/megha/conf/custom/app.db.api.properties.
The createOrUpdateResourceData API requests are categorized as small or big based on the length of the request body, and the rest are considered as small requests. A request that exceeds the limit defined in the property file app.db.api.small.request.max.content.length is considered a big request. The API server saves all small requests in memory and saves big requests into a file before processing. The API server maintains two thread pools to process the big and small requests simultaneously.
The createOrUpdateResourceData API requests can contain multiple resources to be updated. For quick response time, the API server splits createOrUpdateResourceData requests into multiple batches of resources, and these batches are processed concurrently.
- Maximum request length The API server rejects requests that are greater than 536,870,912 bytes (512 MB).
Change the maximum request length by defining following two properties: app.db.api.request.max.content.length and app.db.api.request.max.content.length.factor
The maximum memory available for JVM is divided by app.db.api.request.max.content.length.factor. This value is compared with app.db.api.request.max.content.length, and the smallest value of these two values is considered. Any request length greater than the smallest value is rejected.
- Small request maximum content length By default, all requests with lengths up to 15,728,640 bytes ( 15 MB) are considered a small request. Requests greater than this value are considered big requests.
Change the small request maximum content length by defining the following property: app.db.api.small.request.max.content.length
A large value for this property might result in holding the larger requests in memory, which can cause the server to run out of memory..
A small value for this property might result in increased file I/O operations and can impact performance.
- Small request file write threshold By default, if a small request exceeds 10,485,760 bytes (10 MB), the API server writes the request in a temporary file.
Change the small request file write threshold value by defining the following property: app.db.api.small.request.file.write.threshold
- Small request executor thread pool size By default, the small request executor thread pool size is set to 4. So, four small requests can be executed in parallel.
Change the small request executor thread pool size by defining the following property: app.db.api.small.request.executor.threadpool.size
- Request split batch size By default, the API server puts 100 resources in one batch.
Change the request split batch size by defining the following property: app.db.api.request.split.batch.size
This parameter must be set depending on the number of cores present on the server.
- Big request executor thread pool size By default, big request executor thread pool size is set to 4. Four big requests can be executed in parallel.
Change the big request executor thread pool size value by defining the following property: app.db.api.big.request.executor.threadpool.size
This parameter must be set depending on the number of cores present on the server.
- Request processor queue load factor The API server parses requests and puts them in the executor queue. By default, the executor queue size is three times the number of threads in the pool. For example, if the thread pool has 4 threads, a maximum of 3 X 4 = 12 requests can be in the executor queue.
This executor queue load factor can be changed by defining the following property: app.db.api.request.processor.q.load.factor
A large value for this property might result in holding the larger requests in the executor queue (in-memory) and the server might run out of memory.
- Scheduler queue size The API server controls the number of small requests, which remain in memory. By default, if the number of small requests in the queue is greater than 200, further requests are written to temporary files. While processing, the API server reads the requests back and processes them.
Change the scheduler queue size by defining the following property: app.db.api.sched.q.size
If the value of this property is small, then more requests are written and read. This increases the I/O of the file and might impact the performance.
A large value for this property might result in holding the small requests in the executor queue (in-memory) and the server might run out of memory.
- Response retention time The API server allows the request to be processed asynchronously and stores the corresponding response in an in-memory cache. By default, the response is retained in the cache for 3,600 seconds (1 hour).
Change the retention time by defining the following property: app.db.api.response.cache.time.limit.in.secs
A large value for this parameter might result in holding responses in memory for a longer duration.
- Wait time A time interval that API request processor waits before sending the
Job Accepted response. The default value for this parameter is 10 seconds. Override the default value by sending the
x-waitTime parameter in the HTTP request header. Only a non-negative
x-waitTime is overridden. See
API request headers for more details on the
x-waitTime parameter.
Change the default server side value by defining the following property: app.db.api.default.wait.time.for.request.completion.in.secs
- Compactor threshold resource count The deleteResourceData API does not delete resources from the disk, it just marks them as deleted. When the number of deleted resources exceeds a threshold value, the compactor runs and removes all resources from the disk that are marked as deleted. By default, the threshold value is set to 10,000.
Change the threshold value by defining the following property: app.db.api.compactor.threshold.resource.count
- Wait time for run compactor If the operations are not executed on the API server for 300,000 milliseconds (5 minutes) and the threshold values have already been exceeded, then the API server runs the compactor.
Change the wait time to run the compactor by defining the following property: app.gtc.idle.time.to.run.blocking.process.in.ms
- Compactor thread pool size The deleteResourceData API does not delete resources from the disk, it marks them as deleted. When the number of deleted resources exceeds a threshold value, the API server runs the compactor and removes all resources from the disk that are marked as deleted. By default, four threads are being used by the compactor.
Change the compactor thread pool size for run compactor by defining the following property: app.db.api.compactor.threadpool.size
Summary of API properties
Parameter | Property name | Default value | Minimum value | Maximum value |
---|---|---|---|---|
Small request maximum content length | app.db.api.small.request.max.content.length | 1048576 | 1 | Java Integer max value: 2,147,483,647 |
Request maximum content length | app.db.api.request.max.content.length | 2147483648 | 1 | Java long max value: 2^63 -1 |
Request maximum content length factor | app.db.api.request.max.content.length.factor | 4 | 1 | Java Integer max value: 2,147,483,647 |
Request split batch size | app.db.api.request.split.batch.size | 100 | 1 | Java Integer max value: 2,147,483,647 |
Processor queue load factor | app.db.api.request.processor.q.load.factor | 3 | 1 | Java Integer max value: 2,147,483,647 |
Scheduler queue size | app.db.api.sched.q.size | 200 | 1 | Java Integer max value: 2,147,483,647 |
Small request maximum content length | app.db.api.small.request.max.content.length | 15728640 | 1 | Java Integer max value: 2,147,483,647 |
Small request file write threshold | app.db.api.small.request.file.write.threshold | 10485760 | 1 | Java Integer max value: 2,147,483,647 |
Small request executor thread pool size | app.db.api.small.request.executor.threadpool.size | 4 | 1 | Java Integer max value: 2,147,483,647 |
Big request executor thread pool size | app.db.api.big.request.executor.threadpool.size | 4 | 1 | Java Integer max value: 2,147,483,647 |
Response retention time | app.db.api.response.cache.time.limit.in.secs | 3600 | 5 | 3600 |
Wait time | app.db.api.default.wait.time.for.request.completion.in.secs | 10 | 0 | Java Integer max value: 2,147,483,647 [2] |
Compactor threshold resource count | app.db.api.compactor.threshold.resource.count | 10000 | Java Integer min value i.e. -2,147,483,648 | Java Integer max value: 2,147,483,647 |
Wait time for run compactor | app.gtc.idle.time.to.run.blocking.process.in.ms | 300000 | Java Integer min value i.e. -2,147,483,648 | Java Integer max value: 2,147,483,647 |
Compactor thread pool size | app.db.api.compactor.threadpool.size | 4 | Java Integer min value i.e. -2,147,483,648 | Java Integer max value: 2,147,483,647 |
The API server does not perform the validation on the minimum and maximum values of the configuration parameters. In case of any violation, the API server the uses default value and logs the appropriate message.