Service providing method and apparatus
View Patent ↗In a service providing method, a service providing apparatus receives a first service request from a tenant, and the first service request includes an identifier of a tenant. The service providing apparatus adds a first service instance to a target serving cell associated with the tenant, where the first service instance is for processing the first service request.
1. A service providing method performed by a service providing apparatus in a service network, comprising:
receiving a first service request from a tenant in the service network, wherein the first service request comprises an identifier of the tenant;
generating a cell identifier based on the identifier of the tenant;
creating a target serving cell associated with the cell identifier in response to the first service request;
determining M to-be-selected service instances from available service instances, wherein M is an integer greater than 1, wherein the M to-be-selected service instances are identified by different instance numbers derived by applying different hash functions to the cell identifier;
selecting a plurality of service instances from the M to-be-selected service instances for inclusion in the target service cell; and
selecting a first service instance from the plurality of service instances in the target serving cell for processing the first service request.
2. The method according to claim 1 , further comprising:
receiving a second service request, wherein the second service request comprises the identifier of the tenant; and
selecting a second service instance from the plurality of service instances in the target serving cell according to a load balancing principle, wherein the second service instance is for processing the second service request.
3. The method according to claim 1 , further comprising:
moving the first service instance out of the target serving cell.
4. The method according to claim 1 , further comprising:
when a service load of the target serving cell is less than a threshold, moving one or more service instances out of the target serving cell.
5. The method according to claim 1 , wherein the target serving cell belongs to an availability zone.
6. The method according to claim 1 , wherein different serving cells belong to different fault domains.
7. The method according to claim 1 , wherein the first service instance corresponds to a state identifier, and the state identifier represents a quantity of serving cells to which the first service instance belongs or represents whether the first service instance is abnormal.
8. The method according to claim 1 , wherein the step of generating the cell identifier derives the cell identifier by applying a Base64( ) function to the identifier of the tenant.
9. A service providing apparatus in a service providing network, comprising:
a memory storing executable instructions; and
a processor configured to execute the executable instructions to:
receive a first service request from a tenant in the service providing network, wherein the first service request comprises an identifier of the tenant;
generate a cell identifier based on the identifier of the tenant;
creating a target serving cell associated with the cell identifier in response to the first service request;
determining M to-be-selected service instances from available service instances, wherein M is an integer greater than 1, wherein the M to-be-selected service instances are identified by different instance numbers derived by applying different hash functions to the cell identifier;
selecting a plurality of service instances from the M to-be-selected service instances for inclusion in the target service cell; and
selecting a first service instance from the plurality of service instances in the target serving cell for processing the first service request.
10. The service providing apparatus according to claim 9 , wherein the processor is further configured to:
receive a second service request, wherein the second service request comprises the identifier of the tenant; and
select a second service instance from the plurality of service instances in the target serving cell according to a load balancing principle, wherein the second service instance is for processing the second service request.
11. The service providing apparatus according to claim 9 , wherein the processor is further configured to:
move the first service instance out of the target serving cell.
12. The service providing apparatus according to claim 9 , wherein the processor is further configured to:
when service load of the target serving cell is less than a threshold, move one or more service instances out of the target serving cell.
13. The service providing apparatus according to claim 9 , wherein the target serving cell belongs to an availability zone.
14. The service providing apparatus according to claim 9 , wherein the processor is configured to generate the cell identifier by applying a Base64( ) function to the identifier of the tenant.