0
votes

I have a WEB API Service hosted on Azure as a cloud service.

The service has its own in-memory cache repository.

The service has a HTTP GET Controller method that let's me see the number of entries in the cache. i.e.: GET http://xxxx.cloudapp.net/CacheEntries returns "1000 cache entries"

Now there is a need to expand and scale the service - therefore we increased the instance count from 1 to 4. This created 4 VMs.

How can I retrieve a specific VM's number of cache entries? or even better: how can I get all the VMs' cache entry count?

I want to do something like:

GET http://xxxx.cloudapp.net/VM1/CacheEntries

GET http://xxxx.cloudapp.net/VM2/CacheEntries

GET http://xxxx.cloudapp.net/VM3/CacheEntries

GET http://xxxx.cloudapp.net/VM4/CacheEntries

And the output should be something like:

Instance#1: 1000 cache entries

Instance#2: 1200 cache entries

Instance#3: 1200 cache entries

Instance#4: 600 cache entries


Update: The solution is Azure Public IP addresses - but its still in preview mode: https://azure.microsoft.com/documentation/articles/virtual-networks-instance-level-public-ip/

http://clemmblog.azurewebsites.net/assign-public-ip-addresses-azure-vms/

1

1 Answers

0
votes

Your question is a bit tricky. You could create (non-loadbalanced) different ports (81 => vm1 port 80) so you can retrieve specific vm information. But this leads to maintenance issues when you add another instance. Or downscale back to three instances.

But since you are scaling; shouldn't you use a shared cache (like for instance Redis) so you don't have to care about the specific instance's and cache entries per instance?

Today this feature became available; instance level public ip's: Instance level public IP overview so you could assign a public ip to your instances and poll a specific singleton http call to retrieve these details.