168
168
* Actual definitions of config globals
169
169
*/
170
170
171
- #ifndef DEFAULT_WORKER_FACTOR
172
- #define DEFAULT_WORKER_FACTOR 2
171
+ #ifndef DEFAULT_ASYNC_FACTOR
172
+ #define DEFAULT_ASYNC_FACTOR 2
173
173
#endif
174
174
#define WORKER_FACTOR_SCALE 16 /* scale factor to allow fractional values */
175
- static unsigned int worker_factor = DEFAULT_WORKER_FACTOR * WORKER_FACTOR_SCALE ;
175
+ static apr_uint32_t async_factor = DEFAULT_ASYNC_FACTOR ;
176
176
/* AsyncRequestWorkerFactor * 16 */
177
177
178
178
static int threads_per_child = 0 ; /* ThreadsPerChild */
@@ -675,7 +675,7 @@ static APR_INLINE int connections_above_limit(int *busy)
675
675
/* Off by 'listeners_disabled()' to avoid flip flop */
676
676
|| c_count - l_count < (apr_uint32_t )threads_per_child +
677
677
(i_count - listeners_disabled ()) *
678
- ( worker_factor / WORKER_FACTOR_SCALE ) ) {
678
+ async_factor ) {
679
679
return 0 ;
680
680
}
681
681
}
@@ -2880,7 +2880,6 @@ static void setup_threads_runtime(void)
2880
2880
APR_POLLSET_PORT ,
2881
2881
APR_POLLSET_EPOLL };
2882
2882
/* XXX: K-A or lingering close connection included in the async factor */
2883
- const apr_uint32_t async_factor = worker_factor / WORKER_FACTOR_SCALE ;
2884
2883
const apr_uint32_t pollset_size = (apr_uint32_t )num_listensocks +
2885
2884
(apr_uint32_t )threads_per_child *
2886
2885
(async_factor > 2 ? async_factor : 2 );
@@ -4639,6 +4638,7 @@ static const char *set_worker_factor(cmd_parms * cmd, void *dummy,
4639
4638
{
4640
4639
double val ;
4641
4640
char * endptr ;
4641
+ apr_uint32_t factor ;
4642
4642
const char * err = ap_check_cmd_context (cmd , GLOBAL_ONLY );
4643
4643
if (err != NULL ) {
4644
4644
return err ;
@@ -4651,9 +4651,10 @@ static const char *set_worker_factor(cmd_parms * cmd, void *dummy,
4651
4651
if (val <= 0 )
4652
4652
return "AsyncRequestWorkerFactor argument must be a positive number" ;
4653
4653
4654
- worker_factor = val * WORKER_FACTOR_SCALE ;
4655
- if (worker_factor < WORKER_FACTOR_SCALE ) {
4656
- worker_factor = WORKER_FACTOR_SCALE ;
4654
+ factor = val * WORKER_FACTOR_SCALE ;
4655
+ async_factor = factor / WORKER_FACTOR_SCALE ;
4656
+ if (async_factor < 1 ) {
4657
+ async_factor = 1 ;
4657
4658
}
4658
4659
return NULL ;
4659
4660
}
0 commit comments