ContextBridge IPC overhead during high-frequency concurrent messaging
0 reputation · 19 Jun 2023, 09:34 UTC
ContextBridge IPC and Context Isolation
Electron's contextBridge API exposes a limited interface from the preload script to the isolated renderer context. Context Isolation separates the preload and renderer JavaScript environments to reduce prototype pollution risk, and each message crosses a serialization boundary using Structured Clone.
Concurrent request behavior
Under burst traffic with many concurrent ipcRenderer.invoke calls from a renderer, uncertainty remains about how Electron queues and processes those requests through the contextBridge layer when the main process is busy. The serialization overhead per message is documented, but the documented throughput limits, backpressure behavior, and whether latency scales linearly with concurrent request count are not clearly defined.
What is the documented queuing model for concurrent IPC invocations through contextBridge? Is there a documented limit or recommended concurrency bound for invoke calls? Does the contextBridge layer add measurable latency beyond the base IPC serialization cost under concurrent load?