You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
performance tuning help need when I issue read on fast NVMe device with example code #29
hello I read your comment and code again. the buf is out of for loop. this buf will not be freed. but I feel you mean that multiple IO write the same memory will corrupt the information. actually it is fine for me. I just want to measure the performance with this framework, currently I do not need worry about data consistent.
I see it is around 2000MB/s when I run over one NVMe SSD that have 6GB/s BW. could you please shed some light how to tune this? :)
This is an async operation, which returns immediately without waiting the I/O to be finished. That is too say, when readnvme returns and buf gets destroyed, there are I/O operations running ( or pending in I/O queue ) in background. Thus use-after-free will occur.
5 won't start before 4 gets finished; 4 won't start before 3 gets finished... 2 won't start before 1 gets finished.
At the end, we wait for 5 gets finished with co_await service.fsync(1, 0, IOSQE_FIXED_FILE);, so that we can ensure all queued I/O operations are correctly finished before the function returns.
This is an async operation, which returns immediately without waiting the I/O to be finished. That is too say, when readnvme returns and buf gets destroyed, there are I/O operations running ( or pending in I/O queue ) in background. Thus use-after-free will occur.
5 won't start before 4 gets finished; 4 won't start before 3 gets finished... 2 won't start before 1 gets finished.
At the end, we wait for 5 gets finished with co_await service.fsync(1, 0, IOSQE_FIXED_FILE);, so that we can ensure all queued I/O operations are correctly finished before the function returns.
actually, I already put buf into global variable, it will not get freed during process running. double free bug and use after free bug will cause process crash error. it will not impact the performance I feel.
Activity
CarterLi commentedon Aug 14, 2023
Seems you were corrupting memory. You must ensure the
service.read_fixeds are finished beforestd::vector<char> bufgets destroyed.See https://github.com/CarterLi/liburing4cpp#taskhpp
gaowayne commentedon Aug 14, 2023
got it. :) do you have email or wechat, so that can connect offline? :)
CarterLi commentedon Aug 14, 2023
Just use Github please.
gaowayne commentedon Aug 15, 2023
hello I read your comment and code again. the buf is out of for loop. this buf will not be freed. but I feel you mean that multiple IO write the same memory will corrupt the information. actually it is fine for me. I just want to measure the performance with this framework, currently I do not need worry about data consistent.
I see it is around 2000MB/s when I run over one NVMe SSD that have 6GB/s BW. could you please shed some light how to tune this? :)
CarterLi commentedon Aug 15, 2023
This is an async operation, which returns immediately without waiting the I/O to be finished. That is too say, when
readnvmereturns andbufgets destroyed, there are I/O operations running ( or pending in I/O queue ) in background. Thus use-after-free will occur.link_cpwork?link_cpqueues everyread/writeoperations withIOSQE_IO_LINK, which ensures all I/O operations runs in sequence.For example: READ (1) -> WRITE (2) -> READ (3) -> WRITE (4) -> FSYNC (5)
5 won't start before 4 gets finished; 4 won't start before 3 gets finished... 2 won't start before 1 gets finished.
At the end, we wait for 5 gets finished with
co_await service.fsync(1, 0, IOSQE_FIXED_FILE);, so that we can ensure all queued I/O operations are correctly finished before the function returns.CarterLi commentedon Aug 15, 2023
Don't talk about performance before you get things correct.
gaowayne commentedon Aug 15, 2023
actually, I already put buf into global variable, it will not get freed during process running. double free bug and use after free bug will cause process crash error. it will not impact the performance I feel.
gaowayne commentedon Aug 15, 2023
OK, I will pre-allocate memory buffer for this experiment. but I feel one global buf does not impact the performance result.