# US 10,320,894 B2 · Method and apparatus for allocating availability zone

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,320,894 B2
- Document ID: US10320894B2
- Status: Granted
- Kind: B2
- Application number: 15/428,983
- Filed: 2017-02-09
- Published: 2018-03-08
- Granted: 2019-06-11
- Earliest claimed: 2016-09-05
- Assignees: Beijing Baidu Netcom Science Technology Co., Ltd.
- Applicants: Beijing Baidu Netcom Science and Technology Co., Ltd.
- Inventors: Deyang Zhang
- Web page: https://patentgrep.com/patent/US10320894B2

## CPC

- H04L 67/1008: based on parameters of servers, e.g. available memory or workload (monitoring of computer activity G06F11/30)
- H04L 67/1014: based on the content of a request
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

The present application discloses a method and apparatus for allocating an availability zone. A specific implementation of the method includes: receiving an availability zone allocating request sent from a user terminal, the availability zone allocating request including a user identification and a target logical availability zone identification; matching the user identification and the target logical availability zone identification in an availability zone allocation table; acquiring weights of availability zones from a preset availability zone weight table, selecting a target availability zone from the availability zones by using a ratio of the weights of the availability zones to a sum of the weights of the availability zones as a selection probability, and allocating the target availability zone to the user terminal, in response to an unsuccessful matching of the user identification and the target logical availability zone identification in the availability zone allocation table.

## Claims

### Claim 1

A method for allocating an availability zone, the method comprising:
receiving an availability zone allocating request sent from a user terminal, the availability zone including at least one data center, the availability zone allocating request including a user identification and a target logical availability zone identification, a logical availability zone identification being an identification of a logical availability zone displayed to the user terminal;
matching the user identification and the target logical availability zone identification with a user identification allocated with an availability zone and a logical availability zone identification of the availability zone allocated to the user terminal in an availability zone allocation table, the availability zone allocation table further including an availability zone identification of the availability zone allocated to the user terminal; and
acquiring weights of availability zones from a preset availability zone weight table, selecting a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability, and allocating the target availability zone to the user terminal, in response to an unsuccessful matching of the user identification and the target logical availability zone identification with the availability zone allocation table;
wherein the selecting a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability comprises:
generating a weight wheel diagram, wherein the weight wheel diagram is equally divided into a first preset number of sectors, the first preset number of sectors equaling to the sum of the weights of the availability zones, a number of sectors occupied by an availability zone in the weight wheel diagram equaling to a weight of the availability zone;
generating a random number, and generating a random rotating sector number H utilizing the following formula:
H=R % W
wherein R is the random number, W is the sum of the weights of the availability zones, and % is a complementation operator;
presetting a starting point in the weight wheel diagram and rotating H number of sectors clockwise or anticlockwise around the weight wheel diagram to reach a terminal point; and
defining an availability zone indicated by the terminal point as the target availability zone.

### Claim 2 (depends on 1)

The method according to claim 1, further comprising:
acquiring a successfully matched availability zone identification of the availability zone allocated to the user terminal, and allocating an availability zone indicated by the successfully matched availability zone identification to the user terminal, in response to the successful matching of the user identification and the target logical availability zone identification with the availability zone allocation table.

### Claim 3 (depends on 1)

The method according to claim 1, before the acquiring weights of availability zones from a preset availability zone weight table, further comprising:
analyzing statistically a remaining amount of resources of the availability zones; calculating the weights of the availability zones; and writing the weights in the preset availability zone weight table, wherein the weights of the availability zones are proportional to the remaining amount of resources of the availability zones.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the availability zone weight table further comprises availability zone identifications of the availability zones, and the method further comprises:
acquiring an availability zone identification of the selected target availability zone from the availability zone weight table.

### Claim 5 (depends on 4)

The method according to claim 4, further comprising:
writing the user identification, the target logical availability zone identification and the availability zone identification of the selected target availability zone respectively in the availability zone allocation table.

### Claim 6

An apparatus for allocating an availability zone, comprising:
at least one processor; and
a memory storing instructions, which when executed by the at least one processor, cause the at least one processor to perform operations, the operations comprising:
receiving an availability zone allocating request sent from a user terminal, the availability zone including at least one data center, the availability zone allocating request including a user identification and a target logical availability zone identification, a logical availability zone identification being an identification of a logical availability zone displayed to the user terminal;
matching the user identification and the target logical availability zone identification with a user identification allocated with an availability zone and a logical availability zone identification of the availability zone allocated to the user terminal in an availability zone allocation table, the availability zone allocation table further including an availability zone identification of the availability zone allocated to the user terminal; and
acquiring weights of availability zones from a preset availability zone weight table, select a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability, and allocate the target availability zone to the user terminal, in response to an unsuccessful matching of the user identification and the target logical availability zone identification with the availability zone allocation table;
wherein the selecting a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability comprises:
generating a weight wheel diagram, wherein the weight wheel diagram is equally divided into a first preset number of sectors, the first preset number of sectors equaling to the sum of the weights of the availability zones, a number of sectors occupied by an availability zone in the weight wheel diagram equaling to a weight of the availability zone;
generating a random number, and generating a random rotating sector number H utilizing the following formula:
H=R % W
wherein R is the random number, W is the sum of the weights of the availability zones, and % is a complementation operator;
presetting a starting point in the weight wheel diagram and rotating H number of sectors clockwise or anticlockwise around the weight wheel diagram to reach a terminal point; and
defining an availability zone indicated by the terminal point as the target availability zone.

