diff mbox series

[v2,8/8] simplebench/bench_block_job: drop caches before test run

Message ID 20210304101738.20248-9-vsementsov@virtuozzo.com
State New
Headers show
Series simplebench improvements | expand

Commit Message

Vladimir Sementsov-Ogievskiy March 4, 2021, 10:17 a.m. UTC
It probably may improve reliability of results when testing in cached
mode.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 scripts/simplebench/bench_block_job.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

John Snow March 5, 2021, 1:30 a.m. UTC | #1
On 3/4/21 5:17 AM, Vladimir Sementsov-Ogievskiy wrote:
> It probably may improve reliability of results when testing in cached
> mode.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   scripts/simplebench/bench_block_job.py | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_block_job.py
> index 4f03c12169..fa45ad2655 100755
> --- a/scripts/simplebench/bench_block_job.py
> +++ b/scripts/simplebench/bench_block_job.py
> @@ -53,6 +53,8 @@ def bench_block_job(cmd, cmd_args, qemu_args):
>           return {'error': 'qemu failed: ' + str(vm.get_log())}
>   
>       try:
> +        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', shell=True,
> +                       check=True)
>           res = vm.qmp(cmd, **cmd_args)
>           if res != {'return': {}}:
>               vm.shutdown()
> 

Worth adding a conditional to allow "hot" or "cold" runs? nah?
Vladimir Sementsov-Ogievskiy March 5, 2021, 9:11 a.m. UTC | #2
05.03.2021 04:30, John Snow wrote:
> On 3/4/21 5:17 AM, Vladimir Sementsov-Ogievskiy wrote:
>> It probably may improve reliability of results when testing in cached
>> mode.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   scripts/simplebench/bench_block_job.py | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_block_job.py
>> index 4f03c12169..fa45ad2655 100755
>> --- a/scripts/simplebench/bench_block_job.py
>> +++ b/scripts/simplebench/bench_block_job.py
>> @@ -53,6 +53,8 @@ def bench_block_job(cmd, cmd_args, qemu_args):
>>           return {'error': 'qemu failed: ' + str(vm.get_log())}
>>       try:
>> +        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', shell=True,
>> +                       check=True)
>>           res = vm.qmp(cmd, **cmd_args)
>>           if res != {'return': {}}:
>>               vm.shutdown()
>>
> 
> Worth adding a conditional to allow "hot" or "cold" runs? nah?
> 

You mean, make this addition optional? Make sense
John Snow March 5, 2021, 4:30 p.m. UTC | #3
On 3/5/21 4:11 AM, Vladimir Sementsov-Ogievskiy wrote:
> 05.03.2021 04:30, John Snow wrote:
>> On 3/4/21 5:17 AM, Vladimir Sementsov-Ogievskiy wrote:
>>> It probably may improve reliability of results when testing in cached
>>> mode.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>> ---
>>>   scripts/simplebench/bench_block_job.py | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/scripts/simplebench/bench_block_job.py 
>>> b/scripts/simplebench/bench_block_job.py
>>> index 4f03c12169..fa45ad2655 100755
>>> --- a/scripts/simplebench/bench_block_job.py
>>> +++ b/scripts/simplebench/bench_block_job.py
>>> @@ -53,6 +53,8 @@ def bench_block_job(cmd, cmd_args, qemu_args):
>>>           return {'error': 'qemu failed: ' + str(vm.get_log())}
>>>       try:
>>> +        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', 
>>> shell=True,
>>> +                       check=True)
>>>           res = vm.qmp(cmd, **cmd_args)
>>>           if res != {'return': {}}:
>>>               vm.shutdown()
>>>
>>
>> Worth adding a conditional to allow "hot" or "cold" runs? nah?
>>
> 
> You mean, make this addition optional? Make sense
> 
> 

I was thinking (along the lines of allowing both old and new behavior, 
in case anyone except you used these scripts) of this sort of thing:

def bench_block_job(cmd, cmd_args, qemu_args, drop_cache=True): ...

I don't insist on it; I was just earnestly wondering if it had any 
utility. If it doesn't, don't respin on my account.

