From 1a2aa6dbf574c7f052f2c06a8d0ad68cb809510e Mon Sep 17 00:00:00 2001 From: Andrea Di Cesare Date: Thu, 13 Jun 2024 16:59:25 +0200 Subject: [PATCH] :memo: Document option /core/plugins-packages: --- docs/plugins/deploy.adoc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/plugins/deploy.adoc b/docs/plugins/deploy.adoc index 650ac971..e717ae33 100644 --- a/docs/plugins/deploy.adoc +++ b/docs/plugins/deploy.adoc @@ -137,6 +137,32 @@ To deploy the plugin copy its jar file and the jars of the dependencies into the [source,bash] $ cp target/random-string-service.jar target/lib/* /plugins/ +== Speeding Up Plugin Scanning at Startup + +If a custom plugin has many dependencies, you may need to copy numerous JAR files into the `./plugins` directory. All JARs are scanned to find plugins (classes annotated with `@RegisterPlugin`), which can slow down the bootstrap process. + +To address this, the configuration option `/core/plugins-packages` allows you to limit the scanning to specific packages (and their subpackages). + +```yml +core: + ... + # Limit the scanning of classes annotated with @RegisterPlugin + # to the specified packages. This can speed up the boot time + # for large plugin JARs. It is usually not required. + # Use an empty array to not limit scanning. + # Always add the package org.restheart to the list. + plugins-packages: [ org.restheart, com.acme ] +``` + +For example, the following command limits the scanning to `org.restheart` and `com.acme`: + +[source,bash] +---- +$ RHO='/core/plugins-packages->[ "org.restheart", "com.acme" ]' java -jar restheart.jar +---- + +By specifying only the necessary packages, you can significantly reduce startup times when dealing with large plugin JARs. + == JavaScript Plugins IMPORTANT: JavaScript plugins can be deployed only running link:/docs/graalvm/#run-restheart-with-graalvm[RESTHeart on GraalVM] and on restheart native.