Skip to content

Commit 62d3fed

Browse files
committed
882104 - Add UG for scaling in collaborative editing
1 parent 62ad11b commit 62d3fed

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

ej2-asp-core-mvc/document-editor/collaborative-editing.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,45 @@ private ActionInfo AddOperationsToTable(ActionInfo action)
338338
}
339339

340340
```
341+
## How to perform Scaling in Collaborative Editing.
342+
343+
As the number of user increases, maintaining responsiveness and performance becomes challenging. Scaling tackles this by distributing the workload across resources. You can scale the collaborative editing application using either ```Azure SignalR service or Redis backplane service```
344+
345+
### 1. Scaling with Azure SignalR
346+
347+
Azure SignalR Service is a scalable, managed service for real-time communication in web applications. It enables real-time messaging between web clients (browsers) and your server-side application(across multiple servers).
348+
349+
Below is a code snippet to configure Azure SignalR in an ASP.NET Core application using the ```AddAzureSignalR``` method
350+
351+
```csharp
352+
builder.Services.AddSignalR() .AddAzureSignalR("<your-connection-string>", options => {
353+
// Specify the channel name
354+
options.Channels.Add("document-editor");
355+
});
356+
```
357+
358+
### 2. Scaling with Redis backplane
359+
360+
Using a Redis backplane, you achieve horizontal scaling of your SignalR application. The SignalR leverages Redis to efficiently broadcast messages across multiple servers. This allows your application to handle large user bases with minimal latency.
361+
362+
In the SignalR app, install the following NuGet package:
363+
* ` Microsoft.AspNetCore.SignalR.StackExchangeRedis`
364+
365+
Below is a code snippet to configure Redis backplane in an ASP.NET Core application using the ```AddStackExchangeRedis ``` method
366+
367+
```csharp
368+
builder.Services.AddSignalR().AddStackExchangeRedis("<your_Redis_connection_string>");
369+
```
370+
Configure options as needed:
371+
372+
The following example shows how to add a channel prefix in the ConfigurationOptions object.
373+
374+
```csharp
375+
builder.Services.AddDistributedMemoryCache().AddSignalR().AddStackExchangeRedis(connectionString, options =>
376+
{
377+
options.Configuration.ChannelPrefix = "document-editor";
378+
});
379+
```
341380

342381

343382
Full version of the code discussed about can be found in below GitHub location.

0 commit comments

Comments
 (0)