-
Notifications
You must be signed in to change notification settings - Fork 53
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
Quickscan #269
Conversation
last_action = time.time() | ||
|
||
now = time.time() | ||
if (now - last_action) > async_sleep_time: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If last_action
is set to the current time before the scanning loop is performed/at the end of each scan loop, won't this always be true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no root_ids, last_action doesn't get updated, so eventually the if case will get executed.
if (now - last_action) > async_sleep_time: | ||
sleep_time = async_sleep_time # long nap | ||
else: | ||
sleep_time = short_sleep_time # shot nap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the idea behind varying the time between scans based on how long the scan itself takes? Or is last_action
tracking something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's nothing going on, use a longer sleep and save cpu cycles. It's not how long the scan takes but rather the last time there was a domain to scan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a quick check using the value_test.py test case.
I modified the testPut1DDataset to do a sequence of flushes and rescans:
# check values we should get from a verbose query
import time
ts = time.time()
for i in range(10):
expected = {"num_chunks": 1, "allocated_size": 40}
self.checkVerbose(dset_id, headers=headers, expected=expected)
now = time.time()
elapsed = now - ts
print(f"flush {elapsed:.2f}")
ts = now
Output is:
$ python value_test.py ValueTest.testPut1DDataset
testPut1DDataset /home/test_user1/hsds_test/valuetest/20231010T154859_160988Z
flush 2.54
flush 0.12
flush 0.12
flush 0.13
flush 0.13
flush 0.13
flush 0.12
flush 0.12
flush 0.13
flush 0.13
The first round takes a couple of seconds because apparently the bucketScan task is in long sleep mode. After the first flush, it "wakes up" and each update only takes about 0.1s.
@@ -32,7 +32,7 @@ log_prefix: null # Prefix text to append to log entries | |||
max_tcp_connections: 100 # max number of inflight tcp connections | |||
head_sleep_time: 10 # max sleep time between health checks for head node | |||
node_sleep_time: 10 # max sleep time between health checks for SN/DN nodes | |||
async_sleep_time: 10 # max sleep time between async task runs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the change in automatic scan frequency? I thought the idea was to allow certain requests to force a scan, in which case making automatic scans this frequent would be unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buckeScan task is still running independently, so the sleep is there to not unnecessarily consume cpu.
It might be better to use something like asyncio.Event (see https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave using signals as a future enhancement since what we have should be good enough for this non-critical path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enabled H5Dget_storage_size
to work from the REST VOL, when it requests a flush and rescan first. I don't fully understand the reasoning behind all the scan changes, but we can iron those out later. Approved.
This change addresses issue #255 - verbose info not correct.
For the verbose param to return the current info for domain or datasets, you'll need to do a PUT / with rescan and flush params set. See the checkVerbose function in value_test.py to see how this works.