Menu

#2 add tunable options

1.0
open
nobody
None
2013-05-17
2013-05-17
Mark Heily
No

The current libpwq implementation is oriented towards client programs. We should add tuning options suitable for server programs. The following tuning has been reported to improve behavior in a server environment:

  • Increase the number of initial and minimum threads to 100.
  • Make the manager thread wake up every 10ms to be more responsive to sudden bursts of traffic.
  • Increase WORKER_IDLE_SECONDS_THRESHOLD to 10 minutes, so we don't tear down threads aggressively.

I propose we create a public data structure named pwq_config that contains all of the tunable options for the library. Clients would be allowed to manipulate these options directly. Example:

   pwq_config.minimum_threads = 100;
   pwq_config.initial_threads = 100;
   pwq_config.worker_idle_seconds_threshold = 600;
   pwq_config.manager_wake_interval = 10;

In addition to exposing all of the tuning options, it would be nice to have the concept of a "profile" so you could specify the type of environment and have the library set the corresponding tuning options. . There would be function calls to allow you to set the desired profile. Example:

    typedef enum {
      PWQ_PROFILE_DEFAULT,
      PWQ_PROFILE_CLIENT,
      PWQ_PROFILE_SERVER,
      PWQ_PROFILE_EMBEDDED,
    } pwq_profile_types;

    pthread_workqueue_set_profile(PWQ_PROFILE_SERVER);

Discussion


Log in to post a comment.