The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Typedefs | Enumerations | Functions
load.h File Reference

Load generation. More...

#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/talloc.h>
+ Include dependency graph for load.h:

Go to the source code of this file.

Data Structures

struct  fr_load_config_t
 Load generation configuration. More...
 
struct  fr_load_stats_t
 

Typedefs

typedef int(* fr_load_callback_t) (fr_time_t now, void *uctx)
 
typedef struct fr_load_s fr_load_t
 

Enumerations

enum  fr_load_reply_t {
  FR_LOAD_CONTINUE = 0 ,
  FR_LOAD_DONE
}
 Whether or not the application should continue. More...
 

Functions

fr_load_tfr_load_generator_create (TALLOC_CTX *ctx, fr_event_list_t *el, fr_load_config_t *config, fr_load_callback_t callback, void *uctx))
 
fr_load_reply_t fr_load_generator_have_reply (fr_load_t *l, fr_time_t request_time)
 Tell the load generator that we have a reply to a packet we sent. More...
 
int fr_load_generator_start (fr_load_t *l)
 Start the load generator. More...
 
fr_load_stats_t const * fr_load_generator_stats (fr_load_t const *l)
 
size_t fr_load_generator_stats_sprint (fr_load_t *l, fr_time_t now, char *buffer, size_t buflen)
 Print load generator statistics in CVS format. More...
 
int fr_load_generator_stop (fr_load_t *l)
 Stop the load generation through the simple expedient of deleting the timer associated with it. More...
 

Detailed Description

Load generation.

Id
cc63fe7a225dee4170919ef0e7ce27efb35c383a

Definition in file load.h.


Data Structure Documentation

◆ fr_load_config_t

struct fr_load_config_t

Load generation configuration.

The load generator runs a callback periodically in order to generate load. The callback MUST do all of the work, and track all necessary state itself. The load generator simply provides a periodic signal.

The load begins with "start_pps", and ends after ramping up to "max_pps", no matter how long that takes. The ramp-up is done by "step" increments. Each step is run for "duration" seconds.

The callback is run "1/pps" times per second.

In order to send higher load, it is possible to run the callback "parallel" times per timeout. i.e. with "start_pps = 100", and "parallel = 10", the load generator will run the callback 10 times, wait 1/10s, run the callback another 10 times, and so on.

In order to prevent the load generator from overloading the backend, we have a configurable maximum backlog. i.e. packets sent without reply. This backlog is expressed in milliseconds of packets, not in numbers of packets. Expressing the backlog this way allows it to automatically scale to higher loads.

i.e. if the generator is senting 10K packets/s, and the "milliseconds" parameter is 1000, then the generator will allow 10K packets in the backlog.

Once the backlog limit is reached, the load generator will switch to a "gated" method of sending packets. It will only send one new packet when it has received a reply for one old packet.

If the generator receives many replies and the backlog is lower than the limit, the generator switches again to sending the configured "pps" packets

The generator will try to increase the packet rate after "duration" seconds, even if the maximum backlog is currently reached. This increase has the effect of also increasing the maximum backlog.

Definition at line 72 of file load.h.

+ Collaboration diagram for fr_load_config_t:
Data Fields
fr_time_delta_t duration duration of each step
uint32_t max_pps max PPS, 0 for "no limit".
uint32_t milliseconds how many milliseconds of backlog to top out at
uint32_t parallel how many packets in parallel to send
uint32_t start_pps start PPS
uint32_t step how much to increase each load test by

◆ fr_load_stats_t

struct fr_load_stats_t

Definition at line 81 of file load.h.

+ Collaboration diagram for fr_load_stats_t:
Data Fields
int backlog current backlog
bool blocked whether or not we're blocked
fr_time_t end when the test started

when the test ended, due to last reply received

fr_time_t last_send last packet we sent
int max_backlog maximum backlog we saw during the test
int pps current offered packets/s
int pps_accepted Accepted PPS for the last second.
int received total packets received (should be == sent)
fr_time_delta_t rtt smoothed round trip time
fr_time_delta_t rttvar RTT variation.
int sent total packets sent
int skipped we skipped sending this number of packets
fr_time_t start
int times[8] response time in microseconds to tens of seconds

Typedef Documentation

◆ fr_load_callback_t

typedef int(* fr_load_callback_t) (fr_time_t now, void *uctx)

Definition at line 109 of file load.h.

◆ fr_load_t

typedef struct fr_load_s fr_load_t

Definition at line 1 of file load.h.

Enumeration Type Documentation

◆ fr_load_reply_t

Whether or not the application should continue.

Enumerator
FR_LOAD_CONTINUE 

continue sending packets.

FR_LOAD_DONE 

the load generator is done

Definition at line 103 of file load.h.

Function Documentation

◆ fr_load_generator_create()

fr_load_t* fr_load_generator_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_load_config_t config,
fr_load_callback_t  callback,
void *  uctx 
)

Definition at line 87 of file load.c.

+ Here is the caller graph for this function:

◆ fr_load_generator_have_reply()

fr_load_reply_t fr_load_generator_have_reply ( fr_load_t l,
fr_time_t  request_time 
)

Tell the load generator that we have a reply to a packet we sent.

Definition at line 263 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_start()

int fr_load_generator_start ( fr_load_t l)

Start the load generator.

Definition at line 230 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_stats()

fr_load_stats_t const* fr_load_generator_stats ( fr_load_t const *  l)

Definition at line 387 of file load.c.

◆ fr_load_generator_stats_sprint()

size_t fr_load_generator_stats_sprint ( fr_load_t l,
fr_time_t  now,
char *  buffer,
size_t  buflen 
)

Print load generator statistics in CVS format.

Definition at line 341 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_stop()

int fr_load_generator_stop ( fr_load_t l)

Stop the load generation through the simple expedient of deleting the timer associated with it.

Definition at line 252 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: