-
Notifications
You must be signed in to change notification settings - Fork 201
Description
In high-throughput, multithreaded Java applications, managing GraalJS contexts efficiently is critical for achieving low-latency and scalable performance. Currently, developers must implement custom pooling strategies to reuse contexts across threads, as GraalJS contexts are not thread-safe and there is no built-in pooling mechanism available.
Are there any plans to introduce native context pooling support in the GraalJS or GraalVM libraries?
The addition of native context pooling support in the GraalJS or GraalVM libraries— A built-in pooling mechanism similar to JDBC connection pools or executor thread pools would:
- Simplify integration in multithreaded environments
- Reduce boilerplate and error-prone pooling logic
- Enable pre-warmed context reuse for faster execution
- Improve adoption in latency-sensitive, high-performance systems
- Facilitate seamless migration from Nashorn, which supported multithreaded access natively and is still used in legacy systems
Providing inbuilt context pooling support with options to warmup strategies would be especially valuable for services executing large JS functions with varied input parameters, where startup overhead and context initialization time are significant performance bottlenecks.
Assuming this capability isn't currently on the roadmap, it may be worth considering as a valuable enhancement.