-
Notifications
You must be signed in to change notification settings - Fork 27
Load Balancing
Puck supports load balancing but there are some things you need to setup, especially if you are in Azure.
you should have a single instance/server for the Backoffice where you edit your content, don't load balance this instance. you may end up with incorrect data if edits are done from different servers on related content. you should set an environment, perhaps named EditServer
or Backoffice
and set the AppSettings.EditServer.json
for this environment to have the IsEditServer
value set to true
.
if you're using Azure, as stated previously, you have one App Service instance for your Backoffice/Edit server and then you have another App Service for your front end and this front end App Service can be scaled to multiple instances.
In this situation, you should use Azure Directory so that your Lucene index is shared amongst your scaled instances. you will need to set UseAzureDirectory
in your AppSettings.json
to true
and you will also need to set AzureDirectoryConnectionString
to your Azure Blob Storage Connection String.
Remember to have a different environment set up for your front end App Service instance, maybe use the Production
environment. you will need to set the IsEditServer
value to false
for this environment in AppSettings.Production.json
.
as with load balancing in Azure (please read that first, many of the same things apply), you should have a dedicated server for the Backoffice / Edit Server with the AppSettings.EditServer.json
value for IsEditServer
set to true
.
you can then have front end servers with their AppSettings.Production.json
value for IsEditServer
set to false
.
Puck uses an instructions table to keep track of publishes and other state changes carried out by the different servers in your setup so things should stay in sync between your servers, as long as they are sharing the same database.
this means that Puck will try and keep your Lucene indexes amongst your servers in sync. if you opt to use Azure Directory (which requires an Azure Storage account), only the EditServer
will be able to make changes to the master index and all of your front end servers will only be reading from this index. Index Searchers will automatically re-open and refresh on all servers when content has been changed because of Puck processing the instructions in the instructions table.
if you opt not to use Azure Directory, each front end server will maintain its own Lucene Index which will be synced when changes occur.
while it isn't recommended to make changes on front end servers and you should use only the Edit Server to make changes - changes made from any server are actually still synced to all other servers.