--js
Vladimir Sementsov-Ogievskiy March 5, 2021, 4:50 p.m. UTC | #4
05.03.2021 19:30, John Snow wrote:
> On 3/5/21 4:11 AM, Vladimir Sementsov-Ogievskiy wrote:
>> 05.03.2021 04:30, John Snow wrote:
>>> On 3/4/21 5:17 AM, Vladimir Sementsov-Ogievskiy wrote:
>>>> It probably may improve reliability of results when testing in cached
>>>> mode.
>>>>
>>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>>> ---
>>>>   scripts/simplebench/bench_block_job.py | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_block_job.py
>>>> index 4f03c12169..fa45ad2655 100755
>>>> --- a/scripts/simplebench/bench_block_job.py
>>>> +++ b/scripts/simplebench/bench_block_job.py
>>>> @@ -53,6 +53,8 @@ def bench_block_job(cmd, cmd_args, qemu_args):
>>>>           return {'error': 'qemu failed: ' + str(vm.get_log())}
>>>>       try:
>>>> +        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', shell=True,
>>>> +                       check=True)
>>>>           res = vm.qmp(cmd, **cmd_args)
>>>>           if res != {'return': {}}:
>>>>               vm.shutdown()
>>>>
>>>
>>> Worth adding a conditional to allow "hot" or "cold" runs? nah?
>>>
>>
>> You mean, make this addition optional? Make sense
>>
>>
> 
> I was thinking (along the lines of allowing both old and new behavior, in case anyone except you used these scripts) of this sort of thing:
> 
> def bench_block_job(cmd, cmd_args, qemu_args, drop_cache=True): ...
> 
> I don't insist on it; I was just earnestly wondering if it had any utility. If it doesn't, don't respin on my account.
> 

Ok, thanks a lot for reviewing! Still, I think, I'll resend
John Snow March 5, 2021, 4:54 p.m. UTC | #5
On 3/5/21 11:50 AM, Vladimir Sementsov-Ogievskiy wrote:
> 05.03.2021 19:30, John Snow wrote:
>> On 3/5/21 4:11 AM, Vladimir Sementsov-Ogievskiy wrote:
>>> 05.03.2021 04:30, John Snow wrote:
>>>> On 3/4/21 5:17 AM, Vladimir Sementsov-Ogievskiy wrote:
>>>>> It probably may improve reliability of results when testing in cached
>>>>> mode.
>>>>>
>>>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>>>> ---
>>>>>   scripts/simplebench/bench_block_job.py | 2 ++
>>>>>   1 file changed, 2 insertions(+)
>>>>>
>>>>> diff --git a/scripts/simplebench/bench_block_job.py 
>>>>> b/scripts/simplebench/bench_block_job.py
>>>>> index 4f03c12169..fa45ad2655 100755
>>>>> --- a/scripts/simplebench/bench_block_job.py
>>>>> +++ b/scripts/simplebench/bench_block_job.py
>>>>> @@ -53,6 +53,8 @@ def bench_block_job(cmd, cmd_args, qemu_args):
>>>>>           return {'error': 'qemu failed: ' + str(vm.get_log())}
>>>>>       try:
>>>>> +        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', 
>>>>> shell=True,
>>>>> +                       check=True)
>>>>>           res = vm.qmp(cmd, **cmd_args)
>>>>>           if res != {'return': {}}:
>>>>>               vm.shutdown()
>>>>>
>>>>
>>>> Worth adding a conditional to allow "hot" or "cold" runs? nah?
>>>>
>>>
>>> You mean, make this addition optional? Make sense
>>>
>>>
>>
>> I was thinking (along the lines of allowing both old and new behavior, 
>> in case anyone except you used these scripts) of this sort of thing:
>>
>> def bench_block_job(cmd, cmd_args, qemu_args, drop_cache=True): ...
>>
>> I don't insist on it; I was just earnestly wondering if it had any 
>> utility. If it doesn't, don't respin on my account.
>>
> 
> Ok, thanks a lot for reviewing! Still, I think, I'll resend
> 

Thanks for sharing your benchmarking scripts :)

--js
diff mbox series

Patch

diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_block_job.py
index 4f03c12169..fa45ad2655 100755
--- a/scripts/simplebench/bench_block_job.py
+++ b/scripts/simplebench/bench_block_job.py
@@ -53,6 +53,8 @@  def bench_block_job(cmd, cmd_args, qemu_args):
         return {'error': 'qemu failed: ' + str(vm.get_log())}
 
     try:
+        subprocess.run('sync; echo 3 > /proc/sys/vm/drop_caches', shell=True,
+                       check=True)
         res = vm.qmp(cmd, **cmd_args)
         if res != {'return': {}}:
             vm.shutdown()