Skip to content

Commit 484f843

Browse files
committed
add a flag for using old routing
1 parent 0a11528 commit 484f843

29 files changed

Lines changed: 160 additions & 10 deletions

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Release 6.0.25 (Not yet released)
44
* [Standalone] Adds a config option to specify the stop timeout for Passenger: `--stop-timeout 120` or `PASSENGER_STOP_TIMEOUT=120`.
55
* [Standalone] Changes Passenger's (not apps') start timeout to 25s (from 15s), stop timeouts default to 60s.
66
* [Ruby] Fixes an issue where Bundler would try to re-exec the process name instead of the script. Closes GH-2567 and GH-2577.
7+
* [Enterprise] Adds a temporary flag to allow reverting to previous routing behaviour, in order to mitigate possible performance regressions, this flag will become a no-op and eventually removed once the routing issues have been fixed. Closes GH-2579.
8+
- Apache: PassengerOldRouting on
9+
- Nginx: passenger_old_routing on;
10+
- Standalone: --old-routing
711
* Updated various library versions used in precompiled binaries (used for e.g. gem installs):
812
- cmake: 3.31.2 -> 3.31.3
913
- curl: 8.11.0 -> 8.11.1

dev/configkit-schemas/index.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@
302302
"read_only" : true,
303303
"type" : "boolean"
304304
},
305+
"old_routing" : {
306+
"default_value" : false,
307+
"has_default_value" : "static",
308+
"read_only" : true,
309+
"type" : "boolean"
310+
},
305311
"request_freelist_limit" : {
306312
"default_value" : 1024,
307313
"has_default_value" : "static",
@@ -806,6 +812,12 @@
806812
"read_only" : true,
807813
"type" : "boolean"
808814
},
815+
"old_routing" : {
816+
"default_value" : false,
817+
"has_default_value" : "static",
818+
"read_only" : true,
819+
"type" : "boolean"
820+
},
809821
"oom_score" : {
810822
"read_only" : true,
811823
"type" : "string"
@@ -1690,6 +1702,12 @@
16901702
"read_only" : true,
16911703
"type" : "boolean"
16921704
},
1705+
"old_routing" : {
1706+
"default_value" : false,
1707+
"has_default_value" : "static",
1708+
"read_only" : true,
1709+
"type" : "boolean"
1710+
},
16931711
"passenger_root" : {
16941712
"read_only" : true,
16951713
"required" : true,

resources/templates/standalone/http.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ passenger_user_switching off;
3232
<%= nginx_http_option(:pool_idle_time) %>
3333
<%= nginx_http_option(:max_preloader_idle_time) %>
3434
<%= nginx_http_option(:turbocaching) %>
35+
<%= nginx_http_option(:old_routing) %>
3536
<%= nginx_http_option(:instance_registry_dir) %>
3637
<%= nginx_http_option(:spawn_dir) %>
3738
<%= nginx_http_option(:disable_security_update_check) %>

src/agent/Core/ApplicationPool/Group.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#define _PASSENGER_APPLICATION_POOL2_GROUP_H_
2828

2929
#include <string>
30-
#include <map>
31-
#include <queue>
3230
#include <deque>
3331
#include <boost/thread.hpp>
3432
#include <boost/bind/bind.hpp>
@@ -202,6 +200,8 @@ class Group: public boost::enable_shared_from_this<Group> {
202200
Callback shutdownCallback;
203201
GroupPtr selfPointer;
204202

203+
// Whether to use the old routing algorithm
204+
bool oldRouting;
205205

206206
/****** Initialization and shutdown ******/
207207

src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ Group::Group(Pool *_pool, const Options &_options)
136136
}
137137

138138
detachedProcessesCheckerActive = false;
139+
oldRouting = _options.oldRouting;
139140
}
140141

