Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/Policer enhancements #2600

Merged

Conversation

carpawell
Copy link
Member

No description provided.

@carpawell carpawell self-assigned this Sep 28, 2023
@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch 2 times, most recently from 08d1d8f to ccbaf27 Compare September 28, 2023 17:20
@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #2600 (5d5a8de) into master (154eb64) will decrease coverage by 0.02%.
The diff coverage is 20.54%.

❗ Current head 5d5a8de differs from pull request most recent head 40762d3. Consider uploading reports for the commit 40762d3 to get more accurate results

@@            Coverage Diff             @@
##           master    #2600      +/-   ##
==========================================
- Coverage   29.75%   29.73%   -0.02%     
==========================================
  Files         407      408       +1     
  Lines       31161    31215      +54     
==========================================
+ Hits         9271     9283      +12     
- Misses      21079    21120      +41     
- Partials      811      812       +1     
Files Coverage Δ
cmd/neofs-node/config/policer/config.go 100.00% <100.00%> (ø)
pkg/services/object_manager/placement/netmap.go 0.00% <ø> (ø)
cmd/neofs-node/object.go 0.00% <0.00%> (ø)
pkg/services/policer/check.go 10.90% <0.00%> (-0.21%) ⬇️
pkg/services/policer/policer.go 0.00% <0.00%> (ø)
pkg/services/policer/reload.go 0.00% <0.00%> (ø)
cmd/neofs-node/config.go 0.00% <0.00%> (ø)
pkg/services/policer/process.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch from ccbaf27 to 7bf1671 Compare September 28, 2023 17:28
@carpawell carpawell marked this pull request as ready for review September 28, 2023 17:28
@carpawell
Copy link
Member Author

Treat almost every commit as a suggestion and feel free to ask, suggest, and discuss.

@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch 2 times, most recently from bf30255 to ed306c3 Compare September 28, 2023 17:50
pkg/services/policer/policer.go Outdated Show resolved Hide resolved
pkg/services/policer/process.go Outdated Show resolved Hide resolved
pkg/services/policer/process.go Show resolved Hide resolved
@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch 3 times, most recently from f6c5a91 to 577df06 Compare October 2, 2023 08:53
@carpawell
Copy link
Member Author

Made new configs public.

@cthulhu-rider
Copy link
Contributor

lets swap 3418af9 and 2ddf312 in order? first one changes code in order to change nothing. new feature must affect smth insta imo

@@ -94,6 +94,11 @@ apiclient:

policer:
head_timeout: 15s # timeout for the Policer HEAD remote operation
cache_size: 1000001 # recently-handled objects cache size
cache_time: 31s # recently-handled objects cache expiration time
Copy link
Contributor

Choose a reason for hiding this comment

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

size and time to cache section?

but 1st of all: why do we expose all parameters while #2590 suggests replication_cooldown only?

Copy link
Member Author

Choose a reason for hiding this comment

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

size and time to cache section?

well, could be done but i am almost sure the resulting config will change so lets wait testing results and see what we need

Copy link
Member Author

Choose a reason for hiding this comment

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

why do we expose all parameters while #2590 suggests replication_cooldown only?

the whole PR is a suggestion. we have magic consts and I am not sure how they work. so now we have a PR that can be tested

@@ -94,6 +94,11 @@ apiclient:

policer:
head_timeout: 15s # timeout for the Policer HEAD remote operation
cache_size: 1000001 # recently-handled objects cache size
cache_time: 31s # recently-handled objects cache expiration time
replication_cooldown: 101ms # cooldown time b/w replication tasks submitting
Copy link
Contributor

Choose a reason for hiding this comment

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

it's implemented like interval, not cooldown, so why is it called so?

Copy link
Member Author

@carpawell carpawell Oct 3, 2023

Choose a reason for hiding this comment

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

it's implemented like interval, not cooldown

what do you mean here? the current implementation is what i would call a cooldown (but i could be wrong)

Copy link
Contributor

Choose a reason for hiding this comment

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

if replication_cooldown is 10s and last replication took 5s, then next replication will start after 5s or 10s? If 10s, then yes, this is cooldown

Copy link
Member Author

Choose a reason for hiding this comment

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

lets use some ascii paintings here

Rs -- replication started
Rf -- replication finished

Rs-----Rf-----Rs--------------------Rf/Rs
|______||_____||______________________|
   5s      5s            20s

a cooldown to me is "i used some func, next time i will be able to use it no earlier than after *cooldown_time*"
an interval to me is "i used some func, lets sleep for *interval_time*"

@carpawell
Copy link
Member Author

carpawell commented Oct 3, 2023

lets swap 3418af9 and 2ddf312 in order?

That was not a mistake, that is how i usually do such things.

changes code in order to change nothing

The second commit is a summary: now the policer is configurable. The first one is about a policer's internal change (although the defaults work ok and no behavior changes were presented (btw, the commit says that nothing changed)). Dont mind swapping if you think that it is not correct (but it won't be swapping in fact, i will need to add a commit that describes some params and then i would need a commit that describes the cooldown param).

cc @roman-khimov

@roman-khimov
Copy link
Member

Commits are OK as is. And OK the other way around. It doesn't change much here.

We decreased it from 200_000 to 1024 in 091448f
in order not to have a potentially useless memory consumption (with 30 seconds
cache expiration and 200_000 cache size, it looks impossible to HEAD the same
object twice for some _real_ disk load). Also, the commit message was wrong
about max memory usage.
This commit suggests leading the implementation to the comment. Increasing cache
size, it is possible to make it more sane for the real situations and, at the
same time, 64MB is the maximum object size currently, that should be fitted in
memory freely more times more than once. Anyway, 1024 cache size looks
incredibly senseless even for the 1024 objects in the storage: 100ms object
handling leads to ~100 seconds before object handling repetition.
Some other solutions:
- cache removing;
- cache size that depends on the total available memory;
- cache size that depends on the total number of the objects in the storage;
- a configurable cache size.

Signed-off-by: Pavel Karpy <[email protected]>
Make replication tasks by policer no more than once in a certain period of time.
Currently, this period is a zero `time.Duration` so no functional changes for
this commit.
Refs nspcc-dev#2590.

Signed-off-by: Pavel Karpy <[email protected]>
Available for reconfiguration fields:
- head requests timeout;
- recent-handled objects cache size AND expiration time;
- replication cooldown time;
- max worker pool capacity;
- max number of objects read per iteration.

Signed-off-by: Pavel Karpy <[email protected]>
10 is not practical at all, even testnet has already more.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch from 577df06 to 82e7866 Compare October 8, 2023 18:42
Internal testing did not prove any valuable cache effect.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell force-pushed the feat/policer-configurable-chill-time branch from 82e7866 to 40762d3 Compare October 8, 2023 18:46
@roman-khimov roman-khimov merged commit 1e568b6 into nspcc-dev:master Oct 9, 2023
@carpawell carpawell deleted the feat/policer-configurable-chill-time branch October 9, 2023 13:13
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.

3 participants