In the context of improving an API on Kubernetes, I am considering using a distributed hash table. My API always receives requests to an URL with this scheme:
www.myapi.com/id
Reading the documentation of Istio, it seems pretty direct and easy to get what I want. Indeed, Istio handles a load balancing scheme called ConsistentHashLB
. I such a scheme, the service destination is chosen according to a hash computed from several possible fields: HTTP header name, cookie, source IP, and an HTTP query parameter name.
In my case, I would need to compute the hash according to the id
associated with the request.
That said, I dare some questions:
-
Given an URL, how could I get its string?
-
If I get the full URL, how could I get the suffix (the id part
-
Could I use the field
httpQueryParameterName
for extracting the id? -
If not, how I could add an HTTP header so that later I use
httpHeaderName
and voila?
In the paper, the solution seems pretty straightforward, but the lack of examples makes hard things.
Thank you very much in advance
Leandro