• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

UltraMonkey-L7 V3(multi-thread implementation)


Commit MetaInfo

Revisiónbc58556291a17434f4d6daab880e93a251e6d5fd (tree)
Tiempo2012-09-11 19:15:27
Autorhibari <l05102@shib...>
Commiterhibari

Log Message

Add session_thread_pool_size option for l7vsadm and l7directord.

Cambiar Resumen

Diferencia incremental

--- a/doc/conf/l7directord.cf.sample
+++ b/doc/conf/l7directord.cf.sample
@@ -56,3 +56,4 @@ virtual = 192.168.0.50:80
5656 #accesslog_rotate_max_filesize = 100M
5757 #accesslog_rotate_rotation_timing = month
5858 #accesslog_rotate_rotation_timing_value = "1 23:59"
59+ #session_thread_pool_size = 32
--- a/l7directord/l7directord
+++ b/l7directord/l7directord
@@ -138,6 +138,7 @@ our %VIRTUAL = (
138138 accesslog_rotate_max_filesize => undef,
139139 accesslog_rotate_rotation_timing => undef,
140140 accesslog_rotate_rotation_timing_value => undef,
141+ session_thread_pool_size => undef,
141142 other_virtual_key => undef,
142143 # can override
143144 checkcount => undef,
@@ -1060,6 +1061,11 @@ sub validate_config {
10601061 config_error($line, 'ERR0129', $config);
10611062 }
10621063 }
1064+ elsif ($name eq 'session_thread_pool_size') {
1065+ if (!defined $value || $value !~ /^\d+$/ || $value == 0 ) {
1066+ config_error($line, 'ERR0101', $config);
1067+ }
1068+ }
10631069 }
10641070
10651071 return ($name, $value);
@@ -1400,6 +1406,13 @@ sub ld_setup {
14001406 if ( $option_key_flag == 0 ) {
14011407 $v->{other_virtual_key} .= ' none';
14021408 }
1409+ if ( defined $v->{session_thread_pool_size} ) {
1410+ $v->{option}{flags} .= ' --session-thread-pool-size ' . $v->{session_thread_pool_size};
1411+ $v->{other_virtual_key} .= ' ' . $v->{session_thread_pool_size};
1412+ }
1413+ else {
1414+ $v->{other_virtual_key} .= ' none';
1415+ }
14031416 }
14041417
14051418 if ( !defined $v->{fallback} && defined $CONFIG{fallback} ) {
@@ -4998,6 +5011,11 @@ FORMAT: B<"HH:mm">
49985011
49995012 FORMAT: B<"mm">
50005013
5014+Defines the size each of session_thread_pool_size.
5015+Default is session_thread_pool_size parameter at l7vs.cf.
5016+
5017+=item B<session_thread_pool_size = >I<n>
5018+
50015019 =back
50025020
50035021 =back
--- a/l7vsd/include/l7vsadm.h
+++ b/l7vsd/include/l7vsadm.h
@@ -286,6 +286,8 @@ protected:
286286 bool parse_opt_vs_access_log_logrotate_func(int &, int, char*[]);
287287 //! virtualservice option socket option function
288288 bool parse_opt_vs_socket_func(int &, int, char*[]);
289+ //! virtualservice option session thread pool size function
290+ bool parse_opt_vs_session_thread_pool_size_func(int &, int, char*[]);
289291 // realserver option function
290292 //! realserver weight set
291293 bool parse_opt_rs_weight_func(int &, int, char*[]);
--- a/l7vsd/include/virtualservice_element.h
+++ b/l7vsd/include/virtualservice_element.h
@@ -68,6 +68,7 @@ public:
6868 unsigned long long qos_downstream;
6969 unsigned long long throughput_upstream;
7070 unsigned long long throughput_downstream;
71+ unsigned long long session_thread_pool_size;
7172
7273 std::string ssl_file_name;
7374
@@ -99,6 +100,7 @@ public:
99100 qos_downstream(0ULL),
100101 throughput_upstream(0ULL),
101102 throughput_downstream(0ULL),
103+ session_thread_pool_size(0),
102104 access_log_flag(0),
103105 socket_option_tcp_defer_accept(0),
104106 socket_option_tcp_nodelay(0),
@@ -122,6 +124,7 @@ public:
122124 qos_downstream(in.qos_downstream),
123125 throughput_upstream(in.throughput_upstream),
124126 throughput_downstream(in.throughput_downstream),
127+ session_thread_pool_size(in.session_thread_pool_size),
125128 ssl_file_name(in.ssl_file_name),
126129 access_log_flag(in.access_log_flag),
127130 access_log_file_name(in.access_log_file_name),
@@ -164,6 +167,7 @@ public:
164167 qos_downstream = in.qos_downstream;
165168 throughput_upstream = in.throughput_upstream;
166169 throughput_downstream = in.throughput_downstream;
170+ session_thread_pool_size = in.session_thread_pool_size;
167171 access_log_flag = in.access_log_flag;
168172 ssl_file_name = in.ssl_file_name;
169173 access_log_file_name = in.access_log_file_name;
@@ -205,6 +209,7 @@ public:
205209 elem1.qos_downstream == elem2.qos_downstream &&
206210 elem1.throughput_upstream == elem2.throughput_upstream &&
207211 elem1.throughput_downstream == elem2.throughput_downstream &&
212+ elem1.session_thread_pool_size == elem2.session_thread_pool_size &&
208213 elem1.access_log_flag == elem2.access_log_flag &&
209214 elem1.ssl_file_name == elem2.ssl_file_name &&
210215 elem1.access_log_file_name == elem2.access_log_file_name &&
@@ -265,6 +270,7 @@ public:
265270 elem1.qos_downstream == elem2.qos_downstream &&
266271 elem1.throughput_upstream == elem2.throughput_upstream &&
267272 elem1.throughput_downstream == elem2.throughput_downstream &&
273+ elem1.session_thread_pool_size == elem2.session_thread_pool_size &&
268274 elem1.access_log_flag == elem2.access_log_flag &&
269275 elem1.ssl_file_name == elem2.ssl_file_name &&
270276 elem1.access_log_file_name == elem2.access_log_file_name &&
@@ -368,6 +374,7 @@ public:
368374 "qos_downstream=%d, "
369375 "throughput_upstream=%d, "
370376 "throughput_downstream=%d, "
377+ "session_thread_pool_size=%d, "
371378 "access_log_flag=%d, "
372379 "ssl_file_name=%s, "
373380 "access_log_file_name=%s, "
@@ -392,6 +399,7 @@ public:
392399 % elem.qos_downstream
393400 % elem.throughput_upstream
394401 % elem.throughput_downstream
402+ % elem.session_thread_pool_size
395403 % elem.access_log_flag
396404 % elem.ssl_file_name
397405 % elem.access_log_file_name
@@ -440,6 +448,7 @@ private:
440448 ar &qos_downstream;
441449 ar &throughput_upstream;
442450 ar &throughput_downstream;
451+ ar &session_thread_pool_size;
443452 ar &access_log_flag;
444453 ar &ssl_file_name;
445454 ar &access_log_file_name;
--- a/l7vsd/src/l7vsadm.cpp
+++ b/l7vsd/src/l7vsadm.cpp
@@ -1185,6 +1185,40 @@ bool l7vs::l7vsadm::parse_opt_vs_socket_func(int &pos, int argc, char *argv[])
11851185 return true;
11861186
11871187 }
1188+//! virtualservice option session_thread_pool_size function
1189+//! @param[in] argument position
1190+//! @param[in] argument count
1191+//! @param[in] argument value
1192+bool l7vs::l7vsadm::parse_opt_vs_session_thread_pool_size_func(int &pos, int argc, char *argv[])
1193+{
1194+ Logger logger(LOG_CAT_L7VSADM_COMMON, 10, "l7vsadm::parse_opt_vs_session_thread_pool_size_func", __FILE__, __LINE__);
1195+ if (++pos >= argc) {
1196+ // session_thread_pool_size is not specified.
1197+ std::string buf("session_thread_pool_size is not specified.(--session-thread-pool-size)");
1198+ l7vsadm_err.setter(true, buf);
1199+ Logger::putLogError(LOG_CAT_L7VSADM_PARSE, /* fix me */999, buf, __FILE__, __LINE__);
1200+ return false;
1201+ }
1202+ try {
1203+ virtualservice_element &elem = request.vs_element; // request virtualservice element reference get.
1204+ std::string tmp = argv[pos];
1205+ unsigned long long ullval = boost::lexical_cast<unsigned long long> (argv[pos]);
1206+ if (ullval < 1) {
1207+ std::string buf("session-thread-pool-size is too small.(--session-thread-pool-size)");
1208+ l7vsadm_err.setter(true, buf);
1209+ Logger::putLogError(LOG_CAT_L7VSADM_PARSE, /* fix me */999, buf, __FILE__, __LINE__);
1210+ return false;
1211+ }
1212+ elem.session_thread_pool_size = ullval; // set session_thread_pool_size
1213+ } catch (boost::bad_lexical_cast &ex) {
1214+ std::string buf("invalid session-thread-pool-size.(--session-thiread-pool-size)");
1215+ l7vsadm_err.setter(true, buf);
1216+ Logger::putLogError(LOG_CAT_L7VSADM_PARSE, /* fix me */999, buf, __FILE__, __LINE__);
1217+ return false;
1218+ }
1219+ return true;
1220+}
1221+
11881222 //! realserver command parsing.
11891223 //! @param[in] request command
11901224 //! @param[in] argument count
@@ -2258,6 +2292,7 @@ bool l7vs::l7vsadm::parse_help_func(l7vs::l7vsadm_request::COMMAND_CODE_TAG cmd,
22582292 " --access-log -L access-log-flag access log flag 0(none) or 1(output)\n"
22592293 " --access-log-name -a access-log-file access log file\n"
22602294 " [logrotate-args]\n"
2295+ " --session-thread-pool-size val-size set session_thread_pool_size\n"
22612296 " --real-server -r server-address server-address is host:port\n"
22622297 " --weight -w weight scheduling weight set to real server\n"
22632298 " --tproxy set real server connection to IP transparent mode.\n"
@@ -2291,6 +2326,7 @@ std::string l7vs::l7vsadm::usage()
22912326 " [-s scheduler] [-u connection-count] [-b sorry-server] [--masq|tproxy]\n"
22922327 " [-f sorry-flag] [-Q QoSval-up] [-q QoSval-down] [-z ssl-config-file]\n"
22932328 " [-O socket-option] [-L access-log-flag] [-a access-log-file [logrotate-args]]\n"
2329+ " [--session-thread-pool-size val-size]\n"
22942330 " l7vsadm -E -t service-address -m proto-module [module-args]\n"
22952331 " [-s scheduler] [-u connection-count] [-b sorry-server] [--masq|tproxy]\n"
22962332 " [-f sorry-flag] [-Q QoSval-up] [-q QoSval-down] [-L access-log-flag]\n"
@@ -2682,6 +2718,7 @@ l7vs::l7vsadm::l7vsadm()
26822718 vs_option_dic["--access-log"] = boost::bind(&l7vsadm::parse_opt_vs_access_log_func, this, _1, _2, _3);
26832719 vs_option_dic["-a"] = boost::bind(&l7vsadm::parse_opt_vs_access_log_logrotate_func, this, _1, _2, _3);
26842720 vs_option_dic["--access-log-name"] = boost::bind(&l7vsadm::parse_opt_vs_access_log_logrotate_func, this, _1, _2, _3);
2721+ vs_option_dic["--session-thread-pool-size"] = boost::bind(&l7vsadm::parse_opt_vs_session_thread_pool_size_func, this, _1, _2, _3);
26852722
26862723 // create realserver option dictionary
26872724 rs_option_dic["-t"] = boost::bind(&l7vsadm::parse_opt_vs_target_func, this, _1, _2, _3);
--- a/l7vsd/src/virtualservice_tcp.cpp
+++ b/l7vsd/src/virtualservice_tcp.cpp
@@ -798,7 +798,13 @@ void l7vs::virtualservice_tcp::initialize(l7vs::error_code &err)
798798
799799 //create session pool
800800 {
801- for (int i = 0; i < param_data.session_pool_size; ++i) {
801+ int session_pool_size;
802+ if (element.session_thread_pool_size > 0) {
803+ session_pool_size = element.session_thread_pool_size;
804+ } else {
805+ session_pool_size = param_data.session_pool_size;
806+ }
807+ for (int i = 0; i < session_pool_size; ++i) {
802808 try {
803809 tcp_session *sess = new tcp_session(*this,
804810 *dispatcher,