### Claim 7 (depends on 6)

The apparatus according to claim 6, the operations further comprising:
acquiring a successfully matched availability zone identification of the availability zone allocated to the user terminal, and allocating an availability zone indicated by the successfully matched availability zone identification to the user terminal, in response to the successful matching of the user identification and the target logical availability zone identification with the availability zone allocation table.

### Claim 8 (depends on 6)

The apparatus according to claim 6, before the acquiring weights of availability zones from a preset availability zone weight table, the operations further comprising:
analyzing statistically a remaining amount of resources of the availability zones; calculating the weights of the availability zones; and writing the weights in the preset availability zone weight table, wherein the weights of the availability zones are proportional to the remaining amount of resources of the availability zones.

### Claim 9 (depends on 6)

The apparatus according to claim 6, wherein the availability zone weight table further comprises availability zone identifications of the availability zones, the operations further comprising:
acquiring an availability zone identification of the selected target availability zone from the availability zone weight table.

### Claim 10 (depends on 9)

The apparatus according to claim 9, the operations further comprising:
writing the user identification, the target logical availability zone identification and the availability zone identification of the selected target availability zone respectively in the availability zone allocation table.

### Claim 11

A non-transitory computer storage medium storing a computer program, which when executed by one or more processors, cause the one or more processors to perform operations, the operations comprising:
receiving an availability zone allocating request sent from a user terminal, the availability zone including at least one data center, the availability zone allocating request including a user identification and a target logical availability zone identification, a logical availability zone identification being an identification of a logical availability zone displayed to the user terminal;
matching the user identification and the target logical availability zone identification with a user identification allocated with an availability zone and a logical availability zone identification of the availability zone allocated to the user terminal in an availability zone allocation table, the availability zone allocation table further including an availability zone identification of the availability zone allocated to the user terminal; and
acquiring weights of availability zones from a preset availability zone weight table, selecting a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability, and allocating the target availability zone to the user terminal, in response to an unsuccessful matching of the user identification and the target logical availability zone identification with the availability zone allocation table;
wherein the selecting a target availability zone from the availability zones by using a ratio of a weight of an availability zone to a sum of the weights of the availability zones as a selection probability comprises:
generating a weight wheel diagram, wherein the weight wheel diagram is equally divided into a first preset number of sectors, the first preset number of sectors equaling to the sum of the weights of the availability zones, a number of sectors occupied by an availability zone in the weight wheel diagram equaling to a weight of the availability zone;
generating a random number, and generating a random rotating sector number H utilizing the following formula:
H=R % W
wherein R is the random number, W is the sum of the weights of the availability zones, and % is a complementation operator;
presetting a starting point in the weight wheel diagram and rotating H number of sectors clockwise or anticlockwise around the weight wheel diagram to reach a terminal point; and
defining an availability zone indicated by the terminal point as the target availability zone.

### Claim 12 (depends on 11)

The non-transitory computer storage medium according to claim 11, the operations further comprising:
acquiring a successfully matched availability zone identification of the availability zone allocated to the user terminal, and allocating an availability zone indicated by the successfully matched availability zone identification to the user terminal, in response to the successful matching of the user identification and the target logical availability zone identification with the availability zone allocation table.

### Claim 13 (depends on 11)

The non-transitory computer storage medium according to claim 11, before the acquiring weights of availability zones from a preset availability zone weight table, the operations further comprising:
analyzing statistically a remaining amount of resources of the availability zones; calculating the weights of the availability zones; and writing the weights in the preset availability zone weight table, wherein the weights of the availability zones are proportional to the remaining amount of resources of the availability zones.

### Claim 14 (depends on 11)

The non-transitory computer storage medium according to claim 11, wherein the availability zone weight table further comprises availability zone identifications of the availability zones, and the operations further comprising:
acquiring an availability zone identification of the selected target availability zone from the availability zone weight table.

### Claim 15 (depends on 14)

The non-transitory computer storage medium according to claim 14, the operations further comprising:
writing the user identification, the target logical availability zone identification and the availability zone identification of the selected target availability zone respectively in the availability zone allocation table.
