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

Integrate libtuv thread pool to eliminate thread creation overhead #93

Merged
merged 2 commits into from
Feb 12, 2019

Commits on Feb 12, 2019

  1. Integrate libtuv thread pool into dcurl

    To reduce the overhead of creating and eliminating the threads repeatedly,
    we integrate the thread pool of libtuv with git submodule.
    The pthread-related functions and data types are replaced with the corresonding
    ones of libtuv.
    The compilation of libtuv library is written in the file mk/submodule.mk.
    
    Experiment:
    Call clock_gettime() right before and after the functions for getting the thread.
    The functions are pthread_create() (without thread pool)
    and uv_queue_work() (with thread pool).
    Use test-multi-pow.py as testcase since it initializes and destroys dcurl only once and
    does the PoW multiple times, like what IRI does.
    The experiment result shows the time of getting each thread
    and the thread number of a PoW execution is 7.
    
    Hardware information:
    architecure - x86_64
    CPU         - AMD Ryzen 5 2400G (4 cores/8 threads)
    
    Experiment result (unit: second):
    Without thread pool
    thread0: 0.000028384
    thread1: 0.000025127
    thread2: 0.000024748
    thread3: 0.000023925
    thread4: 0.000024126
    thread5: 0.000025328
    thread6: 0.000052900
    thread0: 0.000049344
    thread1: 0.000039575
    thread2: 0.000036720
    thread3: 0.000036249
    thread4: 0.000034606
    thread5: 0.000034676
    thread6: 0.000033444
    
    With thread pool
    thread0: 0.000124327
    thread1: 0.000002084
    thread2: 0.000001052
    thread3: 0.000000150
    thread4: 0.000000121
    thread5: 0.000000080
    thread6: 0.000000090
    thread0: 0.000000291
    thread1: 0.000000080
    thread2: 0.000000050
    thread3: 0.000000050
    thread4: 0.000000050
    thread5: 0.000000060
    thread6: 0.000000050
    
    The first consumed time of getting the thread from thread pool is longer
    since it is in charge of preallocating and initalizing the threads.
    
    Close DLTcollab#58.
    marktwtn committed Feb 12, 2019
    Configuration menu
    Copy the full SHA
    b4faea1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    728aa2a View commit details
    Browse the repository at this point in the history