Vespa Plugins

For Big Data Serving, writing custom code in plugins is often required - in Vespa, such plugins (called Components) are run in the Stateless Java Container Cluster:

  • Query Processors implemented as Searchers enables query enrichment, rewrites and external data lookup as part of query processing.
  • Document processors is similar and operates on incoming documents in an asynchronuous environment for high throughput.
  • Handlers and renderers are Other Components that lets application owners build rich APIs, see the Vespa Container.

Find sample applications for all component types in Getting Started, where Troubleshooting is also found.

Developing Plugins

The development cycle is normally creating a plugin (based on the sample applications), deploying it to Vespa, write tests, iterate:

Build

All the Vespa sample applications use the bundle plugin to build the Components.

Configure

A key Vespa feature is code and configuration concistency, deployed using an application package. This ensures that code and configuration is in sync, and loaded atomically when deployed. This is done by generating config classes from config definition files. In Vespa and application code, configuration is hence accessed through generated config classes - read more in the Cloud Configuration System.

The Maven target generate-sources (invoked by mvn install) uses metal-names.def to generate target/generated-sources/vespa-configgen-plugin/com/mydomain/example/MetalNamesConfig.java.

After generating config classes, they will resolve in tools like IntelliJ IDEA.

Tests

Examples unit tests are found in MetalSearcherTest.java. testAddedOrTerm1 and testAddedOrTerm2 illustrates two ways of doing the same test:

Read more in testing.

Automate

Add testing to automate deployments:

  • System Tests for functional tests - a system test is an integration test that tests the application API endpoints
  • Staging Tests to validate the instance before and after the code/config change, i.e. two test runs with potentially different tests
  • Production Tests to validate a production instance before upgrading the next instance
System and Staging tests require a (downscaled) full instance, whereas Production tests evaluates user-defined production metrics. Vespa Cloud has automated this - find examples in Read more in automated deployments.