Skip to content
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

Merged
merged 25 commits into from Jun 7, 2019

Commits on May 13, 2019

  1. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    a432961 View commit details
    Browse the repository at this point in the history
  2. tikv_alloc/*: Add (de)activate_prof functions

    Add `activate_prof` and `deactivate_prof` functions to start and stop
    jemalloc mem profiling.
    
    Signed-off-by: Yang Keao <keao.yang@yahoo.com>
    YangKeao committed May 13, 2019
    Copy the full SHA
    98ff4fa View commit details
    Browse the repository at this point in the history
  3. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    5e2d9eb View commit details
    Browse the repository at this point in the history
  4. server/status_server: Add dump_prof and dump_prof_to_resp functions

    1. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    7f16a83 View commit details
    Browse the repository at this point in the history
  5. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    33d178b View commit details
    Browse the repository at this point in the history
  6. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    533230c View commit details
    Browse the repository at this point in the history
  7. tikv_alloc/*,server/status_server: Change name of Profiler* to Prof*

    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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    4a38e58 View commit details
    Browse the repository at this point in the history
  8. tikv_alloc/profiler_guard: lock before activate prof

    Signed-off-by: Yang Keao <keao.yang@yahoo.com>
    YangKeao committed May 13, 2019
    Copy the full SHA
    838d555 View commit details
    Browse the repository at this point in the history
  9. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    994bd89 View commit details
    Browse the repository at this point in the history
  10. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    2978747 View commit details
    Browse the repository at this point in the history
  11. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    1b6a7e2 View commit details
    Browse the repository at this point in the history
  12. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    5cd3853 View commit details
    Browse the repository at this point in the history
  13. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    a6c100e View commit details
    Browse the repository at this point in the history
  14. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    fbc4b1e View commit details
    Browse the repository at this point in the history
  15. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    56b781d View commit details
    Browse the repository at this point in the history
  16. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    ed798e4 View commit details
    Browse the repository at this point in the history
  17. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    7fe8e8d View commit details
    Browse the repository at this point in the history
  18. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    73a73d2 View commit details
    Browse the repository at this point in the history
  19. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    d19e129 View commit details
    Browse the repository at this point in the history
  20. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    667919c View commit details
    Browse the repository at this point in the history
  21. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    095b7ce View commit details
    Browse the repository at this point in the history
  22. 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>
    YangKeao committed May 13, 2019
    Copy the full SHA
    5b60d0f View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2019

  1. Copy the full SHA
    2ca9bb2 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2019

  1. 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>
    YangKeao committed Jun 5, 2019
    Copy the full SHA
    629a118 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2019

  1. Copy the full SHA
    814b68b View commit details
    Browse the repository at this point in the history