diff options
author | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-06-23 13:58:06 +0300 |
---|---|---|
committer | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-06-23 13:58:06 +0300 |
commit | eb0bcba3166b1168f0813b3f7463cb9f75909302 (patch) | |
tree | cda9d6f63d5f53d87fca4746d0f0bc9b0630c78a | |
parent | Add Tmirror class for mirror benchmarking and option [mirrors].max_connection... (diff) | |
download | idfetch-eb0bcba3166b1168f0813b3f7463cb9f75909302.tar.gz idfetch-eb0bcba3166b1168f0813b3f7463cb9f75909302.tar.bz2 idfetch-eb0bcba3166b1168f0813b3f7463cb9f75909302.zip |
Add [mirrors].benchmark_oblivion option to segget.conf
benchmark_oblivion option allows to adjust how fast segget "forgets" benchmarking
statistics on mirrors performance.
Default:
benchmark_oblivion=5
Note: settings.forgetness option replaced by settings.benchmark_oblivion.
-rw-r--r-- | segget/mirror.cpp | 4 | ||||
-rw-r--r-- | segget/segget.conf | 95 | ||||
-rw-r--r-- | segget/settings.cpp | 8 |
3 files changed, 78 insertions, 29 deletions
diff --git a/segget/mirror.cpp b/segget/mirror.cpp index 4603baa..2b8c14e 100644 --- a/segget/mirror.cpp +++ b/segget/mirror.cpp @@ -9,8 +9,6 @@ #include "tui.cpp" using namespace std; -#define FORGETNESS 20; - class Tmirror{ private: uint active_num; @@ -31,7 +29,7 @@ class Tmirror{ double Tmirror::get_laziness_criterion(){ double criterion=multiplier*1000000000*dld_time/dld_size; - multiplier=multiplier*100/(100+settings.forgetness); + multiplier=multiplier*100/(100+settings.benchmark_oblivion); return criterion; } void Tmirror::start(){ diff --git a/segget/segget.conf b/segget/segget.conf index fb08e33..19e1f89 100644 --- a/segget/segget.conf +++ b/segget/segget.conf @@ -1,31 +1,50 @@ [folders] +# Define a dir to store distfiles +# Default: +# distfiles_dir=./distfiles distfiles_dir=./distfiles +# Define a dir to store distfiles' segments +# Default: +# segments_dir=./tmp segments_dir=./tmp [portage] -fetch-only=0 +# SYNOPSIS: fetch_only=0 | 1 +# NOT IMPLEMENTED YET: fetch_only=0 [distfiles] -# Each distfile can have only up to max_connection_num_per_distfile simultaneous +# Each distfile can have up to max_connection_num_per_distfile simultaneous # connections. # default: # max_connection_num_per_distfile=3 max_connection_num_per_distfile=3 [segments] -# define maximum segment size in bytes -# default: +# Define maximum segment size in bytes. +# Default: # max_segment_size=500000 max_segment_size=500000 + +# SYNOPSIS: resume_on=0 | 1 +# - If resume_on set to 1: +# Before starting downloading a segment segget checks whether this segment is +# already downloaded, checks segments size and if size mathces considers this +# segment to be downloaded and skips downloading process. +# - If resume_on set to 0: +# Segget always starts new fetch for a segment regardless of the fact whether it +# is downloaded or not. +# Default: +# resume_on=1 resume_on=1 -# in case segment download was unsuccessful, new attempts are made. When attempts + +# If segment download was unsuccessful, new attempts are made. When attempts # number reaches max_tries, segment gets FAILED status and error logged to error_log -# default: -#max_tries=30 +# Default: +# max_tries=30 max_tries=30 [connections] -# define maximum number of connections +# Define maximum number of connections max_connections=10 # Set the number of seconds to wait while trying to connect. Use 0 to wait @@ -34,7 +53,7 @@ max_connections=10 # phase, once it has connected, this option is of no more use. Set to zero to # disable connection timeout (it will then only timeout on the system's internal # timeouts). See also the TIMEOUT option. -# default: +# Default: # connection_timeout=15 connection_timeout=15 @@ -43,7 +62,7 @@ connection_timeout=15 # session is considered hung. While awaiting for a response, this value overrides # TIMEOUT. It is recommended that if used in conjunction with TIMEOUT, you set # FTP_RESPONSE_TIMEOUT to a value smaller than TIMEOUT. -# default: +# Default: # ftp_response_timeout=5000 ftp_response_timeout=5000 @@ -53,7 +72,7 @@ ftp_response_timeout=5000 # the transfer operation to take. Normally, name lookups can take a considerable # time and limiting operations to less than a few minutes risk aborting perfectly # normal operations. -# default: +# Default: # timeout=6000 timeout=6000 @@ -61,14 +80,14 @@ timeout=6000 # Define the low speed limit for connection. Pass a long as parameter. It # contains the transfer speed in bytes per second that the transfer should be # below during LOW_CONNECTION_SPEED_TIME seconds to consider it too slow and abort. -# default: +# Default: # low_connection_speed_limit=1000 low_connection_speed_limit=1000 # LOW_CONNECTION_SPEED_TIME # Pass a long as parameter. It contains the time in seconds that the transfer # should be below the LOW_CONNECTION_SPEED_LIMIT to consider it too slow and abort. -# default: +# Default: # low_connection_speed_time=10 low_connection_speed_time=10 @@ -76,17 +95,17 @@ low_connection_speed_time=10 # If a download exceeds this speed (counted in bytes per second) on cumulative # average during the transfer, the transfer will pause to keep the average rate # less than or equal to the parameter value. Defaults to unlimited speed. -# default: +# Default: # max_connection_speed=0 max_connection_speed=0 -#max_total_speed=50000 +# NOT IMPLEMENTED YET: max_total_speed=50000 # BIND INTERFACE / IP # Pass a string as parameter. This sets the interface name to use as outgoing # network interface. The name can be an interface name, an IP address, or a host # name. No binding is set by default. -# default: +# Default: # bind_interface=none bind_interface=none @@ -105,13 +124,42 @@ bind_interface=none # low might cause unnecessary connection setup failures. [mirrors] +# Define how many simultaneous downloads from one mirror segget is allowed to +# have. While choosing a mirror segget will skip mirrors with +# max_connections_num_per_mirror active downloads. +# Default: +# max_connections_num_per_mirror=2 max_connections_num_per_mirror=2 -benchmarking_on=1 -use_benchmark_results=1 + +# SYNOPSIS: collect_benchmark_stats_on=0 | 1 +# - If set to 1, stats on mirrors performance will be collected. +# default: +# collect_benchmark_stats_on=1 (Note: at the moment can NOT be changed) +collect_benchmark_stats_on=1 + +# SYNOPSIS: use_benchmark_stats=0 | 1 +# If use_benchmark_stats=1 statistics on mirrors is used to rate them and +# therefore improve performance. +# Default: +# use_benchmark_results=1 (Note: at the moment can NOT be changed) +use_benchmark_stats=1 + +# benchmark_oblivion option allows to adjust how fast segget "forgets" +# benchmarking statistics on mirrors performance. +# Default: +# benchmark_oblivion=5 +benchmark_oblivion=5 [protocols] -allow_http=1 -allow_ftp=1 +# SYNOPSIS: http_on=0 | 1 +# Default: +# http_on=1 +# NOT IMPLEMENTED YET: http_on=1 + +# SYNOPSIS: ftp_on=0 | 1 +# Default: +# ftp_on=1 +# NOT IMPLEMENTED YET: ftp_on=1 [local-mirrors] @@ -151,9 +199,10 @@ use-proxy-fetcher-demon-only=0 no-proxy-fetcher [mirroring] -# Set directory prefix to prefix. The directory prefix is the directory where all -# other files and subdirectories will be saved for mirroring. -directory-prefix=./mirror +# Define a dir to store distfiles for mirroring. +# Default: +# mirror_dir=./mirror +# NOT IMPLEMENTED YET: mirror_dir=./mirror [logs] general_log_file=segget.log diff --git a/segget/settings.cpp b/segget/settings.cpp index b209814..2cfcb74 100644 --- a/segget/settings.cpp +++ b/segget/settings.cpp @@ -10,7 +10,6 @@ using namespace std; class Tsettings{ private: public: - uint forgetness; //folders string distfiles_dir; string segments_dir; @@ -31,8 +30,8 @@ class Tsettings{ string bind_interface; //mirrors uint max_connections_num_per_mirror; + uint benchmark_oblivion; Tsettings(): - forgetness (5), //folders distfiles_dir("./distfiles"), segments_dir("./tmp"), @@ -52,7 +51,9 @@ class Tsettings{ max_connection_speed(0), bind_interface("none"), //mirrors - max_connections_num_per_mirror(2) + max_connections_num_per_mirror(2), + benchmark_oblivion(5) + //logs {}; void set_resume(bool resume_setting){resume_on=resume_setting;}; bool get_resume(){return resume_on;}; @@ -81,6 +82,7 @@ void Tsettings::load_from_conf_file(){ conf.set(bind_interface, "connections", "bind_interface"); conf.set(max_connections_num_per_mirror, "mirrors", "max_connections_num_per_mirror"); + conf.set(benchmark_oblivion, "mirrors", "benchmark_oblivion"); } Tsettings settings; |