Method and apparatus for service routing
A method comprising: obtaining a first instruction for a first service, the first instruction being associated with a routing preference; generating a second instruction for the first service based on the first instruction; associating the second instruction with the routing preference; and providing the second instruction to the first service, wherein associating the second instruction with the routing preference includes at least one of inserting an indication of the routing preference in the second instruction.
1. A method comprising:
obtaining a first instruction for a first service, the first instruction being associated with a routing preference;
generating a second instruction for the first service based on the first instruction;
associating the second instruction with the routing preference; and
providing the second instruction to the first service,
wherein associating the second instruction with the routing preference includes inserting an indication of the routing preference in the second instruction.
2. The method of claim 1 , wherein the first instruction is received from a browser that is executed on a client device, the method further comprising preserving the routing preference in a cookie that is stored in a memory of the client device, the routing preference being preserved for future use in subsequent service calls to the first service or calls to other services that are placed by the browser.
3. The method of claim 1 , wherein the routing preference identifies a preferred version of a second service that is associated with the first instruction.
4. The method of claim 1 , wherein the routing preference identifies a preferred version of the first service, and providing the second instruction to the first service includes:
selecting a version of the first service based on the routing preference; and
providing the second instruction to an instance of the selected version of the first service.
5. The method of claim 1 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a count of different versions of the first service, which are currently executing on a computing system; and
overriding the indication of the routing preference based on the detected count, the overriding including selecting a version of the first service based on a routing policy and providing the second instruction to an instance of the selected version of the first service.
6. The method of claim 1 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a count of different versions of the first service, which are currently executing on a computing system; and
overriding the indication of the routing preference based on the detected count, the overriding including selecting a version of the first service based on a load balancing policy, and providing the second instruction to an instance of the selected version of the first service.
7. The method of claim 1 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a state of the first service; and
overriding the indication of the routing preference based on the detected state, the overriding including selecting a version of the first service based on a routing policy and providing the second instruction to an instance of the selected version of the first service.
8. The method of claim 1 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a state of the first service; and
overriding the indication of the routing preference based on the detected state, the overriding including selecting a version of the first service based on a load balancing policy, and providing the second instruction to an instance of the selected version of the first service.
9. A system, comprising:
a memory; and
at least one processor operatively coupled to the memory, the at least one processor being configured to perform the operations of:
obtaining a first instruction for a first service, the first instruction being associated with a routing preference;
generating a second instruction for the first service based on the first instruction;
associating the second instruction with the routing preference; and
providing the second instruction to the first service,
wherein associating the second instruction with the routing preference includes at least one of inserting an indication of the routing preference in the second instruction, and/or inserting the indication of the routing preference into a cookie.
10. The system of claim 9 , wherein the first instruction is received from a browser that is executed on a client device, and the at least one processor is further configured to perform the operation of preserving the routing preference in a cookie that is stored in a memory of the client device, the routing preference being preserved for future use in subsequent service calls to the first service or calls to other services that are placed by the browser.
11. The system of claim 9 , wherein the routing preference identifies a preferred version of a second service that is associated with the first instruction.
12. The system of claim 9 , wherein the routing preference identifies a preferred version of the first service, and providing the second instruction to the first service includes:
selecting a version of the first service based on the routing preference; and
providing the second instruction to an instance of the selected version of the first service.
13. The system of claim 9 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a count of different versions of the first service, which are currently executing on a computing system; and
overriding the indication of the routing preference based on the detected count, the overriding including selecting a version of the first service based on a routing policy and providing the second instruction to an instance of the selected version of the first service.
14. The system of claim 9 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a count of different versions of the first service, which are currently executing on a computing system; and
overriding the indication of the routing preference based on the detected count, the overriding including selecting a version of the first service based on a load balancing policy, and providing the second instruction to an instance of the selected version of the first service.
15. The system of claim 9 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a state of the first service; and
overriding the indication of the routing preference based on the detected state, the overriding including selecting a version of the first service based on a routing policy and providing the second instruction to an instance of the selected version of the first service.
16. The non-transitory computer-readable medium of claim 15 , wherein the routing preference identifies a preferred version of the first service, and providing the second instruction to the first service includes:
selecting a version of the first service based on the routing preference; and
providing the second instruction to an instance of the selected version of the first service.
17. The system of claim 9 , wherein the routing preference identifies a preferred version of the first service and a preferred version of a second service, and providing the second instruction to the first service includes:
detecting a state of the first service; and
overriding the indication of the routing preference based on the detected state, the overriding including selecting a version of the first service based on a load balancing policy, and providing the second instruction to an instance of the selected version of the first service.
18. A non-transitory computer-readable medium storing one or more processor-executable instructions, which, when executed by at least one processor, cause the at least one processor to perform the operations of:
obtaining a first instruction for a first service, the first instruction being associated with a routing preference;
generating a second instruction for the first service based on the first instruction;
associating the second instruction with the routing preference; and
providing the second instruction to the first service,
wherein associating the second instruction with the routing preference includes at least one of inserting an indication of the routing preference in the second instruction, and/or inserting the indication of the routing preference into a cookie.
19. The non-transitory computer-readable medium of claim 18 , wherein the first instruction is received from a browser that is executed on a client device, and the one or more processor-executable instructions, when executed by the at least one processor, further cause the at least one processor to perform the operation of preserving the routing preference in a cookie that is stored in a memory of the client device, the routing preference being preserved for future use in subsequent service calls to the first service or calls to other services that are placed by the browser.
20. The non-transitory computer-readable medium of claim 18 , wherein the routing preference identifies a preferred version of a second service that is associated with the first instruction.