- Home
- Forum
- Angular - EJ 2
- Load balancing Pdf service - sticky sessions not working?
Load balancing Pdf service - sticky sessions not working?
We have been using PDF Viewer service from one machine and it worked perfectly until we scaled to two machines. Is there a way to load balance the PDF Viewer service if sticky sessions aren't working.
note: (using standard ALB in AWS for acting as the LB with sticky sessions) Service is working fine behind the same LB just as a single node.
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
AA
Akshaya Arivoli
Syncfusion Team
September 9, 2020 12:00 PM UTC
Hi John,
Thank you for contacting Syncfusion support.
Yes, our PDF Viewer supports multiple users requesting the same/different documents. We are maintaining separate memory cache for each document with the unique id, so the requested document data will be retrieved from the respective cache and displayed in the viewer. We are maintaining the document live count and based on that the document will be removed from the cache when it is unloaded. So when the same document is viewing by the two users, the same cache will be used, and then it will be removed only when the document live count will be zero.
We have also provided support for IDistributedCache in our PDF Viewer Controller
Kindly follow the below steps for using the Redis Cache,
STEP 1: To use Redis cache in PDF Viewer service, install the following NuGet package,
STEP 2: To configure the Redis cache in PDF Viewer service, you have to add the following changes in Startup.cs
|
services.AddMemoryCache();
services.AddDistributedRedisCache(options =>
{
options.Configuration = Configuration.GetConnectionString("Redis");
}); |
STEP 3: We have to use IDistributedCache instead of IMemoryCache in PdfViewerController.cs. Please find the PDF Viewer service sample and code snippet below.
|
PdfViewerController.cs
private IDistributedCache _cache;
public PdfViewerController(IHostingEnvironment hostingEnvironment, IDistributedCache cache)
{
_hostingEnvironment = hostingEnvironment;
_cache = cache;
} |
Please try it and revert us with more details about your requirement, if you still need further assistance. These details will be helpful for us to investigate further and assist you better.
Regards,
Akshaya
Marked as answer
AT
atul
December 7, 2021 10:20 AM UTC
"Document Reference pointer does not exist in the cache"
how can resolve this asp.net mvc
DM
Dhivyabharathi Mohan
Syncfusion Team
December 8, 2021 01:35 PM UTC
Hi Atul,
In the load balancing environment, the request will be sent to different server machines, in which the cache data will not be available. However, we have implemented the feature ‘Achieve load balancing environment in MVC framework’ and shared the PDF Viewer web-service sample. Kindly download it from the below link. Please find the steps to configure the cache in your application to get the issue resolved.
Web service: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_WebAPI_Service_(3)1568224382.zip
Kindy refer the below documentation for more details about using the Redis cache in your end.
Kindly try this and let us know if you have any concerns about this.
Regards,
Dhivya.
SIGN IN To post a reply.