Skip to content

Commit a68feff

Browse files
Merge pull request #6247 from cloudflare/harris/EW-9722-clean-up-gates
Remove increase-external-memory-adjustment-for-fetch autogate
2 parents b7f4467 + 913e8a1 commit a68feff

File tree

4 files changed

+11
-30
lines changed

4 files changed

+11
-30
lines changed

src/workerd/api/http.c++

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <workerd/jsg/ser.h>
2020
#include <workerd/jsg/url.h>
2121
#include <workerd/util/abortable.h>
22-
#include <workerd/util/autogate.h>
2322
#include <workerd/util/entropy.h>
2423
#include <workerd/util/http-util.h>
2524
#include <workerd/util/mimetype.h>
@@ -1465,13 +1464,6 @@ jsg::Promise<jsg::Ref<Response>> fetchImplNoOutputLock(jsg::Lock& js,
14651464
// requires a significant rewrite of the code below. It'll probably get simpler, though?
14661465
kj::Own<kj::HttpClient> client = asHttpClient(kj::mv(clientWithTracing.client));
14671466

1468-
// fetch() requests use a lot of unaccounted C++ memory, so we adjust memory usage to pressure
1469-
// the GC and protect against OOMs. When the autogate is enabled, this adjustment is applied
1470-
// centrally to all subrequests in IoContext::getSubrequestNoChecks() instead.
1471-
if (!util::Autogate::isEnabled(util::AutogateKey::INCREASE_EXTERNAL_MEMORY_ADJUSTMENT_FOR_FETCH)) {
1472-
client = client.attach(js.getExternalMemoryAdjustment(3 * 1024));
1473-
}
1474-
14751467
kj::HttpHeaders headers(ioContext.getHeaderTable());
14761468
jsRequest->shallowCopyHeadersTo(headers);
14771469

src/workerd/io/io-context.c++

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <workerd/io/worker.h>
1010
#include <workerd/jsg/jsg.h>
1111
#include <workerd/jsg/setup.h>
12-
#include <workerd/util/autogate.h>
1312
#include <workerd/util/own-util.h>
1413
#include <workerd/util/sentry.h>
1514
#include <workerd/util/uncaught-exception-source.h>
@@ -942,15 +941,12 @@ kj::Own<WorkerInterface> IoContext::getSubrequestNoChecks(
942941
}
943942

944943
// Subrequests use a lot of unaccounted C++ memory, so we adjust V8's external memory counter to
945-
// pressure the GC and protect against OOMs. When the autogate is enabled, we apply this
946-
// adjustment to ALL subrequests (not just fetch). We only apply this when the JS lock is held
947-
// (i.e., when JS code initiated the subrequest); infrastructure paths that bypass JS don't need
948-
// it.
949-
if (util::Autogate::isEnabled(util::AutogateKey::INCREASE_EXTERNAL_MEMORY_ADJUSTMENT_FOR_FETCH)) {
950-
KJ_IF_SOME(lock, currentLock) {
951-
jsg::Lock& js = lock;
952-
ret = ret.attach(js.getExternalMemoryAdjustment(8 * 1024));
953-
}
944+
// pressure the GC and protect against OOMs. We apply this adjustment to ALL subrequests (not
945+
// just fetch). We only apply this when the JS lock is held (i.e., when JS code initiated the
946+
// subrequest); infrastructure paths that bypass JS don't need it.
947+
KJ_IF_SOME(lock, currentLock) {
948+
jsg::Lock& js = lock;
949+
ret = ret.attach(js.getExternalMemoryAdjustment(8 * 1024));
954950
}
955951

956952
return kj::mv(ret);
@@ -1042,13 +1038,11 @@ kj::Own<CacheClient> IoContext::getCacheClient() {
10421038
limitEnforcer->newSubrequest(false);
10431039
auto ret = getIoChannelFactory().getCache();
10441040

1045-
// Apply external memory adjustment for Cache API subrequests when autogate is enabled (same as
1046-
// other subrequests in getSubrequestNoChecks).
1047-
if (util::Autogate::isEnabled(util::AutogateKey::INCREASE_EXTERNAL_MEMORY_ADJUSTMENT_FOR_FETCH)) {
1048-
KJ_IF_SOME(lock, currentLock) {
1049-
jsg::Lock& js = lock;
1050-
ret = ret.attach(js.getExternalMemoryAdjustment(8 * 1024));
1051-
}
1041+
// Apply external memory adjustment for Cache API subrequests (same as other subrequests in
1042+
// getSubrequestNoChecks).
1043+
KJ_IF_SOME(lock, currentLock) {
1044+
jsg::Lock& js = lock;
1045+
ret = ret.attach(js.getExternalMemoryAdjustment(8 * 1024));
10521046
}
10531047

10541048
return kj::mv(ret);

src/workerd/util/autogate.c++

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ kj::StringPtr KJ_STRINGIFY(AutogateKey key) {
2525
return "streaming-tail-worker"_kj;
2626
case AutogateKey::TAIL_STREAM_REFACTOR:
2727
return "tail-stream-refactor"_kj;
28-
case AutogateKey::INCREASE_EXTERNAL_MEMORY_ADJUSTMENT_FOR_FETCH:
29-
return "increase-external-memory-adjustment-for-fetch"_kj;
3028
case AutogateKey::RUST_BACKED_NODE_DNS:
3129
return "rust-backed-node-dns"_kj;
3230
case AutogateKey::RPC_USE_EXTERNAL_PUSHER:

src/workerd/util/autogate.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ enum class AutogateKey {
2020
STREAMING_TAIL_WORKER,
2121
// Enable refactor used to consolidate the different tail worker stream implementations.
2222
TAIL_STREAM_REFACTOR,
23-
// When enabled, increases the external memory adjustment for fetch() from 3 KiB to 8 KiB. This
24-
// brings it closer to the actual C++ memory overhead.
25-
INCREASE_EXTERNAL_MEMORY_ADJUSTMENT_FOR_FETCH,
2623
// Enable Rust-backed Node.js DNS implementation
2724
RUST_BACKED_NODE_DNS,
2825
// Use ExternalPusher instead of StreamSink to handle streams in RPC.

0 commit comments

Comments
 (0)