Microservices- Design patterns for microservices–7
Implementing proxy as a pattern is useful in situations where you deploy a microservice continuously. Proxy pattern allows us to create a separate proxy service that could be used to deploy the service depending on the parameters of the request. This is useful in situations where there are similar multiple services that run on different parameters due to its usability. Proxy Pattern allows the independent deployment of services without affecting the consumer. If a certain service isn’t used anymore due to all the consumers moving to the newer version of the service, the legacy service could be discontinued.
However, using semantic versioning is extremely important in managing such scenarios. One more thing to note is service discovery, which is the process of allowing external entity to discover the service for you. This helps with managing the host name and IP address changes that occur alongside infrastructural changes. This way, the proxy can call the service discovery tool to get to know the exact location of the services. Few such examples of service discovery tools are the WSO2s Governor’s Registry and CONSUL.
Things to keep in mind while implementing proxy pattern
- Use of multiple thread pools to reduce the possibility of requests being blocked in a queue, thus handling the situation without letting it affect the consumer.
- Use of thread handover mechanism which defines one thread to obtain the traffic from the consumer and lead where it requests, without letting it affect the consumer.
Thanks for reading. Until next time! 👋🏽