Skip to content

Conversation

@shekhar-himanshu
Copy link

This feature enhances zvmsdk to have rate limit and max outstanding filters. This prevent zmvsdk to flood the SMAPI with too many simultaneous requests.

- [Interfaces](#interfaces)
- [Implmentation Details](#implmentation-details)
- [Sequence diagram](#sequence-diagram)
- [How oustanding requests limit is checked ?](#how-oustanding-requests-limit-is-checked-)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding

* After putting the client connection details in queue, worker thread is started. Maximum number of worker threads possible is controlled by `max_worker_count` configuration parameter. Number of threads already running within process is taken into account before starting new worker thread.
* Each worker thread picks (non-blocking) client connection details from the queue and tries to fulfil (hit SMAPI) the request.

#### How oustanding requests limit is checked ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding


#### How oustanding requests limit is checked ?

The oustanding requests refer to requests made to SMAPI on behalf of z/vm driver. The `SDKServer` maintains in-memory counters to check if this limit has passed for any of the requests received from z/vm driver. Just before hitting the `SMAPI`, this counter is incremented and after receiving the response (or failure), this counter is decremented. This an atomic counter and is thread-safe.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding

|---------|----|-------------|-----------|
|smapi_rate_limit_window_size_seconds|int|1|The duration to consider for rate limit window. For example, if we want 30 requests per 5 seconds, then specify 5 as the value here. Setting this value to 0 disables the rate-limit check.|
|smapi_rate_limit_per_window|str|total:30|The configuration for limiting the rate at which functions can be invoked. The "total" count must be specified. Other function limits can be specified optionally, e.g. "smapi_rate_limit_per_window = total:30, guest_list:10, guest_get_info:5, ...". The cumulative value specified for other function keywords should be less than the "total" value. The option to specify custom limit for certain functions can be helpful in limiting functions which are more resource/time intensive. If the rate limit has been reached, the request received by client is postponed for execution. A request can be postponed for anywhere between 1 and 3 seconds.|
|smapi_max_outstanding_requests|int|10|Maximum number of requests allowed for which response is not yet received. If current oustanding requests exceeds allowed limit, the request is postponed for processing in future. Under this situation, a request can be postponed for a duration between 1 second and 3 seconds. Setting this value to 0 disables the outstanding requests check.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding

#smapi_rate_limit_per_window=total:30

# Maximum number of requests allowed for which response is not yet received.
# If current oustanding requests exceeds allowed limit, the request is postponed for processing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding

default='10',
help='''
Maximum number of requests allowed for which response is not yet received.
If current oustanding requests exceeds allowed limit, the request is postponed for processing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outstanding

@Bischoff Bischoff requested a review from Rajat-0 September 2, 2025 14:54
@Bischoff
Copy link
Contributor

Bischoff commented Sep 2, 2025

@shekhar-himanshu sorry for the delay in doing a first review.

I did not approve nor decline the PR, it is way too high level for me. I hope someone else will have a look.

Could you please:

  1. Sign your commits with your key (option -S of git commit)
  2. Use the Signed-off by: line in your commits (option -s of git commit)
  3. Address my nitpicks in comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants