Best Approach to Block Incoming Traffic During Initial Cache Loading in Azure VMSS

ShlomiDror-7850 0 Reputation points
2024-12-22T15:42:48.31+00:00

I am setting up a VMSS (Virtual Machine Scale Set) for a web application, and I need to perform an initial load of objects into the cache.

To achieve this, I would like to open a web page on localhost to load the objects into the cache, but I don't want to receive any incoming traffic while the cache loading process is ongoing.

What is the best way to achieve this? Should I:

  1. Use the Azure Load Balancer to prevent incoming traffic during the cache loading process?
  2. Implement a custom script to block incoming requests while the cache is loading?
  3. Leverage the Administrative State (Admin State) feature in Azure Load Balancer to disable the VM instances temporarily?

Any guidance on the best approach for this scenario would be greatly appreciated!

Azure Web Application Firewall
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
463 questions
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
423 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,706 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 48,081 Reputation points Microsoft Employee
    2024-12-23T09:54:24.0166667+00:00

    @ShlomiDror-7850 ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    Please note that Admin state takes effect on a per backend pool instance basis,

    • So if you'd like to update the ADMIN state to UP or DOWN or NONE for multiple backends over scripting, this is not a good idea
    • However, if you have a limited number of backend instances or only need to update the admin state of few backend instances in your backend pool - you can refer to the commands in the document : Manage Administrative (Admin) State in Azure Load Balancer

    My recommendation would be :

    • As Load Balancer is oblivious to the cache loading status of the backend pool, I would suggest you configure your backend to update the health probe accordingly
    • i.e. until the cache is loaded , your backend should fail the health probes test
    • Once the cache part is done, your backend should return success to the health probe tests
    • Thus traffic will only flow when the backend is up (Health probes are up)

    Please let us know if we can be of any further assistance here.

    Thanks,

    Kapil


    Please Accept an answer if correct.

    Original posters help the community find answers faster by identifying the correct answer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.