]> granicus.if.org Git - apache/commitdiff
Add initial structures for connection pool and load balancer.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 21:20:07 +0000 (21:20 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 21:20:07 +0000 (21:20 +0000)
Submitted by: mturk

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104566 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.h

index 4ff5f1c8dc70fda7597e898f649a9509692be9f6..e973b966ab6396424e7d72d34eb7786037ff6594 100644 (file)
@@ -51,6 +51,7 @@
 #include "apr_date.h"
 #include "apr_strmatch.h"
 #include "apr_fnmatch.h"
+#include "apr_reslist.h"
 #define APR_WANT_STRFUNC
 #include "apr_want.h"
 
@@ -99,8 +100,8 @@ struct proxy_remote {
 };
 
 struct proxy_alias {
-    const char *real;
-    const char *fake;
+    const char  *real;
+    const char  *fake;
 };
 
 struct dirconn_entry {
@@ -123,6 +124,8 @@ typedef struct {
     apr_array_header_t *noproxies;
     apr_array_header_t *dirconn;
     apr_array_header_t *allowed_connect_ports;
+    apr_array_header_t *workers;
+    apr_array_header_t *balancers;
     const char *domain;                /* domain name to use in absence of a domain name in the request */
     int req;                   /* true if proxy requests are enabled */
     char req_set;
@@ -188,6 +191,60 @@ typedef struct {
         int content_length; /* length of the content */
 } proxy_completion;
 
+/* Physical connection to the backend server */
+typedef struct {
+    apr_pool_t   *pool; /* Subpool used for creating socket */
+    apr_socket_t *sock;
+    int          close; /* Close 'this' connection */
+} proxy_conn;
+
+/* Connection pool */
+typedef struct {
+    apr_pool_t     *pool;   /* The pool used in constructor and destructor calls */
+    apr_sockaddr_t *addr;   /* Preparsed remote address info */
+    int            min;     /* Desired minimum number of available connections */
+    int            smax;    /* Soft maximum on the total number of connections */
+    int            hmax;    /* Hard maximum on the total number of connections */
+#if APR_HAS_THREADS
+    apr_reslist_t  *res;    /* Connection resource list */
+#else
+    proxy_conn     *conn;   /* Single connection for prefork mpm's */
+#endif
+} proxy_conn_pool;
+
+/* Worker configuration */
+typedef struct {
+    int             status;
+    apr_time_t      error_time; /* time of the last error */
+    apr_interval_time_t retry;  /* retry interval */
+    int             retries;    /* number of retries on this worker */
+    int             lbfactor;   /* initial load balancing factor */
+    const char      *scheme;    /* scheme to use ajp|http|https */
+    const char      *hostname;  /* remote backend address */
+    apr_port_t      port;
+    proxy_conn_pool *cp;        /* Connection pool to use */
+    void            *opaque;    /* per scheme worker data */
+} proxy_worker;
+
+/* Runtime worker status informations. Shared in scoreboard */
+typedef struct {
+    proxy_worker    *w;
+    double          lbfactor;   /* dynamic lbfactor */
+    double          lbsatus;    /* Current lbstatus */
+    apr_size_t      transfered; /* Number of bytes transfered to remote */
+    apr_size_t      readed;     /* Number of bytes readed from remote */
+} proxy_runtime_worker;
+
+struct proxy_balancer {
+    apr_array_header_t *workers; /* array of proxy_runtime_workers */
+    const char *name;            /* name of the load balancer */
+    const char *sticky;          /* sticky session identifier */
+    int         sticky_force;    /* Disable failover for sticky sessions */
+    apr_interval_time_t timeout; /* Timeout for waiting on free connection */
+#if APR_HAS_THREADS
+    apr_thread_mutex_t  *mutex;  /* Thread lock for updating lb params */
+#endif
+};
 
 /* hooks */
 
@@ -255,6 +312,9 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **, const char *, ap
 PROXY_DECLARE(int) ap_proxy_ssl_enable(conn_rec *c);
 PROXY_DECLARE(int) ap_proxy_ssl_disable(conn_rec *c);
 
+/* Connection pool API */
+
+
 /* For proxy_util */
 extern module PROXY_DECLARE_DATA proxy_module;