Ejemplo n.º 1
0
Archivo: core.py Proyecto: d1on/locust
 def ramp_down(clients, hatch_stride):
     while True:
         if self.state != STATE_HATCHING:
             if self.num_clients < max_locusts:
                 gevent.sleep(calibration_time)
                 fail_ratio = RequestStats.sum_stats().fail_ratio
                 if fail_ratio <= acceptable_fail:
                     p = current_percentile(percent)
                     if p <= response_time_limit:
                         if hatch_stride <= precision:
                             print "sweet spot found, ramping stopped!"
                             return
                         print "ramping up..."
                         hatch_stride = max((hatch_stride/2),precision)
                         clients += hatch_stride
                         self.start_hatching(clients, self.hatch_rate)
                         return ramp_up(clients, hatch_stride, True)
             print "ramping down..."
             hatch_stride = max((hatch_stride/2),precision)
             clients -= hatch_stride
             if clients > 0:
                 self.start_hatching(clients, self.hatch_rate)
             else:
                 print "WARNING: no responses met the ramping thresholds, check your ramp configuration, locustfile and \"--host\" address"
                 print "ramping stopped!"
                 return
         gevent.sleep(1)
Ejemplo n.º 2
0
 def ramp_down(clients, hatch_stride):
     while True:
         if self.state != STATE_HATCHING:
             if self.num_clients < max_locusts:
                 gevent.sleep(calibration_time)
                 fail_ratio = RequestStats.sum_stats().fail_ratio
                 if fail_ratio <= acceptable_fail:
                     p = current_percentile(percent)
                     if p <= response_time_limit:
                         if hatch_stride <= precision:
                             print "sweet spot found, ramping stopped!"
                             return
                         print "ramping up..."
                         hatch_stride = max((hatch_stride/2),precision)
                         clients += hatch_stride
                         self.start_hatching(clients, self.hatch_rate)
                         return ramp_up(clients, hatch_stride, True)
             print "ramping down..."
             hatch_stride = max((hatch_stride/2),precision)
             clients -= hatch_stride
             if clients > 0:
                 self.start_hatching(clients, self.hatch_rate)
             else:
                 print "WARNING: no responses met the ramping thresholds, check your ramp configuration, locustfile and \"--host\" address"
                 print "ramping stopped!"
                 return
         gevent.sleep(1)
Ejemplo n.º 3
0
Archivo: core.py Proyecto: d1on/locust
 def ramp_up(clients, hatch_stride, boundery_found=False):
     while True:
         if self.state != STATE_HATCHING:
             if self.num_clients >= max_locusts:
                 print "ramp up stopped due to max locusts limit reached:", max_locusts
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             gevent.sleep(calibration_time)
             fail_ratio = RequestStats.sum_stats().fail_ratio
             if fail_ratio > acceptable_fail:
                 print "ramp up stopped due to acceptable fail ratio %d%% exceeded with fail ratio %d%%" % (acceptable_fail*100, fail_ratio*100)
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             p = current_percentile(percent)
             if p >= response_time_limit:
                 print "ramp up stopped due to percentile response times getting high:", p
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             if boundery_found and hatch_stride <= precision:
                 print "sweet spot found, ramping stopped!"
                 return
             print "ramping up..."
             if boundery_found:
                 hatch_stride = max((hatch_stride/2),precision)
             clients += hatch_stride
             self.start_hatching(clients, self.hatch_rate)
         gevent.sleep(1)
Ejemplo n.º 4
0
 def ramp_up(clients, hatch_stride, boundery_found=False):
     while True:
         if self.state != STATE_HATCHING:
             if self.num_clients >= max_locusts:
                 print "ramp up stopped due to max locusts limit reached:", max_locusts
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             gevent.sleep(calibration_time)
             fail_ratio = RequestStats.sum_stats().fail_ratio
             if fail_ratio > acceptable_fail:
                 print "ramp up stopped due to acceptable fail ratio %d%% exceeded with fail ratio %d%%" % (acceptable_fail*100, fail_ratio*100)
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             p = current_percentile(percent)
             if p >= response_time_limit:
                 print "ramp up stopped due to percentile response times getting high:", p
                 client, hatch_stride = ramp_down_help(clients, hatch_stride)
                 return ramp_down(clients, hatch_stride)
             if boundery_found and hatch_stride <= precision:
                 print "sweet spot found, ramping stopped!"
                 return
             print "ramping up..."
             if boundery_found:
                 hatch_stride = max((hatch_stride/2),precision)
             clients += hatch_stride
             self.start_hatching(clients, self.hatch_rate)
         gevent.sleep(1)