Auto-tuning internet servers by Genetic Algorithm
First it is necessary to prepare to the point where an ordinary stress test is possible. Please prepare the server to be used for attacking in a location that is close (in terms of network) to the target. Suitable specifications are required for the Attacker as well.
Anything is acceptable as a stress tool providing that it can be used from a command line. Although
ab(Apache Bench) etc. have been included from the beginning and therefore would be simple, this time, a software called green-hakai was used. (The installation instructions for
green-hakai are available from the product’s website)
When performing automatic tuning, the target (= sever group of the tuning target) is controlled by Chef and it is necessary that the parameters become attributes of Chef. For example, when the template
httpd.conf becomes as shown:
MaxClients are to be made attribute of Chef, do it as follows:
When in this state, by writing as shown below in
nodes/www-1.example.json, it is possible to control
MaxClients of the
As a result of rewriting this JSON, deploying it to the target by using Chef, and then applying the stress test, it will be
gargor (the new software) that searches the new test parameter using GA.
gargor by doing the following: (Ruby 1.9.3 or higher is required)
[sudo] gem install gargor
gargor.rb under the Chef repository. Rewrite the contents as necessary.
# generations: set > 1
When using something other than
green-hakai, it will be necessary to customize
# fitness = 1/time
However, by removing the comment out of this part, it is possible to decide a rough score by the (inverse number of) the measurement time.
gargor performs the stress test for the number of (number of generations * number of individuals) at the maximum and searches for parameters that appear good. As it takes a long time, it is probably best to run when finishing work for the day in order to confirm the results the next morning.
Of course, it is possible to perform multiple settings for parameters.
As GA is used, there are erratic elements, and unless the software is tried, it is unknown whether good results will be output. If the number of individuals and the number of generations are increased, it will take longer but the precision will be improved. Also, because the precision also changes depending on how
mutation is written, the user is encouraged to try many things.
gargor is only just-created software, please report bugs and fixes to
github. Developer is waiting for pull-request.