[nginx] svn commit: r5136 - trunk/src/http

ru at nginx.com ru at nginx.com
Mon Mar 25 13:41:30 UTC 2013


Author: ru
Date: 2013-03-25 13:41:30 +0000 (Mon, 25 Mar 2013)
New Revision: 5136
URL: http://trac.nginx.org/nginx/changeset/5136/nginx

Log:
Upstream: removed sorting of upstream servers.

Sorting of upstream servers by their weights is not required by
current balancing algorithms.

This will likely change mapping to backends served by ip_hash
weighted upstreams.


Modified:
   trunk/src/http/ngx_http_upstream_round_robin.c

Modified: trunk/src/http/ngx_http_upstream_round_robin.c
===================================================================
--- trunk/src/http/ngx_http_upstream_round_robin.c	2013-03-25 13:38:59 UTC (rev 5135)
+++ trunk/src/http/ngx_http_upstream_round_robin.c	2013-03-25 13:41:30 UTC (rev 5136)
@@ -10,8 +10,6 @@
 #include <ngx_http.h>
 
 
-static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
-    const void *two);
 static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
     ngx_http_upstream_rr_peer_data_t *rrp);
 
@@ -93,10 +91,6 @@
 
         us->peer.data = peers;
 
-        ngx_sort(&peers->peer[0], (size_t) n,
-                 sizeof(ngx_http_upstream_rr_peer_t),
-                 ngx_http_upstream_cmp_servers);
-
         /* backup servers */
 
         n = 0;
@@ -151,10 +145,6 @@
 
         peers->next = backup;
 
-        ngx_sort(&backup->peer[0], (size_t) n,
-                 sizeof(ngx_http_upstream_rr_peer_t),
-                 ngx_http_upstream_cmp_servers);
-
         return NGX_OK;
     }
 
@@ -216,18 +206,6 @@
 }
 
 
-static ngx_int_t
-ngx_http_upstream_cmp_servers(const void *one, const void *two)
-{
-    ngx_http_upstream_rr_peer_t  *first, *second;
-
-    first = (ngx_http_upstream_rr_peer_t *) one;
-    second = (ngx_http_upstream_rr_peer_t *) two;
-
-    return (first->weight < second->weight);
-}
-
-
 ngx_int_t
 ngx_http_upstream_init_round_robin_peer(ngx_http_request_t *r,
     ngx_http_upstream_srv_conf_t *us)



More information about the nginx-devel mailing list