Skip to content

Conversation

@Zakaria-Kofiro
Copy link
Collaborator

@Zakaria-Kofiro Zakaria-Kofiro commented Oct 15, 2025

Problem

Filter execution was causing 70-90% CPU spikes and frequent timeouts due to repeated creation of ScriptEngineManager and ScriptEngine instances, plus repeated JavaScript compilation on every filter execution.

Solution

Implemented caching for ScriptEngine instances (per file extension) and compiled JavaScript bytecode (per filter script). ScriptEngine cache uses ConcurrentHashMap with singleton ScriptEngineManager.

Files Changed

  • ExternalScript.java: Added ScriptEngine caching
  • ScriptRunner.java: Added CompiledScript caching with isolated contexts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants