Performance and Scalability Guide
The Oz system consists of many interconnected components.

Most of the components require scaling to ensure functionality during an increase in . The scheme below represents how the system processes an analysis using supportive software.

This guide explains how to scale components and improve performance for both Docker and Kubernetes deployments.
Scaling Oz BIO and Celery-TFSS
BIO is the most resource-consuming component as it performs media analysis processing.
Node requirements
CPU must support
avx
,avx2
,fma
,sse4.1
, andsse4.2
.If CPU support
avx512f
instructions: to slightly increase performance, you can use a specific BIO image.We recommend using Intel CPU. AMD CPUs are also supported, but require additional configuration.
For better performance, each BIO should reside on a dedicated node with reserved resources.
APM expectations may vary, depending on speed of CPUs (GHz).
Recommended: 2.5+ GHz.
For better performance: 3.0+ GHz.
Scaling
Each BIO instance can handle an unlimited number of simultaneous requests. However, as the number increases, the execution time for each request grows.
The assignment of analyses to BIO instances is managed by celery-tfss
workers. Each celery-tfss
instance is configured to handle 2 analyses simultaneously, as this provides optimal performance and analysis time.
For Kubernetes installations, this behavior can be adjusted using the concurrency parameter in values.yaml. In the default configuration, the number of celery-tfss
instances should match the number of BIOs.
The required number of BIOs can be calculated using the formula below, based on the average analysis time and the expected number of analyses:

Here,
N(BIO) is the required number of BIO nodes
n(APM) is the expected number of APM,
t(analysis) is the measured average duration of a single analysis (3 seconds by default),
C is concurrency (2 by default).
For a large number of requests involving .zip archives (e.g., if you use Web SDK), you might require additional scaling of the celery-preview_convert
service.
Database
Oz API is not intended to be a long-term analysis storage system, so you might encounter longer API response time after 10-30 million folders stored in database (depending on the database performance). Thus, we recommend archiving or deleting data from API after one year of storing it.
For the self-managed database, you'll require the following resources:
API
CPU: 4 cores (up to 8),
RAM: 8 GB (up to 16),
SSD storage.
O2N
CPU: 4 cores (up to 8),
RAM: equal to the database size,
SSD storage.
O2N database requires the Pgvector extension.
Do not create indexes for O2N database as they will reduce accuracy.
For O2N, parallelism is crucial.
Scale up RAM with the growth of your database.
If the number of active connections allows you to stay within the
shared_buffers
limit, you can increasework_mem
.
To increase API performance, consider using this list of indexes:
For high-load environments, achieving the best performance requires precise database tuning. Please contact our support for assistance.
Gesture Performance
The duration of the analysis depends on the gesture used for Liveness. Passive Liveness gestures are generally analyzed faster, while Active Liveness gestures provide higher accuracy but take more time. The longer the gesture takes, the longer the analysis will take.
This table represents analysis duration for different gestures.
Gesture
Average analysis time
50th percentile
[video_selfie_best]
3.895
3.13
[video_selfie_blank]
5.491
4.984
[video_selfie_down]
11.051
8.052
[video_selfie_eyes]
9.953
7.399
[video_selfie_high]
10.937
8.112
[video_selfie_left]
9.713
7.558
[video_selfie_right]
9.95
7.446
[video_selfie_scan]
9.425
7.29
[video_selfie_smile]
10.25
7.621
API Methods Performance
API performance mainly depends on database and storage performance. Most of the available API methods use a database to return results. Thus, to maintain low API response time, we recommend using a high-performance database. Additionally, to reduce the number of requests for analysis results via the /api/folders
methods, please consider webhook callback usage.
Below is a list of recommended and non-recommended practices for using Oz API methods.
/authorize
/authorize
Do
Refresh expired token when possible.
Monitor token expiration.
Use service token only in when appropriate.
Avoid
Making requests with an expired token.
Creating a new token instead of refreshing an expiring one.
Requesting a new token on each API call.
/api/companies
/api/companies
Do
Create a new named company for your deployment.
Avoid
Using the default
system_company
.
/api/users
/api/users
Do
Create named accounts for users.
Create a separate named service account for each business process.
Avoid
Sharing accounts between users.
Creating a new user for each analysis request.
/api/healthcheck
/api/healthcheck
Avoid
Using healthcheck too frequently as it may overwhelm system with internal checks.
GET /api/folders
/api/folders
Do
Always use the time-limiting query parameters:
time.created.min
andtime.created.max
.Use the
total_omit=true
query parameter.Use the
folder_id
query parameter when you know the folder ID.Use the
technical_meta_data
query parameter in case you havemeta_data
set.Use the
limit
query parameter when possible.
Avoid
Using the
with_analyzes=true
query parameter when it is unnecessary, in requests involving long time periods or unspecified durations.Using the
technical_meta_data
query parameter with unspecified additional parameters or time period.
POST /api/folders
/api/folders
Avoid
Placing too many data in the payload
meta_data
.
Last updated
Was this helpful?