|
|
@@ -19,10 +19,12 @@ Some operations however will need to perform much longer-running tasks. For exam
|
|
|
|
|
|
## What does Vendure use the job queue for?
|
|
|
|
|
|
-- Re-building the search index
|
|
|
-- Updating the search index when changes are made to Products, ProductVariants, Assets etc.
|
|
|
-- Updating the contents of Collections
|
|
|
-- Sending transactional emails
|
|
|
+By default, Vendure uses the job queue for the following tasks:
|
|
|
+
|
|
|
+- Re-building the search index
|
|
|
+- Updating the search index when changes are made to Products, ProductVariants, Assets etc.
|
|
|
+- Updating the contents of Collections
|
|
|
+- Sending transactional emails
|
|
|
|
|
|
## How does the Job Queue work?
|
|
|
|
|
|
@@ -40,7 +42,13 @@ If no strategy is defined, Vendure uses an [in-memory store]({{< relref "in-memo
|
|
|
|
|
|
A better alternative is to use the [DefaultJobQueuePlugin]({{< relref "default-job-queue-plugin" >}}) (which will be used in a standard `@vendure/create` installation), which configures Vendure to use the [SqlJobQueueStrategy]({{< relref "sql-job-queue-strategy" >}}). This strategy uses the database as a queue, and means that event if the Vendure server stops, pending jobs will be persisted and upon re-start, they will be processed.
|
|
|
|
|
|
-It is also possible to implement your own JobQueueStrategy to take advantage of other technologies. Examples include Redis, RabbitMQ, Google Cloud Pub Sub & Amazon SQS. It may make sense to implement a custom strategy based on one of these if the default database-based approach does not meet your performance requirements.
|
|
|
+It is also possible to implement your own JobQueueStrategy to take advantage of other technologies. Examples include RabbitMQ, Google Cloud Pub Sub & Amazon SQS. It may make sense to implement a custom strategy based on one of these if the default database-based approach does not meet your performance requirements.
|
|
|
+
|
|
|
+## Job Queue Performance
|
|
|
+
|
|
|
+It is common for larger Vendure projects to define multiple custom job queues, When using the [DefaultJobQueuePlugin]({{< relref "default-job-queue-plugin" >}}) with many queues, performance may be impacted. This is because the `SqlJobQueueStrategy` uses polling to check for new jobs in the database. Each queue will (by default) query the database every 200ms. So if there are 10 queues, this will result in a constant 50 queries/second.
|
|
|
+
|
|
|
+In this case it is recommended to try the [BullMQJobQueuePlugin]({{< relref "bull-mqjob-queue-plugin" >}}), which uses an efficient push-based strategy built on Redis.
|
|
|
|
|
|
## Using Job Queues in a plugin
|
|
|
|