mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 15:48:08 -05:00
feat: use SharedArrayBuffer/Atomics for worker/main thread communication
This commit is contained in:
BIN
chainsafe-threads-1.11.3.tgz
Normal file
BIN
chainsafe-threads-1.11.3.tgz
Normal file
Binary file not shown.
@@ -80,6 +80,7 @@
|
||||
"wait-port": "^1.1.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@chainsafe/threads": "file:./chainsafe-threads-1.11.3.tgz",
|
||||
"dns-over-http-resolver": "^2.1.1",
|
||||
"loupe": "^2.3.6",
|
||||
"elliptic": ">=6.6.1"
|
||||
|
||||
@@ -46,6 +46,9 @@ export class HistoricalStateRegen implements HistoricalStateWorkerApi {
|
||||
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
|
||||
// the initialization to timeout. The number below is big enough to almost disable the timeout
|
||||
timeout: 5 * 60 * 1000,
|
||||
// Use async atomics for worker with internal job queue coordination
|
||||
// Worker handles queued async requests that need atomic coordination
|
||||
atomics: "async",
|
||||
});
|
||||
|
||||
return new HistoricalStateRegen({...modules, api});
|
||||
|
||||
@@ -279,6 +279,9 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
||||
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
|
||||
// the initialization to timeout. The number below is big enough to almost disable the timeout
|
||||
timeout: 5 * 60 * 1000,
|
||||
// Use sync atomics for CPU-bound signature verification workers
|
||||
// Workers process jobs synchronously with no event loop requirements
|
||||
atomics: "sync",
|
||||
});
|
||||
|
||||
workerDescriptor.status = {code: WorkerStatusCode.initializing, initPromise};
|
||||
|
||||
@@ -157,6 +157,9 @@ export class WorkerNetworkCore implements INetworkCore {
|
||||
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
|
||||
// the initialization to timeout. The number below is big enough to almost disable the timeout
|
||||
timeout: 5 * 60 * 1000,
|
||||
// Use async atomics for long-lived network worker with event-driven architecture
|
||||
// This keeps the event loop alive for gossip, reqresp, and peer connections
|
||||
atomics: "async",
|
||||
// TODO: types are broken on spawn, which claims that `NetworkWorkerApi` does not satisfies its contrains
|
||||
})) as unknown as ModuleThread<NetworkWorkerApi>;
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ export class Discv5Worker extends (EventEmitter as {new (): StrictEventEmitter<E
|
||||
// A Lodestar Node may do very expensive task at start blocking the event loop and causing
|
||||
// the initialization to timeout. The number below is big enough to almost disable the timeout
|
||||
timeout: 5 * 60 * 1000,
|
||||
// Use async atomics for long-lived discovery worker with event-driven architecture
|
||||
// This keeps the event loop alive for discovery events and DHT operations
|
||||
atomics: "async",
|
||||
});
|
||||
|
||||
return new Discv5Worker(opts, workerApi);
|
||||
|
||||
@@ -25,6 +25,9 @@ export class DecryptKeystoresThreadPool {
|
||||
// The number below is big enough to almost disable the timeout
|
||||
// which helps during tests run on unpredictably slow hosts
|
||||
timeout: 5 * 60 * 1000,
|
||||
// Use sync atomics for CPU-bound keystore decryption workers
|
||||
// Workers perform synchronous KDF computation with no event loop requirements
|
||||
atomics: "sync",
|
||||
}),
|
||||
{
|
||||
// Adjust worker pool size based on keystore count
|
||||
|
||||
@@ -775,10 +775,9 @@
|
||||
"@chainsafe/swap-or-not-shuffle-win32-arm64-msvc" "1.2.1"
|
||||
"@chainsafe/swap-or-not-shuffle-win32-x64-msvc" "1.2.1"
|
||||
|
||||
"@chainsafe/threads@^1.11.3":
|
||||
"@chainsafe/threads@^1.11.3", "@chainsafe/threads@file:./chainsafe-threads-1.11.3.tgz":
|
||||
version "1.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@chainsafe/threads/-/threads-1.11.3.tgz#7dba606277bfb0e9c8a54325da0372494ec02042"
|
||||
integrity sha512-wTIHTOOJ3MMRFtnJJT6KJCuauyv8pgs79m5ipspyPjHdKM9HJnkeZcoo06G3qArx2xMvd6MqNj1TLfnh5iFvaQ==
|
||||
resolved "file:./chainsafe-threads-1.11.3.tgz#a602e8c4a007ba14f1e8f523967cf996c6bd88b4"
|
||||
dependencies:
|
||||
callsites "^3.1.0"
|
||||
debug "^4.2.0"
|
||||
|
||||
Reference in New Issue
Block a user