Index: /branches/rel_apv_10_7_4/usr/click/lib/libhttp_proxy/client_states.c
===================================================================
--- /branches/rel_apv_10_7_4/usr/click/lib/libhttp_proxy/client_states.c	(revision 40189)
+++ /branches/rel_apv_10_7_4/usr/click/lib/libhttp_proxy/client_states.c	(working copy)
@@ -352,16 +352,14 @@
 			}
 		}
 
-		/* ddos rps control */
-		if (ddos_is_on()) {
-			if(http_rps_check_overload(client_conn_data, &action) == HTTP_ACL_DENY) {
-				if (action == RPS_ACTION_RESET) {
-					action = SLB_ACL_DENY_RESET;
-				} else {
-					action = SLB_ACL_DENY_ERRORPAGE;
-				}
-				return action;
+		/* acl http rule rps control */
+		if(http_rps_check_overload(client_conn_data, &action) == HTTP_ACL_DENY) {
+			if (action == RPS_ACTION_RESET) {
+				action = SLB_ACL_DENY_RESET;
+			} else {
+				action = SLB_ACL_DENY_ERRORPAGE;
 			}
+			return action;
 		}
 
 		destroy_selective_copy_http_hdrs(http_hdrs);
Index: /branches/rel_apv_10_7_4/usr/src/sys/click/app/acl/http_acl_cli.c
===================================================================
--- /branches/rel_apv_10_7_4/usr/src/sys/click/app/acl/http_acl_cli.c	(revision 40189)
+++ /branches/rel_apv_10_7_4/usr/src/sys/click/app/acl/http_acl_cli.c	(working copy)
@@ -74,6 +74,7 @@
 int hash_table_global_status = 0;
 int *hash_table_global_status_p = &hash_table_global_status;
 struct acl_rule_on_vs  acl_http_rule_on_vs_list[HTTP_RULE_CFG_MAX][MAX_HTTP_ACL_RULE_APPLY] __cacheline_aligned;
+int rps_click_callout_running = 0;
 
 uma_zone_t http_acl_rps_guest_zone;
 
@@ -131,6 +132,23 @@
     return apply_count;
 }
 
+int acl_get_http_rule_rps_rule_apply_count(int cfg_type)
+{
+    int apply_count = 0;
+
+    for (int i = 1; i <= MAX_HTTP_ACL_SUBNET; i++) {
+        for (int j = 0; j < MAX_ITEM_IN_SUBNET; j++) {
+            if (
+                HTTP_ACL_RULE_ID_CUSTOMER(http_acl_rule_subnets[cfg_type][i].rule_id[j]) &&
+                http_acl_rules[cfg_type][http_acl_rule_subnets[cfg_type][i].rule_id[j]].type == HTTP_ACL_RPS
+            ) {
+                apply_count++;
+            }
+        }
+    }
+    return apply_count;
+}
+
 void init_http_acl(void){
 	http_acl_rps_guest_zone = zinit("http acl rps guest node", sizeof(struct rps_guest), NULL,
                                     NULL, NULL, NULL, 0);
@@ -139,16 +157,25 @@
            exit(1);
     }
 
+    init_rps_callout();
 }
 
 void init_rps_callout()
 {
    click_callout_init(&http_acl_callout);
+   rps_click_callout_running = 0;
 }
 
 void start_rps_callout()
 {
     click_callout_reset(&http_acl_callout, HZ, http_acl_update_max_rps, 0);
+    rps_click_callout_running = 1;
+}
+
+void stop_rps_callout()
+{
+    click_callout_stop(&http_acl_callout);
+    rps_click_callout_running = 0;
 }
 
 void http_acl_update_max_rps(void* arg)
@@ -156,16 +183,14 @@
     int cfg_type = HTTP_RULE_CFG_MANUAL;
     struct http_acl_rule_subnet* p_subnet = NULL;
 
-    if (ddos_config.ddos_switch == DDOS_ON) {
-        for (int i = 0; i < MAX_HTTP_ACL_SUBNET+1; i++) {
-            if (!acl_is_http_subnet_empty(&http_acl_rule_subnets[cfg_type][i])) {
-                p_subnet = &http_acl_rule_subnets[cfg_type][i];
-                p_subnet->max_perip_rps_last_second = p_subnet->max_perip_rps;
-                p_subnet->max_perip_rps = 0;
-            }
+    for (int i = 0; i < MAX_HTTP_ACL_SUBNET+1; i++) {
+        if (!acl_is_http_subnet_empty(&http_acl_rule_subnets[cfg_type][i])) {
+            p_subnet = &http_acl_rule_subnets[cfg_type][i];
+            p_subnet->max_perip_rps_last_second = p_subnet->max_perip_rps;
+            p_subnet->max_perip_rps = 0;
         }
-        click_callout_reset(&http_acl_callout, HZ, http_acl_update_max_rps, NULL);
     }
+    click_callout_reset(&http_acl_callout, HZ, http_acl_update_max_rps, NULL);
 }
 
 struct rps_guest * http_acl_hash_guest_ctor()
@@ -1455,6 +1480,17 @@
     } else {
         add_http_rule_on_vs_recod(cfg_type, rule_id, vs->vs_id);
     }
+
+    if (rps_click_callout_running == 0) {
+        int apply_rps_rule_count = 0;
+        apply_rps_rule_count = acl_get_http_rule_rps_rule_apply_count(HTTP_RULE_CFG_MANUAL);
+        apply_rps_rule_count += acl_get_http_rule_rps_rule_apply_count(HTTP_RULE_CFG_AUTO);
+
+        if (apply_rps_rule_count > 0) {
+            start_rps_callout();
+        }
+    }
+
     return CLI_ACL_SUCCESS;
 }
 
@@ -2291,8 +2327,18 @@
         } else {
             remove_http_rule_on_vs_recod(cfg_type, rule_id, vs->vs_id);
         }
-        return CLI_ACL_SUCCESS;
     }
+
+    if (rps_click_callout_running == 1) {
+        int apply_rps_rule_count = 0;
+        apply_rps_rule_count = acl_get_http_rule_rps_rule_apply_count(HTTP_RULE_CFG_MANUAL);
+        apply_rps_rule_count += acl_get_http_rule_rps_rule_apply_count(HTTP_RULE_CFG_AUTO);
+
+        if (apply_rps_rule_count == 0) {
+            stop_rps_callout();
+        }
+    }
+
     return CLI_ACL_SUCCESS;
 }
 
Index: /branches/rel_apv_10_7_4/usr/src/sys/click/app/ddos/ddos_cli.c
===================================================================
--- /branches/rel_apv_10_7_4/usr/src/sys/click/app/ddos/ddos_cli.c	(revision 40189)
+++ /branches/rel_apv_10_7_4/usr/src/sys/click/app/ddos/ddos_cli.c	(working copy)
@@ -189,7 +189,6 @@
             click_topn_memory_init = 1;
         }
     }
-    start_rps_callout();
     ddos_config.ddos_switch = DDOS_ON;
     update_conn_data2_status();
 
Index: /branches/rel_apv_10_7_4/usr/src/sys/click/netinet/click_ddos.c
===================================================================
--- /branches/rel_apv_10_7_4/usr/src/sys/click/netinet/click_ddos.c	(revision 40189)
+++ /branches/rel_apv_10_7_4/usr/src/sys/click/netinet/click_ddos.c	(working copy)
@@ -2006,8 +2006,7 @@
 
 	/*init the topn function*/
 	click_ddos_topn_init();
-	
-	init_rps_callout();
+
 	return 0;
 } 
 
