I have 6 web servers which are giving me problems due to cache inconsistency. I am thinking of building a cache invalidation service such that there is a topic on which all the servers can publish a message to invalidate an object. I am considering using the Amazon SNS for the making the topic.
Now for the servers to receive the invalidation messages, I am confused between the following:
- Should I be using the SQS queues for the servers to receive messages.
- Should I be using HTTP endpoints and then build an api on that route that invalidates the cache.
Could you please highlight the pros and cons of both of these approaches or any other approach that might benefit me.
If I use NGINX to redirect any request to one of the 6 servers. If I am using the HTTP endpoint, the topic will end up hitting only one of the servers. I also am not sure which port my application would be running on. Could you suggest me a way to by-pass the NGINX server or find out the port on the fly and then hit the servers.