141142
Group::~Group() {

src/agent/Core/ApplicationPool/Group/SessionManagement.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
#ifdef INTELLISENSE
3030
#include <Core/ApplicationPool/Pool.h>
3131
#endif
32-
#include <Shared/Fundamentals/Utils.h>
3332
#include <Core/ApplicationPool/Group.h>
34-
#include <cassert>
3533

3634
/*************************************************************************
3735
*
@@ -361,7 +359,7 @@ Group::get(const Options &newOptions, const GetCallback &callback,
361359

362360
bool
363361
Group::useNewRouting() const {
364-
return !Agent::Fundamentals::getEnvBool("PASSENGER_OLD_ROUTING", false);
362+
return !oldRouting;
365363
}
366364

367365
} // namespace ApplicationPool2

src/agent/Core/ApplicationPool/Options.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
#include <string>
3030
#include <vector>
31-
#include <utility>
3231
#include <boost/shared_array.hpp>
3332
#include <WrapperRegistry/Registry.h>
3433
#include <DataStructures/HashedStaticString.h>
@@ -79,7 +78,7 @@ class Options {
7978
template<typename OptionsClass, typename StaticStringClass>
8079
static vector<StaticStringClass *> getStringFields(OptionsClass &options) {
8180
vector<StaticStringClass *> result;
82-
result.reserve(20);
81+
result.reserve(30);
8382

8483
result.push_back(&options.appRoot);
8584
result.push_back(&options.appGroupName);
@@ -443,6 +442,8 @@ class Options {
443442

444443
/*********************************/
445444

445+
bool oldRouting;
446+
446447
/**
447448
* Creates a new Options object with the default values filled in.
448449
* One must still set appRoot manually, after having used this constructor.
@@ -480,7 +481,8 @@ class Options {
480481
statThrottleRate(DEFAULT_STAT_THROTTLE_RATE),
481482
maxRequests(0),
482483
currentTime(0),
483-
noop(false)
484+
noop(false),
485+
oldRouting(false)
484486
/*********************************/
485487
{
486488
/*********************************/

src/agent/Core/Config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ using namespace std;
155155
* max_instances_per_app unsigned integer - read_only
156156
* max_pool_size unsigned integer - default(6)
157157
* multi_app boolean - default(false),read_only
158+
* old_routing boolean - default(false),read_only
158159
* oom_score string - read_only
159160
* passenger_root string required read_only
160161
* pid_file string - read_only

src/agent/Core/Controller/Config.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ parseControllerBenchmarkMode(const StaticString &mode) {
115115
* max_instances_per_app unsigned integer - read_only
116116
* min_spare_clients unsigned integer - default(0)
117117
* multi_app boolean - default(true),read_only
118+
* old_routing boolean - default(false),read_only
118119
* request_freelist_limit unsigned integer - default(1024)
119120
* response_buffer_high_watermark unsigned integer - default(134217728)
120121
* server_software string - default("Phusion_Passenger/6.0.25")
@@ -138,6 +139,7 @@ class ControllerSchema: public ServerKit::HttpServerSchema {
138139
add("thread_number", UINT_TYPE, REQUIRED | READ_ONLY);
139140
add("multi_app", BOOL_TYPE, OPTIONAL | READ_ONLY, true);
140141
add("turbocaching", BOOL_TYPE, OPTIONAL | READ_ONLY, true);
142+
add("old_routing", BOOL_TYPE, OPTIONAL | READ_ONLY, false);
141143
add("integration_mode", STRING_TYPE, OPTIONAL | READ_ONLY, DEFAULT_INTEGRATION_MODE);
142144

143145
add("user_switching", BOOL_TYPE, OPTIONAL, true);
@@ -349,6 +351,7 @@ class ControllerMainConfig {
349351
bool userSwitching: 1;
350352
bool defaultStickySessions: 1;
351353
bool gracefulExit: 1;
354+
bool oldRouting: 1;
352355

353356
/*******************/
354357
/*******************/
@@ -366,7 +369,8 @@ class ControllerMainConfig {
366369
singleAppMode(!config["multi_app"].asBool()),
367370
userSwitching(config["user_switching"].asBool()),
368371
defaultStickySessions(config["default_sticky_sessions"].asBool()),
369-
gracefulExit(config["graceful_exit"].asBool())
372+
gracefulExit(config["graceful_exit"].asBool()),
373+
oldRouting(config["old_routing"].asBool())
370374

371375
/*******************/
372376
{
@@ -396,6 +400,7 @@ class ControllerMainConfig {
396400
SWAP_BITFIELD(bool, userSwitching);
397401
SWAP_BITFIELD(bool, defaultStickySessions);
398402
SWAP_BITFIELD(bool, gracefulExit);
403+
SWAP_BITFIELD(bool, oldRouting);
399404

400405
/*******************/
401406

src/agent/Core/Controller/InitRequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Controller::fillPoolOptionsFromConfigCaches(Options &options,
206206
options.statThrottleRate = mainConfig.statThrottleRate;
207207
options.maxRequests = requestConfig->defaultMaxRequests;
208208
options.stickySessionsCookieAttributes = requestConfig->defaultStickySessionsCookieAttributes;
209-
209+
options.oldRouting = mainConfig.oldRouting;
210210
/******************************/
211211
}
212212

0 commit comments

Comments
 (0)