Skip to content

perfsandbox

Yigong Hu edited this page Jul 8, 2021 · 1 revision

PerfSandbox

PerfSandbox is an abstract operation system entity that ensures all the application tasks in the PerfSandbox lifecycle obey the performance guarantee. A PerfSandbox provides the performance guarantee by mitigating the intra-application performance interference, which means that the slow task in the application blocks the fast tasks and causes high latency for the fast tasks.

PerfSandbox has attributes: these are used to provides performance guarantee rules. In practice, the developers need to tell the PerfSandbox what is the maximum acceptable delay ratio and what is the lifetime of PerfSandbox. Logically, a PerfSandbox is bound to the application tasks pool. For example, for a database application, a PerfSandbox should be bound to one connection of the user. Each PerfSandbox contains many activities, which are bound to the application task. We provide a set of PerfSandbox APIs for the developers to utilize the PerfSandbox in their system.

Create a PerfSandbox

A thread can create a new PerfSandbox at any time(only have one PerfSandbox avaible for its use). A PerfSandbox is created by the following API:

struct pSandbox *create_psandbox(int defer_ratio, float tail_requirement);

The create_psandbox library call creates a PerfSandbox for the current thread. The variable defer_ratio is used to set the maximum execution delay that are allowed for the current PerfSandbox if adding one more PerfSandbox. In the PerfSandbox lifetime, there should be more than 1-tail_requirement percentile activity exceeds the performance requirement. For the detail informaiton of the activity, please read the activity.

The struct pSandbox is the datastruct that represent an psandbox. It is defines as:

typedef struct pSandbox {
  long bid;    // sandbox id used by syscalls
  enum enum_psandbox_state state;
  Activity *activity;
  double tail_threshold; // the maximum ratio of activity that are allowed to break the threshold
  double max_defer; // the interference that allowed for each psandbox
  int finished_activities;
  int bad_activities;
  int action_level; // the psandbox is interferenced and needs future concern
  int compensation_ticket;
} PSandbox;

Destory a PerfSandbox

When the threads want to release their reference PerfSandbox, it should call:

int release_psandbox(PSandbox *p_sandbox);

Once the release_psandbox is executed, the PerfSandbox will be released

Clone this wiki locally