-
Notifications
You must be signed in to change notification settings - Fork 503
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: Enable rustflags = "-C force-frame-pointers=yes"
default for opendal release process
#3756
Comments
Users interested in benchmarking can compile the OpenDAL Python bindings themselves. Is there any benefit to enabling this by default? |
I can use the perf directly when it is enabled by default. This would be great when we find the process issue. We perf it and don't need to recompile the whole package |
perf is not a normal use cases. I believe the workflow should be:
|
I agree with @Zheaoli that enabling frame pointers is very useful, I'm open to enable it by default. FYI, Ubuntu is also going to enable frame pointers by default soon: https://ubuntu.com/blog/ubuntu-performance-engineering-with-frame-pointers-by-default |
Will this change affect the performance or binary size? And why rustc disabled it by default? |
From the Ubuntu report
I think those feature will help our user to diagnose the process problem more easy |
Seems fine. Is there any other reason for rustc not enabling it by default? |
https://doc.rust-lang.org/rustc/codegen-options/index.html#force-frame-pointers Seems that it is not disabled by default. It depends on the target. |
I'm not very familiar with the differences between |
FYI |
If we add |
No! Without symbol, we can't do anything! |
I'm also doubtful about adding too many random rustflags. However, searching GitHub, I found tikv also enables this by default, so it seems a reasonable choice. https://github.com/tikv/tikv/blob/f9727af132109754e63fbb4910b73563d0b1da45/Makefile#L37-L51 ref: tikv/tikv#12480 Edit: But it seems that they used this to solve another niche issue
|
These went to deep. 🤪 I think basically:
Agree. But I think profiling performance issues in production is also needed sometimes? Although in my experience, |
I don't have any major objections to this. @Zheaoli, would you be willing to submit a PR for this change? |
Just curious, Does perf need to know the frame point to expand and obtain debugging information? Isn't dwarf not enough? |
Also was curious. But seems the ubuntu blog explained it. https://ubuntu.com/blog/ubuntu-performance-engineering-with-frame-pointers-by-default |
frame pointer is not a symbol information, it is more like a call convention. It's not just only for performance issue. The DWARF is too complicated to use for the unwind(aka stack backtracing). People may need to take care of the CFI,CFA and so many other details about DWARF. Perf has DWARF call-graph support already, but not enough for other tools. For example, I want to trace the delete action on I can simply use bpftrace to reach my target to get the result like following below 7f992b234ecb unlink+11 (/usr/lib/libc.so.6)
7f9929635b58 _$LT$opendal..services..fs..backend..FsBackend$u20$as$u20$opendal..raw..accessor..Accessor$GT$::blocking_delete::h29be0d409c0ac8fc+488 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f99291ff3d0 _$LT$opendal..layers..error_context..ErrorContextAccessor$LT$A$GT$$u20$as$u20$opendal..raw..layer..LayeredAccessor$GT$::blocking_delete::heeb7b043f40b40d2+80 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929210be5 opendal::raw::layer::_$LT$impl$u20$opendal..raw..accessor..Accessor$u20$for$u20$L$GT$::blocking_delete::hfe8ff62d64908e8c+21 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992977c1b7 _$LT$opendal..layers..complete..CompleteAccessor$LT$A$GT$$u20$as$u20$opendal..raw..layer..LayeredAccessor$GT$::blocking_delete::hf8df1f73a18ab5ee+279 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992978c8c5 opendal::raw::layer::_$LT$impl$u20$opendal..raw..accessor..Accessor$u20$for$u20$L$GT$::blocking_delete::hbfd7055d767e037f+21 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929944768 opendal::raw::layer::LayeredAccessor::blocking_delete::h9a0cabb31d9c83d5+136 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992994cef5 opendal::raw::layer::_$LT$impl$u20$opendal..raw..accessor..Accessor$u20$for$u20$L$GT$::blocking_delete::hd0452586f494ff0d+21 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992919fa91 _$LT$alloc..sync..Arc$LT$T$GT$$u20$as$u20$opendal..raw..accessor..Accessor$GT$::blocking_delete::he4406d9b46c5d061+145 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992980ce55 opendal::types::operator::blocking_operator::BlockingOperator::delete_with::_$u7b$$u7b$closure$u7d$$u7d$::h131b101950b83511+197 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f99294ce721 core::ops::function::FnOnce::call_once::h8aac70541118a702+81 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992981f5e7 opendal::types::operator::operator_functions::OperatorFunction$LT$T$C$R$GT$::call::hdaa1b6b2b17fd7ba+87 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f99293ae76b opendal::types::operator::operator_functions::FunctionDelete::call::hb7b9fc6b7c5fd5d8+43 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929693d1a opendal::types::operator::blocking_operator::BlockingOperator::delete::h29d3ad415820c9c2+58 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929113e63 opendal_python::operator::Operator::delete::hd67488a4058bb5bb+35 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929117228 opendal_python::operator::_::_$LT$impl$u20$opendal_python..operator..Operator$GT$::__pymethod_delete__::h67da0638ee468daf+600 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929158456 pyo3::impl_::trampoline::fastcall_with_keywords::_$u7b$$u7b$closure$u7d$$u7d$::he1f3cfdfb5a96d74+54 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992915801c pyo3::impl_::trampoline::trampoline::_$u7b$$u7b$closure$u7d$$u7d$::h265ebee4038c7f2d+44 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992915a4bb std::panicking::try::do_call::h0d63c3720ecb8a94+43 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992915d45d __rust_try+29 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992915a3d6 std::panicking::try::h8d397070821fac39+86 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992915a075 std::panic::catch_unwind::hba46f6d4392f497e+21 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f9929157c66 pyo3::impl_::trampoline::trampoline::h8e658ba9b211a1e9+278 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f99290a526e pyo3::impl_::trampoline::fastcall_with_keywords::h1a57159770804871+78 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f99291148b0 opendal_python::operator::_::_$LT$impl$u20$pyo3..impl_..pyclass..PyMethods$LT$opendal_python..operator..Operator$GT$$u20$for$u20$pyo3..impl_..pyclass..PyClassImplCollector$LT$opendal_python..operator..Operator$GT$$GT$::py_methods::ITEMS::trampoline::h05ff33749dc99c1b+16 (/home/manjusaka/.pyenv/versions/3.12.0/envs/jupyter/lib/python3.12/site-packages/opendal/_opendal.cpython-312-x86_64-linux-gnu.so)
7f992b581d7e method_vectorcall_FASTCALL_KEYWORDS+142 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b574488 PyObject_Vectorcall+88 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b50fad2 _PyEval_EvalFrameDefault+19106 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b690b9f PyEval_EvalCode+543 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b6ec4d8 run_eval_code_obj+88 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b6ec5fc run_mod+140 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b6ef3e7 _PyRun_SimpleFileObject+375 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b6ef9e5 _PyRun_AnyFileObject+69 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b716e80 Py_RunMain+2336 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b7174e2 Py_BytesMain+82 (/home/manjusaka/.pyenv/versions/3.12.0/lib/libpython3.12.so.1.0)
7f992b158cd0 0x7f992b158cd0 ([unknown]) I can also write a tracing program based on the frame pointer. Actually there are so many community tools based on the frame pointer, not the DWARF. |
I think this means cheaper for DWARF, but this does not mean can not, it just says it's harder than frame pointer. I don't know. |
Yep, DWARF can do the same thing we do by using the frame pointer. But it's too complicated to use. So many tools are not supporting it yet. |
Thanks, that‘s answer my question. 🚀 |
Not only too complicated. The DWARF information can be seen as instructions of a stack virtual machine, which can have endless-loop or any harmful logic, so it's unsafe to evaluate these instructions inside kernel or any other serious scenario.
Also, the dependent libraries may have fault DWARF information, as it's hard to generate a correct DWARF information for every instructions. From my experience, the VDSO on ubuntu 18.04, some system libraries on Mac OS can have fault information, which will break the profilers (as the profilers may want to read some unexpected address while evaluating the DWARF instructions). The LLVM may also generate wrong dwarf information e.g. rust-lang/rust#83139 . I think these problems come from the complexity of DWARF and it's hard to overcome. BTW, if you are about to enable frame-pointer, remember to also rebuild standard libraries of rust (with
TiKV has a continuous profiling feature, which will grab a profile periodically for the developers to understand the system states in history. It uses the https://github.com/tikv/pprof-rs to implement this feature, which actually supports both If you have more interests in profiling / sampling, I had a share about the technical choices in profilers in PingCAP internally, and here is the slides and recorded video (in Chinese). It also describes the choices between DWARF and frame-pointer. (Sorry I mis-configured the priviledges. These docs are shared to anyone who knows the url now.) |
Fantastic! Thank you so much for sharing! |
Implemented in #3772. Thank you all! |
For now, if we want to use the
perf
or any performance analysis tool to analysis the performance of the opendal process. We will be in trouble because of the symbol issueFor example, I try to use perf to analysis the following code
The perf record is here
We can find that we can not trace the rust code.
Since I enable the rustflag, here's new perf result
And
The text was updated successfully, but these errors were encountered: