Hi,

On 03/19/2014 05:26 PM, Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Frederik,

On 3/19/14, 10:00 AM, Frederik Nosi wrote:
worker.list = worker_test,worker_status
worker.worker_status.type=status

worker.worker_test.type = lb worker.worker_test.balance_workers =
test1,test2,test3,test4 worker.worker_test.sticky_session = true
worker.worker_test.sticky_session_force = false
worker.worker_test.method = business
I think you mean "busyness". Could that be the trouble?

Oh, thanks for the catch, it was obviously a typo.
Corrected that and retested but the behaviour does not change though.
FWICS there's no option of load balanced workers for setting the total number of retries. I'll try to explain it bette, i have a load balancer with 4 ajp workers. I needed a way to tell the LB worker that in case of failure to retry only one other worker and if the second fails, to fail the request without retrying the other two workers. As i didnt found an option doing this i made a patch that adds this functionality and it works, though not sure it's perfect, i'm attaching it in case someone is interested, it adds a new parameter, lb_retries, which does what i need. Hope you find it useful, suggestions and corrections welcome obviously.

What i was asking was:

1) Is my solution correct? Or is there some other way to have the behaviour i needed without patching?

The second question is more related to tomcat probably, but here it is:

2) When an ajp worker fails for reply_timeout the tomcat thread that is busy working on the corresponding request does not stop but continues proccessing. Is there a way to change this behaviour? It's problematic in case of mod_jk failover to another ajp worker, requests get doubled.


Hope i was more clear as english is a bit rusty.

Thanks!



- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTKcUoAAoJEBzwKT+lPKRYHEUP/3xA1yWIEqC/NwqGebZc31oS
uH+495ih7+e1gPyNdoLy4/G3wSwBl3AD/6+B7ou2YFEnHsNHQbJUQ+jJlmfVU6/w
n9viCjmyoLTM1DjsGbNNbkdGqVwmlS9qHK4GTfkaT2b4US3QepxM0JnLHMWj8Ow6
F4k3se0E0WzmH8U5VluaCy69q4QQK3IY82daZrj7XKsmXCewIys+E+Tc0xe1In9W
smjz6KB5xBsfGuZBVqXNZJ+VvGXhQl7kOlbVkpNK/BQpRSd7ewqmuekG+Nq8G5wA
L7hBqRTbACgRD9i8RNA7FnFaHbUyd/xZjOe6uwEj+zfRj36KljyQdpJmrxs2rskc
GLX/an+HkKJjFsidEB2MLoocgSCw/5satejL7u1Ky0TMmA4/8CT7EneQ57LeZgp4
QSza2rcBcE+LJIsnQX50K3hsz7yV9JkZB7K5AU+nJeXRk0RA2tC1o4x7m/U4u3U8
xkBq0I3JcGFjt99xCynu1K5JF4dL3FuM3NwomOx3d8d0F92/SQOy9jrCYRFuzjcg
XPS6GRzCQ6hi2HPvBaKWL0wql0cUJBuf4+bQF0/NgNx7OsKBhZv8VLOBKh0VSkZA
XbFrxj6bqxgzM1HD8rGudK/EN/hAFBBkVsEKyApYT5NLR+q4ZvsXXfcMxzt3HN8s
5x8gmn6D6c1EILouhiq4
=Zyt8
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


diff --git a/native/.gitignore b/native/.gitignore
new file mode 100644
index 0000000..1f8d345
--- /dev/null
+++ b/native/.gitignore
@@ -0,0 +1,5 @@
+Makefile.in
+aclocal.m4
+config.log
+config.nice
+configure
diff --git a/native/common/.gitignore b/native/common/.gitignore
new file mode 100644
index 0000000..2a9005d
--- /dev/null
+++ b/native/common/.gitignore
@@ -0,0 +1 @@
+config.h.in
diff --git a/native/common/jk_ajp_common.c b/native/common/jk_ajp_common.c
index 08bcc02..9a12a89 100644
--- a/native/common/jk_ajp_common.c
+++ b/native/common/jk_ajp_common.c
@@ -2904,6 +2904,9 @@ int ajp_init(jk_worker_t *pThis,
         p->retries =
             jk_get_worker_retries(props, p->name,
                                   JK_RETRIES);
+        p->lb_retries =
+            jk_get_worker_lb_retries(props, p->name,
+                                  JK_LB_RETRIES);
 
         p->max_packet_size =
             jk_get_max_packet_size(props, p->name);
diff --git a/native/common/jk_ajp_common.h b/native/common/jk_ajp_common.h
index 0c1636c..7b342d0 100644
--- a/native/common/jk_ajp_common.h
+++ b/native/common/jk_ajp_common.h
@@ -363,6 +363,13 @@ struct ajp_worker
      */
     int retries;
 
+    /*
+     * Public property used in load balancer workers, meaning
+     * the maximum number of failover attempts between ajp
+     * workers of cluster.
+     */
+    int lb_retries;
+
     unsigned int max_packet_size;  /*  Maximum AJP Packet size */
 
     int retry_interval;            /*  Number of milliseconds to sleep before doing a retry */
diff --git a/native/common/jk_lb_worker.c b/native/common/jk_lb_worker.c
index a9894eb..d6e0251 100644
--- a/native/common/jk_lb_worker.c
+++ b/native/common/jk_lb_worker.c
@@ -1159,6 +1159,7 @@ static int JK_METHOD service(jk_endpoint_t *e,
     if (p->worker->sequence < p->worker->s->h.sequence)
         jk_lb_pull(p->worker, JK_FALSE, l);
     for (i = 0; i < num_of_workers; i++) {
+        jk_log(l, JK_LOG_DEBUG, "LB - num_of_workers: %d, retry: %d, lb_retries: %d", num_of_workers, i, p->worker->lb_retries);
         lb_sub_worker_t *rec = &(p->worker->lb_workers[i]);
         if (rec->s->state == JK_LB_STATE_BUSY) {
             if (ajp_has_endpoint(rec->worker, l)) {
@@ -1203,7 +1204,10 @@ static int JK_METHOD service(jk_endpoint_t *e,
                "service sticky_session=%d id='%s'",
                p->worker->sticky_session, sessionid ? sessionid : "empty");
 
-    while (recoverable == JK_TRUE) {
+    while (recoverable == JK_TRUE && attempt <= p->worker->lb_retries) {
+        if (JK_IS_DEBUG_LEVEL(l))
+	    jk_log(l, JK_LOG_DEBUG, "attempt %d, max attempts %d",
+		      attempt, p->worker->lb_retries);
         if (attempt >= num_of_workers) {
             retry++;
             if (retry >= p->worker->retries) {
@@ -1806,6 +1810,8 @@ static int JK_METHOD init(jk_worker_t *pThis,
     p->worker.we = we;
     p->retries = jk_get_worker_retries(props, p->name,
                                        JK_RETRIES);
+    p->lb_retries = jk_get_worker_lb_retries(props, p->name,
+                                       JK_LB_RETRIES);
     p->retry_interval =
             jk_get_worker_retry_interval(props, p->name,
                                         JK_SLEEP_DEF);
diff --git a/native/common/jk_lb_worker.h b/native/common/jk_lb_worker.h
index 71ee58d..d5260db 100644
--- a/native/common/jk_lb_worker.h
+++ b/native/common/jk_lb_worker.h
@@ -190,6 +190,7 @@ struct lb_worker
     int          error_escalation_time;
     int          max_reply_timeouts;
     int          retries;
+    int          lb_retries;
     int          retry_interval;
     int          lbmethod;
     int          lblock;
diff --git a/native/common/jk_service.h b/native/common/jk_service.h
index 5eb6bac..a84af93 100644
--- a/native/common/jk_service.h
+++ b/native/common/jk_service.h
@@ -36,6 +36,8 @@
 #include "jk_msg_buff.h"
 
 #define JK_RETRIES 2
+/* fredi - default */
+#define JK_LB_RETRIES 2
 
 #ifdef __cplusplus
 extern "C"
diff --git a/native/common/jk_util.c b/native/common/jk_util.c
index 656af40..b309328 100644
--- a/native/common/jk_util.c
+++ b/native/common/jk_util.c
@@ -109,6 +109,7 @@
 #define DEFAULT_WORKER_TYPE         JK_AJP13_WORKER_NAME
 #define SECRET_KEY_OF_WORKER        "secretkey"
 #define RETRIES_OF_WORKER           "retries"
+#define LB_RETRIES_OF_WORKER        "lb_retries"
 #define STATUS_FAIL_OF_WORKER       "fail_on_status"
 
 #define DEFAULT_WORKER              JK_AJP13_WORKER_NAME
@@ -228,6 +229,7 @@ static const char *unique_properties[] = {
     STYLE_SHEET_OF_WORKER,
     READ_ONLY_OF_WORKER,
     RETRIES_OF_WORKER,
+    LB_RETRIES_OF_WORKER,
     WORKER_MAINTAIN_PROPERTY_NAME,
     NAMESPACE_OF_WORKER,
     XML_NAMESPACE_OF_WORKER,
@@ -336,6 +338,7 @@ static const char *supported_properties[] = {
     BAD_RATING_OF_WORKER,
     SECRET_KEY_OF_WORKER,
     RETRIES_OF_WORKER,
+    LB_RETRIES_OF_WORKER,
     STATUS_FAIL_OF_WORKER,
     LIST_PROPERTY_NAME,
     MAINTAIN_PROPERTY_NAME,
@@ -1219,6 +1222,24 @@ int jk_get_worker_retries(jk_map_t *m, const char *wname, int def)
     return rv;
 }
 
+int jk_get_worker_lb_retries(jk_map_t *m, const char *wname, int def)
+{
+    char buf[1024];
+    int rv;
+    if (!m || !wname) {
+        return -1;
+    }
+
+    MAKE_WORKER_PARAM(LB_RETRIES_OF_WORKER);
+
+    rv = jk_map_get_int(m, buf, def);
+    if (rv < 1)
+        rv = 1;
+
+    return rv;
+}
+
+
 int jk_get_worker_recovery_opts(jk_map_t *m, const char *wname, int def)
 {
     char buf[PARAM_BUFFER_SIZE];
diff --git a/native/scripts/build/unix/.gitignore b/native/scripts/build/unix/.gitignore
new file mode 100644
index 0000000..9eac9d3
--- /dev/null
+++ b/native/scripts/build/unix/.gitignore
@@ -0,0 +1,3 @@
+install-sh
+ltmain.sh
+missing

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to