CN111600799A - Fragment routing method, server and computer storage medium - Google Patents

Fragment routing method, server and computer storage medium Download PDF

Info

Publication number
CN111600799A
CN111600799A CN202010429890.3A CN202010429890A CN111600799A CN 111600799 A CN111600799 A CN 111600799A CN 202010429890 A CN202010429890 A CN 202010429890A CN 111600799 A CN111600799 A CN 111600799A
Authority
CN
China
Prior art keywords
fragment
target
user
identifier
idle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010429890.3A
Other languages
Chinese (zh)
Other versions
CN111600799B (en
Inventor
彭志华
潘衡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Deeking Cloud Computing Co ltd
Original Assignee
Kingdee Deeking Cloud Computing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Deeking Cloud Computing Co ltd filed Critical Kingdee Deeking Cloud Computing Co ltd
Priority to CN202010429890.3A priority Critical patent/CN111600799B/en
Publication of CN111600799A publication Critical patent/CN111600799A/en
Application granted granted Critical
Publication of CN111600799B publication Critical patent/CN111600799B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/742Route cache; Operation thereof
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a fragment routing method, a server and a computer storage medium, which are used for solving the technical problem that data needs to be migrated by an operator due to the fact that data stored in fragments reaches the limit. The method in the embodiment of the application comprises the following steps: the method comprises the steps that a server determines idle fragments as default fragments and acquires the corresponding relation between user identifications and fragment identifications, when a target user needs to access the fragments, the server judges whether a target fragment identification corresponding to the user identification of the target user exists in the corresponding relation, if the target user does not exist, the target user is a new user, the server routes an access request to the default fragments, so that the target user can access the default fragments, and as the default fragments are idle fragments comprising idle storage spaces, the data of the new user is not stored in the fragments without the idle storage spaces, so that the data in the fragments without the idle storage spaces are not required to be migrated, the data of the new user can be stored, and the workload of operators is reduced.

Description

Fragment routing method, server and computer storage medium
Technical Field
The embodiment of the application relates to the field of data processing, in particular to a fragment routing method, a server and a computer storage medium.
Background
The application program manages and stores the data of the application program user by setting the fragments, and when the user needs to request the data, the data request of the user is routed to the specified fragments, so that the user can modify, inquire, acquire the data and execute other operations on the data in the fragments. The data of one user can be stored in only one fragment and cannot be stored in a plurality of fragments; one slice may store data for a plurality of users.
Because the load of the shards is limited, one shard can only store a certain amount of data, and when more and more users store data in the source shard, the storage pressure of the source shard is increased, which affects the execution performance of the source shard. At this time, an operator is required to migrate data of a part of users of the source segment to the target segment, so as to share the storage pressure of the source segment.
However, if a new user needs to store data, the data of the new user still can be stored in the source fragment, and as new users increase, the data stored in the source fragment eventually reaches the limit, so that the data needs to be migrated again, which undoubtedly increases the workload of the operator.
Disclosure of Invention
The embodiment of the application provides a fragment routing method, a server and a computer storage medium, which are used for solving the technical problem that data needs to be migrated by an operator due to the fact that data stored in fragments reaches the limit.
A first aspect of the embodiments of the present application provides a fragment routing method, which is applied to a server, and the method includes:
determining an idle fragment as a default fragment, wherein the idle fragment is a fragment comprising an idle storage space;
acquiring a corresponding relation between user identifications and fragment identifications, wherein one user identification corresponds to one fragment identification;
receiving an access request of a target user, wherein the access request carries a user identifier of the target user;
judging whether a target fragment identifier corresponding to the user identifier of the target user exists in the corresponding relation;
if so, routing the access request to the fragment corresponding to the target fragment identifier;
if not, the access request is routed to the default fragment.
Preferably, the number of the idle segments is multiple, and the determining the idle segments as default segments includes:
and determining the idle fragment with the largest free storage space in the plurality of idle fragments as the default fragment.
Preferably, the determining the idle segment as the default segment includes:
and newly building the fragments, and determining the newly built fragments as the default fragments.
Preferably, the obtaining the corresponding relationship between the user identifier and the segment identifier includes:
and establishing a routing table comprising the user identification and the fragment identification, wherein the routing table is used for indicating the fragment to which the access request of the user is routed.
Preferably, the method further comprises:
storing the routing table in a database;
the determining whether the corresponding relationship has a target fragment identifier corresponding to the user identifier of the target user includes:
inquiring a target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the database;
if the target fragment identification exists, the access request is routed to the fragment corresponding to the target fragment identification;
and if the target fragment identification does not exist, routing the access request to the default fragment.
Preferably, the method further comprises:
backing up the routing table in a cache;
before the target segment identifier corresponding to the user identifier of the target user is queried in the routing table stored in the database, the method further includes:
inquiring a target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the cache;
if the target fragment identification exists, the access request is routed to the fragment corresponding to the target fragment identification;
and if the target fragment identifier does not exist, executing the step of inquiring the target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the database.
Preferably, if the target fragment identifier does not exist, after the access request is routed to the default fragment, the method further includes:
and establishing a target corresponding relation between the user identification of the target user and the fragment identification of the idle fragment, and writing the target corresponding relation into the database and/or the routing table stored in the cache.
Preferably, the number of the idle segments is multiple, and the determining the idle segments as default segments includes:
determining a target idle fragment of the plurality of idle fragments as the default fragment;
the method further comprises the following steps:
and when the free storage space of the target free fragment is insufficient, changing the configuration of the default fragment, and determining other free fragments except the target free fragment in the plurality of free fragments as default fragments.
A second aspect of an embodiment of the present application provides a server, including:
the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining an idle fragment as a default fragment, and the idle fragment is a fragment comprising an idle storage space;
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the corresponding relation between user identifications and fragment identifications, and one user identification corresponds to one fragment identification;
a receiving unit, configured to receive an access request of a target user, where the access request carries a user identifier of the target user;
a judging unit, configured to judge whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence;
a first routing unit, configured to route the access request to a segment corresponding to a target segment identifier when the target segment identifier corresponding to a user identifier of the target user exists;
and the second routing unit is used for routing the access request to the default fragment when the target fragment identifier corresponding to the user identifier of the target user does not exist.
Preferably, the number of the idle segments is multiple, and the determining unit is specifically configured to determine an idle segment with the largest idle storage space among the multiple idle segments as the default segment.
Preferably, the determining unit is specifically configured to newly create a segment, and determine the newly created segment as the default segment.
Preferably, the obtaining unit is specifically configured to establish a routing table including the user identifier and the segment identifier, where the routing table is used to indicate a segment to which an access request of a user is routed.
Preferably, the server further includes:
a storage unit for storing the routing table in a database;
the judging unit is specifically configured to query, in the routing table stored in the database, a target fragment identifier corresponding to a user identifier of the target user, and route, when the target fragment identifier exists, the access request to a fragment corresponding to the target fragment identifier; and when the target fragment identification does not exist, routing the access request to the default fragment.
Preferably, the server further includes:
the backup unit is used for backing up the routing table in a cache;
the judging unit is further configured to query a target segment identifier corresponding to the user identifier of the target user in the routing table stored in the cache, route the access request to a segment corresponding to the target segment identifier when the target segment identifier exists, and execute the step of querying the target segment identifier corresponding to the user identifier of the target user in the routing table stored in the database when the target segment identifier does not exist.
Preferably, the server further includes:
and the establishing unit is used for establishing a target corresponding relation between the user identifier of the target user and the fragment identifier of the idle fragment, and writing the target corresponding relation into the database and/or the routing table stored in the cache.
Preferably, the number of the idle segments is multiple, and the determining unit is specifically configured to determine a target idle segment of the multiple idle segments as the default segment;
the determining unit is further configured to, when the free storage space of the target free segment is insufficient, change the configuration of the default segment, and determine, as the default segment, an idle segment other than the target free segment in the plurality of idle segments.
A third aspect of an embodiment of the present application provides a server, including:
a processor, a memory, an input and output device;
the processor is connected with the memory and the input and output equipment;
the processor is configured to determine an idle segment as a default segment, where the idle segment is a segment including an idle storage space, and obtain a correspondence between user identifiers and segment identifiers, where one user identifier corresponds to one segment identifier;
the input and output equipment is used for receiving an access request of a target user, and the access request carries a user identifier of the target user;
the processor is further configured to determine whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence, route the access request to a segment corresponding to the target segment identifier when the target segment identifier corresponding to the user identifier of the target user exists, and route the access request to the default segment when the target segment identifier corresponding to the user identifier of the target user does not exist.
A fourth aspect of embodiments of the present application provides a computer storage medium having instructions stored therein, which when executed on a computer, cause the computer to perform the method of the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages:
the server determines the idle fragment as a default fragment and acquires the corresponding relation between the user identifier and the fragment identifier, when a target user needs to access the fragment, the server judges whether a target fragment identifier corresponding to the user identifier of the target user exists in the corresponding relation, if so, the server routes the access request to the fragment corresponding to the target fragment identifier, and the target user can access the fragment corresponding to the target fragment identifier; if the target user is not the new user, the server routes the access request to the default fragment, so that the target user accesses the default fragment, and because the default fragment is an idle fragment comprising an idle storage space, the data of the new user is not stored in the fragment without the idle storage space, so that the data of the new user can be stored without migrating the data in the fragment without the idle storage space, and the workload of operators is reduced.
Drawings
Fig. 1 is a schematic flow chart of a fragment routing method in an embodiment of the present application;
fig. 2 is another schematic flow chart of a fragment routing method in the embodiment of the present application;
FIG. 3 is a schematic structural diagram of a server in an embodiment of the present application;
FIG. 4 is a schematic diagram of another server in the embodiment of the present application;
fig. 5 is another schematic structural diagram of a server in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a fragment routing method, a server and a computer storage medium, which are used for solving the technical problem that data needs to be migrated by an operator due to the fact that data stored in fragments reaches the limit.
Referring to fig. 1, an embodiment of a fragment routing method in the embodiment of the present application includes:
101. determining the idle fragment as a default fragment;
the method of the embodiment can be applied to a server, which may be an application server or a network server (WEB server), or other servers that can provide business services for users and process business data.
The server uses fragmentation to store user data. In order to reasonably use the storage resources of the fragments, the server determines the idle fragments as default fragments, wherein the idle fragments refer to the fragments with idle storage space, and the idle storage space refers to the storage space without user data. The free slice determined as the default slice may be used for storing user data.
102. Acquiring a corresponding relation between a user identifier and a fragment identifier;
in this embodiment, one slice may store data of a plurality of different users, but one user can only store data in one slice, but cannot store data in a plurality of slices respectively. That is, one user may correspond to one tile, and one tile may correspond to one or more users. Therefore, the server may obtain the correspondence between the user identifiers of the multiple users and the segment identifiers of the segments, that is, one user identifier corresponds to the segment identifier of one segment, and the segment identifier of one segment may correspond to the user identifier of one or more users.
Therefore, when the user identifier of a user has a corresponding fragment identifier, data indicating the user is stored in the fragment corresponding to the fragment identifier.
103. Receiving an access request of a target user;
when a target user needs to access a fragment in a server, the target user initiates an access request to the server, and the access request carries a user identifier of the target user, so that the server can receive the access request of the target user.
The target user accessing the fragment may be the target user modifying, querying, acquiring data and performing other operations on the data in the fragment.
104. Judging whether a target fragment identifier corresponding to the user identifier of the target user exists in the corresponding relation, if so, executing the step 105; if not, go to step 106;
after receiving the access request of the target user and the user identifier of the target user, the server determines whether the corresponding relationship obtained in step 102 has the fragment identifier corresponding to the user identifier of the target user, and if yes, executes step 105; if not, go to step 106. For convenience of description, in this embodiment, a segment identifier corresponding to a user identifier of a target user is referred to as a target segment identifier.
105. Routing the access request to the fragment corresponding to the target fragment identifier;
when the server determines that the target fragment identifier exists, it indicates that the target user has used the fragment in the server to store data, and the fragment corresponding to the target user is the fragment corresponding to the target fragment identifier, the server may determine that the target user needs to access the fragment corresponding to the target fragment identifier, so as to route the access request to the fragment corresponding to the target fragment identifier, and further the target user may access the fragment corresponding to the target fragment identifier, for example, modify or query the data of the target user stored in the fragment, or store new user data to the fragment, and so on.
106. Routing the access request to a default fragment;
when the server determines that the target shard identification does not exist, indicating that the target user has not used shards in the server to store data, i.e., indicating that the target user is a new user, the server routes the target user's access request to the default shard so that the target user can access the default shard, e.g., store data in the default shard, or query stored data, etc. Wherein the default shard is the free shard having free storage space in step 101.
In this embodiment, the server determines the idle segment as a default segment, and obtains a corresponding relationship between a user identifier and a segment identifier, when a target user needs to access the segment, the server determines whether a target segment identifier corresponding to the user identifier of the target user exists in the corresponding relationship, and if so, routes the access request to the segment corresponding to the target segment identifier, and the target user can access the segment corresponding to the target segment identifier; if the target user is not the new user, the server routes the access request to the default fragment, so that the target user accesses the default fragment, and because the default fragment is an idle fragment comprising an idle storage space, the data of the new user is not stored in the fragment without the idle storage space, so that the data of the new user can be stored without migrating the data in the fragment without the idle storage space, and the workload of operators is reduced.
The embodiments of the present application will be described in further detail below on the basis of the aforementioned embodiment shown in fig. 1. Referring to fig. 2, another embodiment of the fragment routing method in the embodiment of the present application includes:
201. determining the idle fragment as a default fragment;
the operation performed in this step is similar to the operation performed in step 101 in the embodiment shown in fig. 1. In this embodiment, the manner in which the server determines the idle segment as the default segment may be that, when there are multiple idle segments, the server selects an idle segment with the largest idle storage space among the multiple idle segments as the default segment, so that it can be ensured that the storage space of the default segment is sufficiently used, and a situation that the storage space is insufficient again after the segment with the smaller idle storage space is used for a short time is avoided.
In addition, the idle segment may be determined as the default segment by newly creating a new segment and determining the newly created segment as the default segment, and since the newly created segment does not store any user data, the idle storage space of the newly created segment is also sufficient for use, and can be used for storing user data.
In this embodiment, the default fragment may be configured by an Apollo (Apollo) configuration center, that is, an idle fragment in the server is determined as the default fragment by the Apollo configuration center. After the Apollo configuration center completes configuration, the server may be notified of the configuration of the default shard.
It should be noted that the configuration default partition may also pass through other configuration centers, for example, a SpringCloud Config center or a Nacos configuration center, which is not limited herein.
In this embodiment, the server may determine the idle segment as the default segment in other manners, for example, determine any idle segment of the idle segments as the default segment, and the present embodiment does not limit the manner in which the idle segment is determined as the default segment.
202. Acquiring a corresponding relation between a user identifier and a fragment identifier;
the operation performed in this step is similar to the operation performed in step 102 in the embodiment shown in fig. 1. In this embodiment, the server may represent the correspondence between the user identifier and the segment identifier in the form of a routing table, that is, a routing table including the user identifier and the segment identifier is established, where the routing table is used to represent a segment to which an access request of a user is routed, that is, a certain segment to which an access request of a certain user is routed. For example, in the routing table, the user identifier may be represented by dbid, the fragment identifier may be represented by a shard, two user identifiers dbid-A, dbid-B are provided under the dbid item, two fragments of shard-0 and shard-1 are provided under the shard item, dbid-a corresponds to shard-0, and dbid-B corresponds to shard-1, and the routing table also indicates that the access request of the user of dbid-a should be routed to fragment shard-0, and the access request of the user of dbid-B should be routed to fragment shard-1.
It should be noted that the above example is only an exemplary function, and the user identifier and the fragment identifier may be represented by any symbols as long as each user identifier and each fragment identifier can be distinguished.
In this embodiment, the corresponding relationship between the user identifier and the fragment identifier may also be represented without using a form of a routing table, or may also be directly represented, and the specific details are not limited herein.
203. Receiving an access request of a target user;
the operation performed in this step is similar to the operation performed in step 103 in the embodiment shown in fig. 1, and is not described here again.
204. Inquiring a target fragment identifier corresponding to the user identifier of the target user in a routing table stored in the cache, and if the target fragment identifier exists, executing step 205; if the target fragment identifier does not exist, executing step 206;
in this embodiment, the correspondence between the user identifier and the fragment identifier obtained in step 202 may be stored in a database and/or a cache, and when the correspondence is represented in the form of a routing table, the routing table is stored in the database and/or the cache.
After receiving the access request of the target user and the user identifier of the target user, the server needs to determine whether the corresponding relationship obtained in step 202 has the segment identifier corresponding to the user identifier of the target user, that is, to query the routing table stored in the database for the target segment identifier corresponding to the user identifier of the target user. Because the database may cause a large database processing pressure when processing a plurality of requests, the speed of processing the requests by the database is reduced, and user experience is affected, for this reason, the cache may be used to backup the routing table, and before querying the target fragment identifier from the database, the target fragment identifier corresponding to the user identifier of the target user may be queried in the routing table stored in the cache in advance, if the target fragment identifier can be queried in the cache, step 205 is executed; if the target fragment identifier is not found, step 206 is executed.
The target fragment identification is inquired in the cache in advance, so that the processing pressure of the database can be relieved to a certain extent, and the inquiry speed is improved.
Wherein the cache may be a Redis cache, a Memcached cache, or other type of server cache. When backing up the routing table, a cache structure with the user identifier as key and the fragment identifier as value can be established.
205. Routing the access request to the fragment corresponding to the target fragment identifier;
when the target fragment identifier can be inquired in the cache, the access request is routed to the fragment corresponding to the target fragment identifier, and the target user can access the fragment corresponding to the target fragment identifier.
206. Executing a step of inquiring a target fragment identifier corresponding to the user identifier of the target user in a routing table stored in a database;
when the target fragment identifier is not queried in the cache, possibly because the routing table backed up by the cache is not updated, the target fragment identifier may exist in the routing table stored in the database, and therefore, the target fragment identifier may continue to be queried in the routing table stored in the database at this time.
In this embodiment, if the processing capability of the database is strong and the processing resources are sufficient, the routing table may not be backed up by using the cache, and the target segment identifier may not be queried in the cache in advance, but may be directly queried in the database, which is not limited in this embodiment.
207. Judging whether a target fragment identifier corresponding to the user identifier of the target user exists in the corresponding relation, if so, executing the step 208; if not, go to step 209;
when the target fragment identifier is not queried in the cache, the target fragment identifier needs to be continuously queried in a routing table stored in the database. If the target fragment identifier can be queried in the database, executing step 208; if the target fragment id is not queried in the database, step 209 is performed.
208. Routing the access request to the fragment corresponding to the target fragment identifier;
when the target fragment identifier can be inquired in the database, the access request is routed to the fragment corresponding to the target fragment identifier, and the target user can access the fragment corresponding to the target fragment identifier.
209. Routing the access request to a default fragment;
if the database still cannot inquire the target fragment identification, the target user is indicated that the target user does not use the fragments in the server to store data, namely the target user is indicated as a new user, the server routes the access request of the target user to the default fragment, and therefore the target user can access the default fragment.
In this embodiment, the database may be a relational database or a non-relational database, the relational database may be a PostgreSQL database, a MySQL database, an Oracle database, a MongoDB database, or another relational database, and the preferred database is the PostgreSQL database.
210. Establishing a target corresponding relation between a user identifier of a target user and a fragment identifier of an idle fragment, and writing the target corresponding relation into a database and/or a cache;
after the server routes the access request of the target user to the default fragment, a target correspondence between the user identifier of the target user and the fragment identifier of the idle fragment is established, where the idle fragment in the target correspondence is the idle fragment determined as the default fragment in step 201.
After the server establishes the target corresponding relationship, the target corresponding relationship is written into the database and/or the cache, so that the routing table in the database and/or the cache can update the corresponding relationship represented by the routing table.
In this embodiment, there may be a plurality of idle segments, and an idle segment determined as a default segment among the plurality of idle segments may be referred to as a target idle segment. When the free storage space of the target idle segment is insufficient, the server may change the configuration of the default segment, that is, determine other idle segments of the idle segments except the target idle segment as default segments, and may store the data of the new user by using the other idle segments determined as default segments, so that the configuration of the default segment may be flexibly and dynamically changed.
The fragment routing method in the embodiment of the present application is described above, and a server in the embodiment of the present application is described below with reference to fig. 3, where an embodiment of the server in the embodiment of the present application includes:
a determining unit 301, configured to determine an idle segment as a default segment, where the idle segment is a segment including an idle storage space;
an obtaining unit 302, configured to obtain a correspondence between user identifiers and segment identifiers, where one user identifier corresponds to one segment identifier;
a receiving unit 303, configured to receive an access request of a target user, where the access request carries a user identifier of the target user;
a determining unit 304, configured to determine whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence;
a first routing unit 305, configured to route, when there is a target segment identifier corresponding to a user identifier of a target user, an access request to a segment corresponding to the target segment identifier;
and the second routing unit 306 is configured to route the access request to the default fragment when the target fragment identifier corresponding to the user identifier of the target user does not exist.
In this embodiment, operations performed by each unit in the server are similar to those described in the embodiment shown in fig. 1, and are not described again here.
In this embodiment, the determining unit 301 determines the idle segment as a default segment, the obtaining unit 302 obtains a correspondence between a user identifier and a segment identifier, when a target user needs to access a segment, the determining unit 304 determines whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence, if so, the first routing unit 305 routes the access request to the segment corresponding to the target segment identifier, and the target user can access the segment corresponding to the target segment identifier; if the default fragment is the idle fragment including the idle storage space, the data of the new user is not stored in the fragment without the idle storage space, so that the data of the new user can be stored without migrating the data in the fragment without the idle storage space, and the workload of an operator is reduced.
Referring to fig. 4, an embodiment of a server in the embodiment of the present application includes:
a determining unit 401, configured to determine an idle segment as a default segment, where the idle segment is a segment including an idle storage space;
an obtaining unit 402, configured to obtain a correspondence between user identifiers and segment identifiers, where one user identifier corresponds to one segment identifier;
a receiving unit 403, configured to receive an access request of a target user, where the access request carries a user identifier of the target user;
a determining unit 404, configured to determine whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence;
a first routing unit 405, configured to route, when a target segment identifier corresponding to a user identifier of a target user exists, an access request to a segment corresponding to the target segment identifier;
and the second routing unit 406 is configured to route the access request to the default fragment when the target fragment identifier corresponding to the user identifier of the target user does not exist.
In a preferred embodiment of this embodiment, the number of the idle segments is multiple, and the determining unit 401 is specifically configured to determine an idle segment with the largest idle storage space among the multiple idle segments as a default segment.
In another preferred embodiment of this embodiment, the determining unit 401 is specifically configured to newly create a segment, and determine the newly created segment as a default segment.
In another preferred implementation manner of this embodiment, the obtaining unit 402 is specifically configured to establish a routing table including a user identifier and a segment identifier, where the routing table is used to indicate a segment to which an access request of a user is routed.
In another preferred implementation manner of this embodiment, the server further includes:
a storage unit 407 for storing the routing table in a database;
the determining unit 404 is specifically configured to query, in a routing table stored in the database, a target fragment identifier corresponding to a user identifier of a target user, and route, when the target fragment identifier exists, an access request to a fragment corresponding to the target fragment identifier; and when the target fragment identification does not exist, routing the access request to the default fragment.
In another preferred implementation manner of this embodiment, the server further includes:
a backup unit 408, configured to backup the routing table in the cache;
the determining unit 404 is further configured to query a target segment identifier corresponding to the user identifier of the target user in the routing table stored in the cache, route the access request to the segment corresponding to the target segment identifier when the target segment identifier exists, and execute the step of querying the target segment identifier corresponding to the user identifier of the target user in the routing table stored in the database when the target segment identifier does not exist.
In another preferred implementation manner of this embodiment, the server further includes:
the establishing unit 409 is configured to establish a target correspondence between a user identifier of a target user and a segment identifier of an idle segment, and write the target correspondence into a routing table stored in a database and/or a cache.
In another preferred embodiment of this embodiment, the number of idle segments is multiple, and the determining unit 401 is specifically configured to determine a target idle segment in the multiple idle segments as a default segment;
the determining unit 401 is further configured to, when the free storage space of the target free segment is insufficient, change the configuration of the default segment, and determine, as the default segment, another free segment of the plurality of free segments except the target free segment.
In this embodiment, operations performed by each unit in the server are similar to those described in the embodiment shown in fig. 2, and are not described again here.
Referring to fig. 5, a server in an embodiment of the present application is described below, where an embodiment of the server in the embodiment of the present application includes:
the server 500 may include one or more Central Processing Units (CPUs) 501 and a memory 505, where one or more applications or data are stored in the memory 505.
Memory 505 may be volatile storage or persistent storage, among others. The program stored in memory 505 may include one or more modules, each of which may include a sequence of instructions operating on a server. Still further, the central processor 501 may be arranged to communicate with the memory 505 to execute a series of instruction operations in the memory 505 on the server 500.
The server 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input-output interfaces 504, and/or one or more operating systems, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The central processing unit 501 may perform the operations performed by the server in the embodiments shown in fig. 1 to fig. 2, and details thereof are not repeated herein.
An embodiment of the present application further provides a computer storage medium, where one embodiment includes: the computer storage medium has stored therein instructions that, when executed on a computer, cause the computer to perform the operations performed by the server in the embodiments of fig. 1-2.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other media capable of storing program codes.

Claims (11)

1. A method for fragment routing, applied to a server, the method comprising:
determining an idle fragment as a default fragment, wherein the idle fragment is a fragment comprising an idle storage space;
acquiring a corresponding relation between user identifications and fragment identifications, wherein one user identification corresponds to one fragment identification;
receiving an access request of a target user, wherein the access request carries a user identifier of the target user;
judging whether a target fragment identifier corresponding to the user identifier of the target user exists in the corresponding relation;
if so, routing the access request to the fragment corresponding to the target fragment identifier;
if not, the access request is routed to the default fragment.
2. The fragment routing method according to claim 1, wherein the number of the idle fragments is plural, and the determining the idle fragment as a default fragment comprises:
and determining the idle fragment with the largest free storage space in the plurality of idle fragments as the default fragment.
3. The fragment routing method according to claim 1, wherein the determining idle fragments as default fragments comprises:
and newly building the fragments, and determining the newly built fragments as the default fragments.
4. The fragment routing method according to claim 1, wherein the obtaining the correspondence between the user identifier and the fragment identifier includes:
and establishing a routing table comprising the user identification and the fragment identification, wherein the routing table is used for indicating the fragment to which the access request of the user is routed.
5. The method of claim 4, further comprising:
storing the routing table in a database;
the determining whether the corresponding relationship has a target fragment identifier corresponding to the user identifier of the target user includes:
inquiring a target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the database;
if the target fragment identification exists, the access request is routed to the fragment corresponding to the target fragment identification;
and if the target fragment identification does not exist, routing the access request to the default fragment.
6. The fragment routing method according to claim 5, wherein the method further comprises:
backing up the routing table in a cache;
before the target segment identifier corresponding to the user identifier of the target user is queried in the routing table stored in the database, the method further includes:
inquiring a target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the cache;
if the target fragment identification exists, the access request is routed to the fragment corresponding to the target fragment identification;
and if the target fragment identifier does not exist, executing the step of inquiring the target fragment identifier corresponding to the user identifier of the target user in the routing table stored in the database.
7. The fragment routing method according to claim 6, wherein if the target fragment identifier does not exist, the method further comprises, after routing the access request to the default fragment:
and establishing a target corresponding relation between the user identification of the target user and the fragment identification of the idle fragment, and writing the target corresponding relation into the database and/or the routing table stored in the cache.
8. The fragment routing method according to any one of claims 1 to 7, wherein the number of idle fragments is plural, and the determining idle fragments as default fragments includes:
determining a target idle fragment of the plurality of idle fragments as the default fragment;
the method further comprises the following steps:
and when the free storage space of the target free fragment is insufficient, changing the configuration of the default fragment, and determining other free fragments except the target free fragment in the plurality of free fragments as default fragments.
9. A server, characterized in that the server comprises:
the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining an idle fragment as a default fragment, and the idle fragment is a fragment comprising an idle storage space;
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the corresponding relation between user identifications and fragment identifications, and one user identification corresponds to one fragment identification;
a receiving unit, configured to receive an access request of a target user, where the access request carries a user identifier of the target user;
a judging unit, configured to judge whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence;
a first routing unit, configured to route the access request to a segment corresponding to a target segment identifier when the target segment identifier corresponding to a user identifier of the target user exists;
and the second routing unit is used for routing the access request to the default fragment when the target fragment identifier corresponding to the user identifier of the target user does not exist.
10. A server, characterized in that the server comprises:
a processor, a memory, an input and output device;
the processor is connected with the memory and the input and output equipment;
the processor is configured to determine an idle segment as a default segment, where the idle segment is a segment including an idle storage space, and obtain a correspondence between user identifiers and segment identifiers, where one user identifier corresponds to one segment identifier;
the input and output equipment is used for receiving an access request of a target user, and the access request carries a user identifier of the target user;
the processor is further configured to determine whether a target segment identifier corresponding to the user identifier of the target user exists in the correspondence, route the access request to a segment corresponding to the target segment identifier when the target segment identifier corresponding to the user identifier of the target user exists, and route the access request to the default segment when the target segment identifier corresponding to the user identifier of the target user does not exist.
11. A computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 8.
CN202010429890.3A 2020-05-20 2020-05-20 Fragment routing method, server and computer storage medium Active CN111600799B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010429890.3A CN111600799B (en) 2020-05-20 2020-05-20 Fragment routing method, server and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010429890.3A CN111600799B (en) 2020-05-20 2020-05-20 Fragment routing method, server and computer storage medium

Publications (2)

Publication Number Publication Date
CN111600799A true CN111600799A (en) 2020-08-28
CN111600799B CN111600799B (en) 2022-05-20

Family

ID=72182758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010429890.3A Active CN111600799B (en) 2020-05-20 2020-05-20 Fragment routing method, server and computer storage medium

Country Status (1)

Country Link
CN (1) CN111600799B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113347094A (en) * 2021-06-22 2021-09-03 深圳壹账通智能科技有限公司 Fragment routing method, device, equipment and storage medium
CN114466004A (en) * 2022-03-24 2022-05-10 成都新希望金融信息有限公司 File transmission method, system, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045877A (en) * 2015-07-20 2015-11-11 深圳市深信服电子科技有限公司 Database data fragmentation storage method and apparatus and data query method and apparatus
CN105975345A (en) * 2016-05-20 2016-09-28 江苏得得空间信息科技有限公司 Video frame data dynamic equilibrium memory management method based on distributed memory
CN106502576A (en) * 2015-09-06 2017-03-15 中兴通讯股份有限公司 Migration strategy method of adjustment, capacity change suggesting method and device
CN106503010A (en) * 2015-09-07 2017-03-15 北京国双科技有限公司 A kind of method and device of database change write subregion
CN106775470A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of method and system of data storage
CN106980669A (en) * 2017-03-23 2017-07-25 珠海格力电器股份有限公司 A kind of storage of data, acquisition methods and device
CN107948293A (en) * 2017-11-29 2018-04-20 重庆邮电大学 One kind is based on MongoDB load balance optimization system and methods
US20190213175A1 (en) * 2016-12-26 2019-07-11 Tencent Technology (Shenzhen) Company Limited Data migration method and system
CN110019125A (en) * 2017-11-27 2019-07-16 北京京东尚科信息技术有限公司 The method and apparatus of data base administration
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105045877A (en) * 2015-07-20 2015-11-11 深圳市深信服电子科技有限公司 Database data fragmentation storage method and apparatus and data query method and apparatus
CN106502576A (en) * 2015-09-06 2017-03-15 中兴通讯股份有限公司 Migration strategy method of adjustment, capacity change suggesting method and device
CN106503010A (en) * 2015-09-07 2017-03-15 北京国双科技有限公司 A kind of method and device of database change write subregion
CN105975345A (en) * 2016-05-20 2016-09-28 江苏得得空间信息科技有限公司 Video frame data dynamic equilibrium memory management method based on distributed memory
CN106775470A (en) * 2016-12-08 2017-05-31 武汉斗鱼网络科技有限公司 A kind of method and system of data storage
US20190213175A1 (en) * 2016-12-26 2019-07-11 Tencent Technology (Shenzhen) Company Limited Data migration method and system
CN106980669A (en) * 2017-03-23 2017-07-25 珠海格力电器股份有限公司 A kind of storage of data, acquisition methods and device
CN110019125A (en) * 2017-11-27 2019-07-16 北京京东尚科信息技术有限公司 The method and apparatus of data base administration
CN107948293A (en) * 2017-11-29 2018-04-20 重庆邮电大学 One kind is based on MongoDB load balance optimization system and methods
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
AAMEEK SINGH,等: ""Server-storage virtualization: Integration and load balancing in data centers"", 《SC "08: PROCEEDINGS OF THE 2008 ACM/IEEE CONFERENCE ON SUPERCOMPUTING》 *
尧海昌,等: ""面向轨道交通集群调度系统的数据分片中间件的研究"", 《南京工业职业技术学院学报》 *
苏跃明,等: ""基于分片一致性哈希负载均衡策略与应用"", 《计算机技术与发展》 *
转载: ""10分钟搞懂:亿级用户的分布式数据存储解决方案"", 《INPUB,HTTP://WWW.ITPUB.NET/2019/06/28/2306/》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113347094A (en) * 2021-06-22 2021-09-03 深圳壹账通智能科技有限公司 Fragment routing method, device, equipment and storage medium
CN113347094B (en) * 2021-06-22 2022-05-20 深圳壹账通智能科技有限公司 Fragment routing method, device, equipment and storage medium
CN114466004A (en) * 2022-03-24 2022-05-10 成都新希望金融信息有限公司 File transmission method, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111600799B (en) 2022-05-20

Similar Documents

Publication Publication Date Title
CN110489059B (en) Data cluster storage method and device and computer equipment
EP2923272B1 (en) Distributed caching cluster management
CN111600799B (en) Fragment routing method, server and computer storage medium
CN110019125B (en) Database management method and device
US10462250B2 (en) Distributed caching cluster client configuration
US9489429B2 (en) Computer system, data management method, and program
CN104954468A (en) Resource allocation method and resource allocation device
US20070150492A1 (en) Method and system for allocating file in clustered file system
CN109933585B (en) Data query method and data query system
US11809382B2 (en) System and method for supporting versioned objects
US9529772B1 (en) Distributed caching cluster configuration
EP3786802A1 (en) Method and device for failover in hbase system
CN116032930A (en) Network storage method, storage system, data processing unit and computer system
US11881996B2 (en) Input and output for target device communication
CN111767282A (en) MongoDB-based storage system, data insertion method and storage medium
CN110196750B (en) Equipment distribution method and related equipment thereof
JP6378847B2 (en) Method and apparatus for processing I / O requests in a network file system
CN115917525A (en) Routing instructions for partitioned databases
KR101754713B1 (en) Asymmetric distributed file system, apparatus and method for distribution of computation
CN116938634A (en) Data access method and related device based on virtual sub-network
CN112272214B (en) Method and device for starting software, storage medium, server and client
US20170185389A1 (en) Update system for linux operating system and method thereof
WO2014188478A1 (en) Method for controlling items to be monitored in cloud system in which virtual environment and non-virtual environment intermingle, and management computer and computer system
CN116244267A (en) Database creation method, device and storage medium
CN115827561A (en) Data query method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant