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
use HTTP to enable jemalloc profile #4600
use HTTP to enable jemalloc profile #4600
Commits on May 13, 2019
-
tikv_alloc/*: Add Mem Prof Error type.
Add `ProfError` and `ProfResult<T>` type for profile related functions to return. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*: Add
(de)activate_prof
functionsAdd `activate_prof` and `deactivate_prof` functions to start and stop jemalloc mem profiling. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Add new entry "/jeprof" to get jemalloc profile
Add new entry "/jeprof" to status_server and start jemalloc profiler for several seconds (according to `seconds` in query), and return the profile. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Add
dump_prof
anddump_prof_to_resp
functions1. Modify entry for profile from `/jeprof` to `/pprof/profile` 2. Abstract the dumping process to two functions. Maybe `dump_prof` function can be added to `tikv_alloc` crates ( but a global timer is needed ) Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*, server/status_server: Add FutureMutex to guarantee only…
… one profiler is running Add ProfilerLock to guarantee only one profiler is running. Actually jemalloc has only one global profiler so I cannot handle several requests at the same time. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*: Add guard for profiler
Impl drop for ProfilerGuard to deactivate_prof, but not use Drop for ProfilerLock. With this approach once we drop the guard, the lock was released. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*,server/status_server: Change name of
Profiler*
toProf*
Change name of several structs and functions from `Profiler*` to `Prof*` to keep the same as `ProfResult` Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/profiler_guard: lock before activate prof
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*, server/status_server: move profiler_guard to tikv server
Move profiler_guard from tikv_alloc/profiler_guard to server/status_server to remove Futures from tikv_alloc dependencies. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/default: Return
MemProfilingNotEnabled
error.Return `MemProfilingNotEnabled` error but not `JemallocNotEnabled` error because tcmalloc profiling may alse be supported in the future. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/error: Remove JemallocNotEnabled error
Remove JemallocNotEnabled error. It's not used in this crate. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/error: impl std::error::Error for ProfError
impl std::error::Error for ProfError (with default implementation) Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*, tikv/status_server: use lower-case in log
Use lower-case rather than upper-case in several info log to keep consistent with other logs in tikv Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/error: impl Display for ProfError
For impl `std::error::Error` for ProfError, impl `Display` for ProfError Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Handle io::Error when creating TempDir
TempDir::new() may return io::Error. Handle this error by returning out. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server, tikv_alloc/error: Handle error for into_string()
OsString.into_string() may cause error when directory path contains non-unicode letter. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Parse query in a better way.
Parse query part in URI in a better way. The previous method is too hacky :( Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Add several HTTP headers for response
Add `X-Content-Type-Options`, `Content-Disposition`, `Content-Type` and `Content-Length` to keep the same with net/http/pprof in golang. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Use a better way to handle Error
Return Error in one closure without use `then` several times. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
server/status_server: Return error as http response
Return the description of error as HTTP response Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*, util/signal_handler: Remove Option in
dump_prof
Remove existing code of handling `SIGUSR2`. It's no longer needed with support of dumping profile with HTTP request. Remove Option in `dump_prof` arguments because all usage of it is pass a `Some`. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
-
tikv_alloc/*, server/status_server: handle error in dump_prof
Handle error in dump_prof function by returning it. Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Commits on Jun 3, 2019
Commits on Jun 5, 2019
-
server/status_server: Set default value of
seconds
Set default value of `seconds` parameter according to TiDB status_server. (10 seconds) Signed-off-by: Yang Keao <keao.yang@yahoo.com>