Time slicing method, apparatus and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2026-08-11
AI Technical Summary
[0015]前述实施例记载的方案中,可以法可以学习用户的查询习惯信息,并根据该信息最先切出用于查询用户最经常翻到的页面数量的数据量的切片任务,从而无需查出大量数据,与相关技术相比,减少无用的数据查询工作,提升设备的性能,减少设备的内存、缓存等资源的占用。
Smart Images

Figure CN116610702B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a time-slicing method, apparatus, and electronic device. Background Technology
[0002] Time slicing refers to the process of dividing a long-duration task into several shorter-duration slices.
[0003] With the rapid development of the internet, the volume and types of data are enormous, demanding fast processing speeds and high timeliness. Dividing processing tasks into several segments for separate execution can improve processing speed and timeliness, while also freeing up resources when not executing segmented tasks, thus improving resource utilization. Summary of the Invention
[0004] In view of this, this application discloses a time slicing method. The method may include: acquiring a task to be processed; the task to be processed includes target query conditions; determining, based on query habit information learned from page-turning patterns of several preset pages, the number of pages whose percentage of visits exceeds a preset threshold under the target query conditions; the query habit information includes the percentage of visits to each preset page under different query conditions; determining the target slice duration based on the number of pages, the amount of data displayed per page, and the unit data volume learned from historical query tasks; and segmenting the target data query task according to the target slice duration.
[0005] In some embodiments, the plurality of preset pages are used to display data retrieved by the historical query task; the page turning situation includes the number of page turns; the method for learning query habit information includes: obtaining the historical query conditions included in the historical query task; counting the number of times each preset page is turned based on the user's page turning operation; and generating the percentage corresponding to each preset page under the historical query conditions based on the number of times.
[0006] In some embodiments, the step of segmenting the target data query task according to the target slice duration includes: when the target slice duration has not reached a first preset duration, segmenting a first slice task of the target slice duration; when the target slice duration has reached the first preset duration, slicing in descending order of proportion until the slice of the target slice duration is completed; wherein each slicing method includes: determining the current slice duration based on the amount of data to be sliced corresponding to the current slice and the unit data amount; when the current slice duration has not reached a second preset duration, segmenting a second slice task of the current slice duration; and when the current slice duration has reached the second preset duration, segmenting a plurality of third slice tasks, wherein the slice duration of the third slice task is less than the second preset duration.
[0007] In some embodiments, the task to be processed includes a time slice type identifier; when the time slice type identifier is a second identifier, the method further includes: acquiring the task to be processed; determining the complexity corresponding to the task to be processed based on the task content of the task to be processed; the complexity indicates the degree of complexity of the task to be processed; slicing the task to be processed based on the slicing rules corresponding to the complexity to obtain several sliced tasks; the slicing rules are used to cut out at least two priority tasks; the higher the priority of the sliced task, the shorter the slice duration.
[0008] In some embodiments, the task content includes the duration of a single task, the task duration, and task processing conditions; the task processing conditions include condition types and the number of conditions for each condition type; determining the complexity of the task to be processed based on the task content includes: obtaining the number of task executions based on the task duration; determining a first complexity of the task processing conditions based on a preset unit complexity for different condition types and the number of conditions; and determining the complexity of the task to be processed based on the first complexity, a preset second complexity for the single duration, and a preset third complexity for the number of task executions.
[0009] In some embodiments, the slicing rule indicates the number of consecutive tasks corresponding to each priority level, and the time interval between two adjacent sliced tasks; the number of consecutive tasks corresponding to high-priority tasks indicated by the slicing rule is greater than the number of consecutive tasks corresponding to low-priority tasks; and / or, the first slicing rule corresponding to low complexity and the second slicing rule corresponding to high complexity satisfy at least one of the following: the first time interval indicated by the first slicing rule is less than the second time interval indicated by the second slicing rule; the first number of consecutive tasks corresponding to high-priority tasks indicated by the first slicing rule is greater than the second number of consecutive tasks corresponding to high-priority tasks indicated by the second slicing rule.
[0010] In some embodiments, slicing the task to be processed based on slicing rules corresponding to the complexity to obtain several sliced tasks includes: slicing out a first-priority task from the task to be processed; slicing out a first-priority task when the remaining processing time of the task to be processed is not 0 and the number of first-priority tasks has not reached a third consecutive number; the third consecutive number is the number of consecutive first-priority tasks indicated by the slicing rule; slicing out a second-priority task when the remaining processing time of the task to be processed is not 0 and the number of first-priority tasks has reached the third consecutive number; the second-priority task has a lower priority than the first-priority task; and completing the slicing when the remaining processing time of the task to be processed is 0.
[0011] In some embodiments, after obtaining the plurality of slice tasks, the method further includes: storing tasks of different priorities into data queues of corresponding priorities; wherein slice tasks stored in high-priority data queues are executed first, and / or the execution results of the stored tasks are read first.
[0012] In some embodiments, the task to be processed is a data query task, and the task content of the data query task includes the number of data queried reaching a first threshold; after obtaining the plurality of slice tasks, the method further includes: polling the execution results of all slice tasks corresponding to the data query task; if the number of data polled does not reach the first threshold, the data query task is sliced again and executed.
[0013] In some embodiments, the method for re-slicing the data query task includes: obtaining the current polling count; if the current polling count has not reached a preset number, slicing the data query task according to the initial slicing rule; if the current polling count reaches the preset number and the number of data reached in each poll is 0, slicing out a first preset number of non-highest priority tasks for the data query task; if the polling result for the non-highest priority tasks is 0, continuing to slice out the first preset number of non-highest priority tasks in the next polling cycle until the polling result for the non-highest priority tasks is not 0, and then resuming slicing the data query task according to the initial slicing rule.
[0014] In some embodiments, after determining the complexity of the task to be processed based on its content, the method further includes: obtaining the occupancy rate of a data queue used to store sliced tasks and / or the execution results of sliced tasks; if the occupancy rate reaches a second threshold, storing the task to be processed in a database, and cutting out a second preset number of non-lowest priority tasks for the task to be processed and storing them in a data queue of the corresponding priority; if the occupancy rate reaches a third threshold, storing the task to be processed and subsequently received tasks to be processed in a database, until the occupancy rate does not reach a fourth threshold, and sequentially reading the tasks to be processed from the database for slicing.
[0015] In the solution described in the foregoing embodiments, the method can learn the user's query habits and, based on this information, first extract a slice of data for querying the number of pages the user most frequently visits. This eliminates the need to retrieve a large amount of data. Compared with related technologies, this reduces useless data query work, improves device performance, and reduces the consumption of device resources such as memory and cache. Attached Figure Description
[0016] The accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below.
[0017] Figure 1 This application illustrates a method flowchart for a time-slicing method.
[0018] Figure 2 This is a flowchart illustrating a time-slicing method according to an embodiment of this application.
[0019] Figure 3 This is a schematic diagram illustrating a method for calculating computational complexity as shown in this application.
[0020] Figure 4 This is a schematic flowchart illustrating a slicing method according to an embodiment of this application.
[0021] Figure 5 This is a flowchart illustrating a data query method during task execution, as shown in an embodiment of this application.
[0022] Figure 6 This is a schematic flowchart illustrating a method for further slicing the data query task, as shown in an embodiment of this application.
[0023] Figure 7 This is a schematic flowchart illustrating a method for preventing queue overflow in an embodiment of this application.
[0024] Figure 8 This is a schematic diagram of the data query method shown in this application.
[0025] Figure 9 This is a schematic diagram of the time-slicing device illustrated in this application.
[0026] Figure 10 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0027] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of devices and methods consistent with some aspects of this application as detailed in the appended claims.
[0028] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items. It should also be understood that the word “if” as used herein, depending on the context, can be interpreted as “when,” “in response to a determination,” or “when…”.
[0029] In some related technologies, traditional page data processing solutions will retrieve all data or a preset number of data (such as 100,000 records). However, when users view a page, they often do not flip through pages or only view a limited number of pages of data. This results in a lot of data querying work being redundant, which not only wastes the device's performance but also occupies the device's memory, cache, and other resources.
[0030] Based on this, this application proposes a time slicing method. This method can learn users' query habits and, based on this information, first slice out the data volume required to query the number of pages the user most frequently visits. This eliminates the need to retrieve large amounts of data, reducing unnecessary data querying work compared to related technologies, improving device performance, and reducing the consumption of device resources such as memory and cache.
[0031] Please see Figure 1 , Figure 1 This is a flowchart illustrating a time-slicing method as shown in this application. Figure 1 As shown, the method may include S102-S108.
[0032] S102, Obtain the task to be processed; the task to be processed includes the target query conditions.
[0033] The task to be processed can be any type of task, including adding, deleting, modifying, and querying. This application does not limit it. In some subsequent embodiments, the task to be processed is a data query task.
[0034] In some approaches, a B / S architecture can be used. B / S architecture (Browser / Server) is a network structure model that emerged after the rise of the web, with the web browser being the primary application software on the client side. After the user enters the task to be processed in the browser and clicks submit, the server can retrieve the task for processing.
[0035] The target query conditions refer to the conditions used to query data, which may include a time range and search conditions (e.g., IP is 1.1.1.1).
[0036] S104 determines the number of pages whose page-viewing frequency exceeds a preset threshold under the target query condition based on query habit information learned from page-turning behavior of several preset pages.
[0037] The preset pages can be set according to needs. For example, they can be set to page 1, page 2, page 3, and page 6. Alternatively, they can be set to page 2, page 3, and page 6.
[0038] The query habit information includes the percentage of each preset page being viewed under different query conditions. A higher percentage indicates that the corresponding page is viewed frequently by users. For example, the preset pages are page 1, page 2, page 3, and page 6, with corresponding percentages of 70%, 15%, 8%, and 7%, respectively. Page 1 is the most frequently viewed page.
[0039] The query system information can be learned based on page-turning behavior across several preset pages. These preset pages display data retrieved from historical query tasks; the page-turning behavior includes the number of page turns. The method for learning query habit information includes:
[0040] Obtain the historical query conditions included in the historical query task;
[0041] Based on the user's page-turning actions, count the number of times each preset page is turned;
[0042] Based on the number of queries, the percentage corresponding to each preset page under the historical query conditions is generated.
[0043] The percentage statistics can be performed in three exemplary ways.
[0044] Method 1: Statistics are compiled based solely on the query criteria.
[0045] For example, query condition 1: time range 2022.01.06 18:00:00 - 2022.01.06 18:10:00; query rule: ip == 1.1.1.1; for query condition 1, calculate the percentage of pages 1, 2, 3 and 6.
[0046] Query condition 2: Time range 2022.01.06 18:00:00 - 2022.01.07 20:10:00; Query rule: ip == 9.1.1.1 && port=80; Calculate the percentage of the data on page 2, page 3, and page 6 based on query condition 2.
[0047] By paging through the results for each query condition, the query habits shown in Table 1 can be obtained.
[0048]
[0049] Table 1
[0050] Method 2: Statistical analysis using page numbers.
[0051] For example, query condition 1 counts the number of times the page IDs of pages 1, 2, 3, and 6 are viewed;
[0052] Query condition 2: Count the number of times the page IDs of pages 2, 3, and 6 are viewed.
[0053] Based on the page numbers, you can obtain the query habits information shown in Table 1.
[0054] Method 3: Perform statistics based on query criteria and page numbers.
[0055] Query condition 1, time range 2022.01.06 18:00:00 - 2022.01.06 18:10:00, query rule: ip == 1.1.1.1, count the number of times the page ID of page 1, page 2, page 3 and page 6 are viewed;
[0056] Query condition 2, time range 2022.01.06 18:00:00 - 2022.01.07 20:10:00, query rule: ip == 9.1.1.1 && port=80, count the number of times the page IDs of pages 2, 3 and 6 are viewed.
[0057] Based on the query criteria and page numbers, we can obtain query habit information as shown in Table 1.
[0058] The preset threshold can be set according to needs. For example, 85%. Taking the query habit information illustrated in Table 1 as an example, under query condition 1, the combined percentage of pages 1 and 2 reaches 85%, meaning the number of pages with a percentage exceeding the preset threshold is 2. Under query condition 2, the percentage of page 2 also reaches exactly 85%, meaning the number of pages with a percentage exceeding the preset threshold is 2.
[0059] S106. Determine the target slice duration based on the number of pages, the amount of data displayed per page, and the amount of unit data learned from historical query tasks.
[0060] The unit data volume refers to the amount of data that a slice task within a preset unit duration can query. The preset unit duration can be set according to requirements, such as 1 minute. For example, if a 10-minute slice task can query 1000 data entries, then the unit data volume is 100 entries per minute.
[0061] This application can maintain the formula T = (A * X) / N, where T is the target slice duration, A is the number of pages determined by S104, X is the preset amount of data that can be displayed per page, and N is the unit data volume. The target slice duration can be obtained using this formula. It can be understood that A * X is the amount of data to be divided in the current slice, and dividing this amount by the unit data volume yields the target slice duration.
[0062] S108, Based on the target slice duration, segment the target data query task.
[0063] For example, a slice task can be directly cut out the duration of the target slice.
[0064] Through S102-S108, user query habits can be learned, and based on this information, a slice of data is first extracted to query the number of pages that the user most frequently visits. This eliminates the need to retrieve large amounts of data, reduces useless data querying work compared to related technologies, improves device performance, and reduces the consumption of device resources such as memory and cache.
[0065] In some embodiments, if the target slice duration is too long, it may cause users to wait too long, affecting the user experience.
[0066] To solve this problem, in S108, if the target slice duration does not reach the first preset duration, the first slice task of the target slice duration is cut out.
[0067] When the target slice duration reaches the first preset duration, the percentage sorting is performed, and slices are performed sequentially from high to low until the slice of the target slice duration is completed; wherein the method of each slice includes: determining the current slice duration based on the amount of data to be sliced and the unit data amount corresponding to the current slice; when the current slice duration has not reached the second preset duration, a second slice task of the current slice duration is sliced out; and when the current slice duration reaches the second preset duration, several third slice tasks are sliced out, wherein the slice duration of the third slice task is less than the current slice duration.
[0068] For example, the first preset duration is 5 minutes. If the target slice duration is less than 5 minutes, the first slice task of the target slice duration can be generated. The query time for 5 minutes of data is relatively short, and the data can be returned quickly with minimal impact on user experience.
[0069] If the target slice duration reaches 5 minutes, taking query condition 1 as an example, we can query Table 1. Page 1 has the highest proportion, so we can first create a second slice task to query the data volume of page 1. When splitting this task, we can calculate the current task duration for querying the data volume of page 1 using the aforementioned formula. If the current task duration is less than 5 minutes (taking the second preset duration of less than 5 minutes as an example), then we create a second slice task with the current task duration. Querying 5 minutes of data takes relatively short time, allowing for quick data return and minimizing the impact on user experience.
[0070] If the current task duration reaches 5 minutes (the second preset duration), several third-slice tasks can be generated according to preset rules. The duration of each third-slice task is less than 5 minutes. For example, two 1-minute slices and one 3-minute slice can be generated. Data volumes shorter than 5 minutes have relatively shorter query times, allowing for faster data return and minimizing the impact on user experience.
[0071] This example can quickly return data with minimal impact on user experience.
[0072] In some related technologies, tasks are typically processed into slices based on a pre-configured fixed slice duration, resulting in several slice tasks with the same slice duration. These slice tasks are then stored in a data queue.
[0073] However, different tasks require different amounts of data and have varying complexity. Using a fixed slice duration makes the time-slicing method inflexible.
[0074] More complex slicing tasks require a longer processing time. Task complexity can include at least one of the following: complex processing conditions, long processing time per task (single task duration), and a large number of loops per task.
[0075] In complex scenarios, untimely processing of slice tasks may lead to a backlog of slice tasks, exhausting data queue resources or preventing the completion of processing tasks within the expected time window.
[0076] In view of this, this application also proposes a time slicing method. Different slicing methods can be selected by using the slice type identifier in the data processing task. If the identifier is the first identifier, indicating that slicing is based on query habits, then the method is adopted. Figure 1 The illustrated method, if the identifier is the second identifier, indicating the use of a task complexity-based segmentation method, then the method shown in this example shall be adopted. This method can select appropriate slicing rules for time slicing based on the complexity of the task to be processed. The slicing rules are used to slice at least two priority tasks; the higher the priority of the sliced task, the better.
[0077] This can lead to the following technical effects:
[0078] First, by flexibly selecting slicing rules based on task complexity, the flexibility and adaptability of time slicing can be improved compared with related technologies.
[0079] Second, since the slicing rules are used to cut out slicing tasks with at least two priorities (short slicing time and long slicing time), compared with related technologies that use fixed slicing time, a portion of high-priority (short slicing time) slicing tasks can be executed first, which is less likely to cause slicing task backlog, exhaustion of data queue resources, or failure to complete processing tasks within the expected time window. Furthermore, a portion of the task processing results can be returned to the user in a timely manner, improving the user experience.
[0080] The following description, in conjunction with the accompanying drawings, illustrates the embodiments. Please refer to the attached figures. Figure 2 , Figure 2 This is a flowchart illustrating a time-slicing method according to an embodiment of this application.
[0081] Figure 2 The illustrated time-slicing method can be applied to electronic devices. These electronic devices can execute the method by incorporating software logic corresponding to the time-slicing method. The type of electronic device can be a laptop, computer, server, mobile phone, PDA, etc. This application does not specifically limit the type of electronic device. The electronic device can also be a client device or a server device.
[0082] like Figure 2 As shown, the method may include S202-S204. Figure 2The illustrated method is a slicing method when the time slice type is identified as the second identifier. Unless otherwise specified, this application does not specifically limit the execution order of these steps.
[0083] S202, determine the complexity of the task to be processed based on the task content of the task to be processed.
[0084] The complexity indicates the degree of complexity of the task to be processed.
[0085] The task details may include task duration and processing conditions. These details can indicate the task complexity.
[0086] For example, a complex task may include at least one of the following situations: complex processing conditions, long processing time (single duration) for a single task, and a large number of loops for a single task.
[0087] By quantifying the various metrics within the task content, the complexity can be calculated using mathematical algorithms. Any method for quantifying these metrics falls within the scope of this application. A relatively accurate complexity calculation method will be illustrated in subsequent embodiments.
[0088] S204, based on the slicing rules corresponding to the complexity, the task to be processed is sliced to obtain several sliced tasks.
[0089] Slicing rules corresponding to different levels of complexity can be flexibly configured in advance, allowing them to better suit tasks of corresponding complexity. For example, the slicing rule for complex tasks can be configured to cut a small number of slices, thereby reducing the backlog of slice tasks and data queue congestion caused by complex tasks. Conversely, the slicing rule for simple tasks can be configured to prioritize cutting slices for tasks with shorter durations, allowing simple tasks to be processed first, reducing the space they occupy in the data queue, and providing more space for complex tasks, thus reducing the backlog of slice tasks and data queue congestion caused by complex tasks.
[0090] The slicing rules are used to slice tasks into at least two priority levels; the higher the priority of the sliced task, the shorter the slice duration. The priority types of the at least two priority tasks can be set according to requirements. In some embodiments, they may include three types: high-priority tasks, medium-priority tasks, and low-priority tasks. The slice duration corresponding to the priority task can also be preset. It should be noted that...
[0091] This allows for shorter processing times and smaller amounts of data for high-priority tasks, improving their processing efficiency. By prioritizing the execution of high-priority tasks, users can obtain some processing results earlier, thus enhancing the user experience.
[0092] In some cases, the maximum execution time of a single task can be preset. When the execution time of the task to be processed exceeds the maximum execution time, the task to be processed can be split into multiple single tasks to be executed.
[0093] For example, the maximum execution time is 24 hours (1 day). Assuming the task to be processed is to process 3 days' worth of data, it can be understood as splitting the task into single tasks that are executed once a day within 3 days.
[0094] In the above scenario, slicing the task to be processed can be understood as slicing a single task each time it is executed. It is understood that when the processing time of the task to be processed does not exceed the maximum execution time, only the task to be processed needs to be sliced.
[0095] In some cases, users set a maximum data processing volume when setting up tasks to be processed. During the S204 slicing process, if the data processing volume of the sliced task has reached the maximum data processing volume, slicing can be stopped, eliminating the need to continue slicing tasks to be processed and allowing the processing tasks to be stopped, thus saving resources.
[0096] The technical solutions disclosed in S202-S204 allow for time slicing based on the complexity of the task to be processed, selecting appropriate slicing rules. These slicing rules are used to slice tasks into at least two priority levels; the higher the priority of the sliced task, the shorter the slice duration.
[0097] This can lead to the following technical effects:
[0098] First, by flexibly selecting slicing rules based on task complexity, the flexibility and adaptability of time slicing can be improved compared with related technologies.
[0099] Second, since the slicing rules are used to cut out slicing tasks with at least two priorities (short slicing time and long slicing time), compared with related technologies that use fixed slicing time, a portion of high-priority (short slicing time) slicing tasks can be executed first, which is less likely to cause slicing task backlog, exhaustion of data queue resources, or failure to complete processing tasks within the expected time window. Furthermore, a portion of the task processing results can be returned to the user in a timely manner, improving the user experience.
[0100] In some embodiments, the complexity can be accurately calculated by pre-quantifying the various dimensions of the task content.
[0101] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating a method for calculating computational complexity as shown in this application. Figure 3 The illustrated steps are a detailed explanation of S202. For example... Figure 3 As shown, the method may include S302-S306.
[0102] The task content may include the duration of a single task, the task duration itself, and the task processing conditions. The task duration may indicate the range of data to be processed. For example, if the task duration is within 15 days, then it indicates that data within 15 days will be processed.
[0103] The single session duration refers to the time range set by the user for a single task. For example, if the single session duration is 8 PM to 9 PM, it indicates that the single task will process one hour of data between 8 PM and 9 PM.
[0104] Combining the duration of a single session with the duration of a task can also determine the data range. For example, if the task duration is 3 days of data, and the duration of a single session is 8 PM to 9 PM, then the task would instruct the processing of one hour of data between 8 PM and 9 PM each day for the next 3 days.
[0105] The task processing conditions include condition types and the number of conditions for each condition type. The condition types may include =, ≠, in, not in, exist, not exists, >, >=, <, <=, etc.
[0106] S302, based on the task duration, obtain the number of times the task is executed.
[0107] In some cases, the maximum execution time of a single task can be preset. When the execution time of the task to be processed exceeds the maximum execution time, the task to be processed can be split into multiple single tasks to be executed.
[0108] The number of times the task to be processed is executed can be obtained by dividing the duration of the task to be processed by the duration of a single execution and then rounding down.
[0109] S304. Based on the unit complexity preset for different condition types and the number of conditions, determine the first complexity of the task processing condition.
[0110] In this step, the number of conditions of each condition type included in the task processing conditions can be obtained by parsing the task processing conditions. Then, the unit complexity preset for different condition types can be obtained, and the first complexity can be obtained based on the number of conditions and the unit complexity.
[0111] In some approaches, the first complexity can be obtained by multiplying the corresponding unit complexity by the number of conditions for each condition type, and then summing the results for each condition type using a weighted average.
[0112] In some methods, for each condition type, if the number of conditions reaches the sixth threshold, a preset complexity is added to the unit complexity to obtain the calculation result corresponding to that condition type. Then, the calculation results for each condition type are weighted and summed to obtain the first complexity.
[0113] S306, Based on the first complexity, the second complexity preset for the single duration, and the third complexity preset for the number of task executions, determine the complexity of the task to be processed.
[0114] In this step, the preset second and third complexities can be obtained, and then the complexity of the task to be processed can be determined by combining the first complexity obtained in S202 through weighted summation or averaging.
[0115] The schemes described in S302-S306 allow for the accurate calculation of complexity by pre-quantifying the various dimensions of the task content.
[0116] In some embodiments, the slicing rule indicates the number of consecutive tasks corresponding to each priority level, as well as the time interval between two adjacent slice tasks.
[0117] The term "continuous quantity" refers to the maximum number of consecutive tasks of the same priority that can be cut off. For example, in a scenario that includes high, medium, and low priority tasks, the continuous quantity corresponding to high priority tasks is 5, which can be used to instruct the continuous cutting off of 5 high priority tasks; the continuous quantity corresponding to medium priority tasks is 3, which can be used to instruct the continuous cutting off of 3 medium priority tasks; and the continuous quantity corresponding to low priority tasks is 2, which can be used to instruct the continuous cutting off of 2 low priority tasks.
[0118] The time interval refers to the time interval between two adjacent slice tasks. For example, if the time interval between any two high-priority tasks is 1 minute, then the time interval between the two high-priority tasks to be sliced is 1 minute.
[0119] It should be noted that the time interval between two adjacent tasks of the same priority and the time interval between two adjacent tasks of different priorities can be the same or different, depending on the business requirements.
[0120] By controlling the number of consecutive elements and the time interval in the slicing rules, the slicing rules can be flexibly configured to adapt to tasks of different complexities.
[0121] In some embodiments, the slicing rule indicates that the number of consecutive tasks corresponding to high-priority tasks is greater than the number of consecutive tasks corresponding to low-priority tasks. This ensures that a portion of high-priority tasks can be sliced out for any task to be processed, allowing some high-priority tasks to be processed first, ensuring that users can obtain partial processing results in advance, and improving user experience.
[0122] In some embodiments, the first slicing rule corresponding to low complexity and the second slicing rule corresponding to high complexity satisfy at least one of the following:
[0123] The first time interval indicated by the first slicing rule is less than the second time interval indicated by the second slicing rule;
[0124] The first consecutive number of high-priority tasks indicated by the first slicing rule is greater than the second consecutive number of high-priority tasks indicated by the second slicing rule.
[0125] In this configuration, the first time interval indicated by the first slicing rule is shorter than the second time interval indicated by the second slicing rule. Therefore, the number of slices obtained for highly complex tasks will be relatively small. Compared with related technologies, this reduces the number of slices generated for complex tasks, thereby reducing the risk of slice task backlog, data queue resource exhaustion, or inability to complete processing tasks within the expected time window due to complex tasks.
[0126] For example, in scenarios involving tasks of varying complexity (low, medium, and high), the number of sliced tasks decreases progressively for low-complexity, medium-complexity, and high-complexity tasks. High-complexity tasks have fewer slices, reducing the likelihood of queue blocking.
[0127] In this scenario, the first consecutive number of high-priority tasks indicated by the first slicing rule is greater than the second consecutive number of high-priority tasks indicated by the second slicing rule. Thus, simpler tasks tend to be sliced into higher-priority (shorter slice time) slices. Compared to related technologies, this allows simpler tasks to be processed first, reducing the space occupied by simpler tasks in the data queue and providing more space for complex tasks. This reduces the accumulation of slice tasks caused by complex tasks, preventing the data queue resources from being exhausted or unable to complete processing within the expected time window.
[0128] For example, in a scenario that includes tasks of high, medium, and low complexity, more high-priority tasks can be separated from low-complexity tasks. This allows simpler tasks to be processed first, reducing the space occupied by simpler tasks in the data queue and providing more space for complex tasks, thus reducing the possibility of queue blocking.
[0129] In some embodiments, tasks with higher priority can be sliced out first, according to their priority order, to ensure that a portion of the processing results can be returned to the user first, thereby improving the user experience.
[0130] Please see Figure 4 , Figure 4 This is a schematic flowchart illustrating a slicing method according to an embodiment of this application. Figure 4 The illustrated steps are a detailed explanation of S204. For example... Figure 4 As shown, the method may include S402-S408.
[0131] S402, cut out a first priority task from the tasks to be processed.
[0132] The first priority task refers to a task with a relatively high priority. In a high, medium, and low priority task scenario, depending on the segmentation process, the first priority task may refer to a high priority task or a medium priority task.
[0133] S404, if the remaining processing time of the task to be processed is not 0 and the number of the first priority tasks has not reached the third consecutive number, a slice of the first priority tasks is cut out; the third consecutive number is the number of consecutive first priority tasks indicated by the slicing rule.
[0134] After completing S402, it can be determined whether the remaining processing time of the task to be processed is 0. If it is not 0, it means that the task to be processed needs to be further segmented. Then, it can be determined whether the number of the first priority tasks has reached the third consecutive number; the third consecutive number is the number of consecutive first priority tasks indicated by the slicing rule. If the third consecutive number has not been reached, it means that the first priority tasks can still be segmented. Then, based on the slicing time interval set by the slicing rule, the first priority tasks can continue to be segmented.
[0135] It should be noted that the "reached" described in this application can be determined as greater than or greater than or equal to, depending on business requirements. The "not reached" described in this application can be determined as less than, or less than or equal to, depending on business requirements.
[0136] S406, when the remaining processing time of the task to be processed is not 0 and the number of the first priority tasks reaches the third consecutive number, a second priority task is cut out; the priority of the second priority task is lower than that of the first priority task.
[0137] If the remaining processing time of the pending task is not 0, and the number of first-priority tasks reaches the third consecutive number, it indicates that the task should be further divided into second-priority tasks with lower priority. Then, based on the slicing time interval set by the slicing rules, second-priority tasks can be sliced out.
[0138] S408, if the remaining processing time of the task to be processed is 0, the slicing is completed.
[0139] If the remaining processing time of the task to be processed is 0, it means that the task to be processed has been sliced. If the tasks of the three priority types have been sliced and the remaining processing time of the task to be processed is still not 0, then the slicing can be repeated from the highest priority task based on the steps shown in S402-S408.
[0140] The schemes described in S402-S408 can be used to slice out higher-priority tasks according to their priority order, ensuring that a portion of the processing results can be returned to the user first, thus improving the user experience.
[0141] In some embodiments, after obtaining the plurality of slice tasks, tasks of different priorities can be stored in data queues of corresponding priorities; wherein slice tasks stored in high-priority data queues are executed first, and / or the execution results of the stored tasks are read first.
[0142] The data queue has a first-in, first-out (FIFO) capability. The task execution result refers to the result obtained after the slice task completes data processing. It should be noted that in practical applications, in addition to the data queue, stacks, arrays, and other storage methods can also be selected according to requirements.
[0143] This allows for priority differentiation of data queues and their correspondence with the priorities of sliced tasks, thereby ensuring that high-priority tasks are processed first, allowing users to obtain a portion of the task processing results (high-priority task results) first, thus improving the user experience.
[0144] In some embodiments, the task to be processed is a data query task, and the task content of the data query task includes the number of data queried reaching a first threshold.
[0145] In some data query tasks, users specify the number of data entries to retrieve. For example, a user might need to retrieve 10 or more data entries. The number of data entries specified by the user is the first threshold. This application uses thresholds such as the first threshold and the second threshold to distinguish thresholds for different purposes.
[0146] Please see Figure 5 , Figure 5 This is a flowchart illustrating a data query method during task execution, as shown in an embodiment of this application. Figure 5 As shown, the method may include S502-S504.
[0147] S502, poll the execution results of all slice tasks corresponding to the data query task.
[0148] The execution structure may include whether the slice task retrieved data, and the amount of data retrieved.
[0149] In one polling cycle, the execution results of all slice tasks can be polled.
[0150] S504, if the number of data polled does not reach the first threshold, the data query task is sliced again and executed.
[0151] In this step, the results of S502 polling can be statistically analyzed. If the number of polled data does not reach the first threshold, the query task needs to be executed again. In this case, the data query task can be sliced and executed again.
[0152] The schemes described in S502-S504 can ensure that the number of data retrieved by the data query task reaches the first threshold and satisfies the query conditions in scenarios with a specified number of data to be queried.
[0153] In some scenarios, data appears at large intervals, and continuously executing data query tasks will frequently return null values, affecting the data return speed and causing resource waste.
[0154] Suppose a data query task needs to retrieve data for 5 days, but no data is generated in the first 3 days, data is available on the 4th day, but no data is available again on the 5th day. In related technologies, the first 3 days and the 5th day will continuously loop and execute slice tasks because no data can be retrieved, resulting in a large number of null data results. This affects the data return speed of other slice tasks and causes a waste of resources.
[0155] To address the above issues, in some embodiments, the number of slice tasks can be reduced when no data is found. This reduces the impact on the data return speed of other slice tasks and also reduces resource consumption.
[0156] Please see Figure 6 , Figure 6 This is a schematic flowchart illustrating a method for further slicing the data query task, as shown in an embodiment of this application. Figure 6 The illustrated steps are a detailed explanation of S504. For example... Figure 6 As shown, the method may include S602-S608.
[0157] S602, Get the current polling count.
[0158] The polling count refers to the number of times the execution results of all slice tasks are polled. Each polling cycle increments the polling count by 1 if the target number is not reached. Once the target number is reached after a polling cycle, the polling count is reset to 0.
[0159] This step of obtaining statistics can be done at this point.
[0160] S604, if the current number of polls has not reached the preset number, the data query task is sliced according to the initial slicing rules.
[0161] The preset number of times can be set according to requirements.
[0162] The initial slicing rule refers to the slicing rule used when slicing a data query task for the first time. For example, if a data query task is determined to be of low complexity by S202, then the slicing rule corresponding to low complexity should be used to slice the data query for the first time, and this slicing rule is the initial slicing rule.
[0163] If the current number of polls has not reached the preset number, it is not enough to conclude that no data will be found in the future. Therefore, the initial slicing rules can still be used to slice and execute.
[0164] S606, when the current polling count reaches the preset count and the number of data reached in each poll is 0, a first preset number of non-highest priority tasks are cut off for the data query task;
[0165] The first preset quantity can be set according to requirements. It is understood that this quantity should not be too large; the smaller the better.
[0166] The term "non-highest priority task" refers to any task other than the highest priority task. For example, in a high, medium, and low priority task scenario, a non-highest priority task could be a medium priority task or a low priority task.
[0167] If the current polling count reaches the preset number and the number of data retrieved in each poll is 0, it indicates that no data has been found for several consecutive times, and therefore no data is expected to be found in the near future. Thus, the number of sliced tasks can be reduced to save space. Furthermore, separating non-highest priority tasks can prevent resource consumption by high-priority tasks, ensuring their smooth execution.
[0168] S608, if the polling result for the non-highest priority task is 0, continue to cut out the first preset number of non-highest priority tasks in the next polling cycle until the polling result for the non-highest priority task is not 0, and resume slicing the data query task according to the initial slicing rule.
[0169] If the polling result for the non-highest priority task is 0, it means that no data was found. The first preset number of non-highest priority tasks can be continued to be slicing until data is found, indicating that data has been generated. Then the initial slicing rules can be restored to slice the data query task.
[0170] Through S602-S608, firstly, the number of slice tasks can be reduced when no data is found, minimizing the impact on the data return speed of other slice tasks and reducing resource consumption. Secondly, non-highest priority tasks can be separated, avoiding resource consumption for high-priority tasks and ensuring their smooth execution. Thirdly, after data is retrieved during the query, the slicing method can be reset to the initial slicing mode until the data volume is reached.
[0171] In scenarios with large amounts of data, especially high-concurrency scenarios, the front end will initiate a large number of data query tasks, which can easily lead to data queue overflow and potentially data loss.
[0172] To address the above issues, in some embodiments, the overflow of the data queue can be monitored, and when it is about to overflow, the processing speed of the data query task can be reduced, or even the data query task can be stopped. After the data queue recovers to a safe level, task processing can be resumed, thereby reducing the probability of data queue overflow and the probability of data loss.
[0173] Please see Figure 7 , Figure 7 This is a schematic flowchart illustrating a method for preventing queue overflow according to an embodiment of this application. Figure 7 As shown, the method may include S702-S706.
[0174] S702, obtain the occupancy rate of the data queue used to store slice tasks and / or the execution results of slice tasks.
[0175] The occupancy rate indicates the overflow status of the data queue. In practical applications, depending on the requirements, the occupancy rate can be selected as the occupancy rate of any data queue, the highest occupancy rate, the average occupancy rate, the total occupancy rate of all data queues, etc.
[0176] S704, when the occupancy rate reaches the second threshold, the task to be processed is stored in the database, and a second preset number of non-lowest priority tasks are cut out from the task to be processed and stored in the corresponding priority data queue.
[0177] The second threshold and the second preset quantity are set according to requirements.
[0178] The term "non-lowest priority task" refers to any task other than the lowest priority task. For example, in a high-medium-low priority task scenario, a non-lowest priority task could be a medium-priority task or a high-priority task. Non-lowest priority tasks have shorter time slices, process less data, and occupy less data queue space, which can delay queue overflow and provide time for the queue to read query results.
[0179] S706, when the occupancy rate reaches the third threshold, the pending tasks and subsequently received pending tasks are stored in the database until the occupancy rate does not reach the fourth threshold, and the pending tasks are read from the database sequentially for slicing.
[0180] The third and fourth thresholds are set according to requirements. If the third threshold is greater than the second threshold, and the queue occupancy rate reaches the third threshold, it indicates that the queue resources are about to be full. In this case, the tasks to be processed can be temporarily stored in another location (such as a database) and no further processing can be performed. The fourth threshold can be understood as a safety line. Once the queue occupancy rate falls below the fourth threshold, it indicates that the queue will not overflow temporarily, and tasks in the database can be processed sequentially, such as slicing.
[0181] The phrase "in order" refers to processing tasks according to their storage order, ensuring the order in which tasks are stored and processed.
[0182] The S702-S706 system can monitor data queue overflow in a tiered manner. At the first tier (when the occupancy rate reaches the second threshold), the processing speed of data query tasks is reduced. At the second tier (when the occupancy rate reaches the third threshold), data query tasks are not processed. After the data queue is restored to a safe level (when the occupancy rate reaches the fourth threshold), task processing is resumed. This reduces the probability of data queue overflow and the probability of data loss.
[0183] The following examples illustrate specific data query tasks.
[0184] The data query task can include querying data for IP=1.1.1.1 within 8 PM to 9 PM each day for the past 5 days. In this data query task scenario, task complexity is categorized into high, medium, and low complexity based on its magnitude. The low complexity slicing rule divides the 1-hour task into 20 slices: 10 high-priority tasks, 6 medium-priority tasks, and 4 low-priority tasks. The slice duration increases sequentially from high to low priority. The medium complexity slicing rule divides the 1-hour task into 15 slices: 8 high-priority tasks, 4 medium-priority tasks, and 3 low-priority tasks. The high complexity slicing rule divides the 1-hour task into 10 slices: 6 high-priority tasks, 3 medium-priority tasks, and 1 low-priority task.
[0185] Please see Figure 8 , Figure 8 This is a schematic diagram illustrating the data query method flowchart of this application. Figure 8 As shown, the method may include steps S801-S811. Unless otherwise specified, this application does not limit the order in which these steps are performed.
[0186] S801, Data Query Task.
[0187] The data query task includes the data query task constructed by the user based on the web page.
[0188] S802, parse the data query task to obtain the task content.
[0189] The task content is computer-recognizable. The task content may include querying 5 days of data, with a single query duration of 1 hour, and the query condition being IP=1.1.1.1.
[0190] S803: Based on the task content, determine whether the task is valid. If valid, proceed to S804; otherwise, terminate the task processing and display an error message.
[0191] The content of the validity verification can be set according to requirements. For example, validity verification may include whether the duration of a single instance exceeds 24 hours, or whether the start time of the time range is greater than the end time, etc.
[0192] S804: Calculate the complexity of the data query task based on the task content and select the appropriate slicing rule.
[0193] S805, determine whether the total occupancy rate of the data queue has reached the third threshold. If it has, proceed to S806. If the total occupancy rate has not reached the third threshold, proceed to S807.
[0194] S806: Store the data query task in the database without processing it until the total occupancy rate is lower than the fourth threshold, then retrieve the data query task from the database for processing.
[0195] S807: Determine whether the total occupancy rate of the data queue has reached the second threshold. If it has, execute S808; otherwise, execute S809.
[0196] S808, the data query task is cut out into a first preset number of non-highest priority tasks and stored in a queue, and the remainder is stored in the database.
[0197] S809, Select a slicing rule corresponding to the complexity, slice the data query task, and obtain several sliced tasks.
[0198] Assuming the data query task has low complexity, the slicing rule corresponding to low complexity can be selected for slicing. Thus, the task can be divided into 20 slice tasks: 10 high-priority tasks, 6 medium-priority tasks, and 4 low-priority tasks.
[0199] S810, the several slice tasks are placed into the corresponding queues according to their priority.
[0200] These slice tasks allow you to perform data queries based on query time, query conditions, and other criteria.
[0201] S811 periodically polls the query results of the slice task and returns them to the front end.
[0202] In process S811, if 0 data entries are found after a preset number of consecutive queries, in the subsequent processing of the data query task, only one non-highest priority task can be cut out and placed in the corresponding data queue until the data is found, and then the initial slicing rules are restored for slicing.
[0203] The S801-S811 approach has at least the following advantages:
[0204] First, by flexibly selecting slicing rules based on task complexity, the flexibility and adaptability of time slicing can be improved compared with related technologies.
[0205] Second, since the slicing rules are used to cut out slicing tasks with at least two priorities (short slicing time and long slicing time), compared with related technologies that use fixed slicing time, a portion of high-priority (short slicing time) slicing tasks can be executed first, which is less likely to cause slicing task backlog, exhaustion of data queue resources, or failure to complete processing tasks within the expected time window. Furthermore, a portion of the task processing results can be returned to the user in a timely manner, improving the user experience.
[0206] Third, the data queue can be prioritized and matched with the priority of the sliced tasks, thereby ensuring that high-priority tasks are processed first, allowing users to obtain a portion of the task processing results (high-priority task results) first, thus improving the user experience.
[0207] Fourth, when no data is found, the number of slice tasks can be reduced, which reduces the impact on the data return speed of other slice tasks and reduces resource consumption.
[0208] Fifth, it can separate non-highest priority tasks and avoid occupying resources for high priority tasks, ensuring the smooth execution of high priority tasks.
[0209] Sixth, after querying and extracting data, the slicing method can be reset to the initial slicing mode until the data volume is reached.
[0210] Seventh, the overflow of the data queue can be monitored in layers. At the first level (when the occupancy rate reaches the second threshold), the processing speed of data query tasks can be reduced. At the second level (when the occupancy rate reaches the third threshold), data query tasks can be stopped. After the data queue is restored to a safe level (when the occupancy rate reaches the fourth threshold), task processing can be resumed. This can reduce the probability of data queue overflow and the probability of data loss.
[0211] Corresponding to any of the foregoing embodiments, this application also proposes a time-slicing device. Please see [link to relevant documentation]. Figure 9 , Figure 9 This is a schematic diagram of the time-slicing device illustrated in this application.
[0212] like Figure 9 The time slicing device 900 includes:
[0213] The acquisition module 910 is used to acquire tasks to be processed; the tasks to be processed include target query conditions.
[0214] The first determining module 920 is used to determine, based on query habit information learned from page-turning behavior of several preset pages, the number of pages whose percentage of page turns exceeds a preset threshold under the target query condition; the query habit information includes the percentage of each preset page being turned under different query conditions.
[0215] The second determining module 930 is used to determine the target slice duration based on the number of pages, the amount of data displayed per page, and the amount of unit data learned from historical query tasks.
[0216] The segmentation module 940 includes segmenting the target data query task according to the target slice duration.
[0217] In some embodiments, the plurality of preset pages are used to display the data retrieved by the historical query task; the page turning information includes the number of page turns;
[0218] The device 900 further includes a learning module, used for:
[0219] Obtain the historical query conditions included in the historical query task;
[0220] Based on the user's page-turning actions, count the number of times each preset page is turned;
[0221] Based on the number of queries, the percentage corresponding to each preset page under the historical query conditions is generated.
[0222] In some embodiments, the segmentation module 940 is further configured to:
[0223] If the target slice duration does not reach the first preset duration, the first slice task of the target slice duration is cut out;
[0224] When the target slice duration reaches the first preset duration, the percentage sorting is performed, and slices are performed sequentially from high to low until the target slice duration is completed; wherein each slice method includes: determining the current slice duration based on the amount of data to be sliced and the unit data amount corresponding to the current slice; when the current slice duration has not reached the second preset duration, a second slice task of the current slice duration is sliced out; and when the current slice duration reaches the second preset duration, several third slice tasks are sliced out, wherein the slice duration of the third slice task is less than the second preset duration.
[0225] In some embodiments, the task to be processed includes a time slice type identifier; when the time slice type identifier is a second identifier, the device 900 further includes:
[0226] The third determining module is used to determine the complexity of the task to be processed based on the task content of the task to be processed; the complexity indicates the degree of complexity of the task to be processed.
[0227] The slicing module is used to slice the task to be processed based on slicing rules corresponding to the complexity, thereby obtaining several sliced tasks; the slicing rules are used to slice out at least two priority tasks; the higher the priority of the sliced task, the shorter the slicing time.
[0228] In some embodiments, the task content includes the duration of a single task, the task duration, and task processing conditions; the task processing conditions include condition types and the number of conditions for each condition type; the third determining module is further configured to:
[0229] The number of times the task was executed is obtained based on the task duration;
[0230] The first complexity of the task processing condition is determined based on the unit complexity preset for different condition types and the number of conditions.
[0231] Based on the first complexity, the second complexity preset for the single duration, and the third complexity preset for the number of task executions, the complexity of the task to be processed is determined.
[0232] In some embodiments, the slicing rule indicates the number of consecutive tasks corresponding to each priority level, as well as the time interval between two adjacent slice tasks;
[0233] The slicing rule indicates that the number of consecutive tasks corresponding to high-priority tasks is greater than the number of consecutive tasks corresponding to low-priority tasks.
[0234] And / or,
[0235] The first slicing rule corresponding to low complexity and the second slicing rule corresponding to high complexity satisfy at least one of the following:
[0236] The first time interval indicated by the first slicing rule is less than the second time interval indicated by the second slicing rule;
[0237] The first consecutive number of high-priority tasks indicated by the first slicing rule is greater than the second consecutive number of high-priority tasks indicated by the second slicing rule.
[0238] In some embodiments, the slicing module is further configured to:
[0239] Cut out a first-priority task from the tasks to be processed;
[0240] If the remaining processing time of the pending task is not 0 and the number of first priority tasks has not reached the third consecutive number, a slice of first priority tasks is cut out; the third consecutive number is the number of consecutive first priority tasks indicated by the slicing rule.
[0241] If the remaining processing time of the pending task is not 0 and the number of the first priority tasks reaches the third consecutive number, a second priority task is cut out; the priority of the second priority task is lower than that of the first priority task.
[0242] When the remaining processing time of the task to be processed is 0, the slice is completed.
[0243] In some embodiments, the task to be processed is a data query task, and the task content of the data query task includes the number of data queried reaching a first threshold.
[0244] After obtaining the aforementioned slice tasks, the device 900 further includes:
[0245] The polling module is used to poll the execution results of all slice tasks corresponding to the data query task;
[0246] If the number of data retrieved in the poll does not reach the first threshold, the data query task is sliced again and executed.
[0247] In some embodiments, the apparatus 900 further includes a re-slicing module for re-slicing the data query task, for:
[0248] Get the current polling count;
[0249] If the current number of polls has not reached the preset number, the data query task is sliced according to the initial slicing rules;
[0250] When the current polling count reaches the preset count and the number of data points reached in each poll is 0, a first preset number of non-highest priority tasks are selected for the data query task.
[0251] If the polling result for the non-highest priority task is 0, the first preset number of non-highest priority tasks will continue to be sliced in the next polling cycle until the polling result for the non-highest priority task is not 0, and the data query task will be sliced according to the initial slicing rule.
[0252] The data query task is further sliced. After determining the task complexity corresponding to the task to be processed based on the task content, the device 900 further includes a task migration module, used for:
[0253] Get the occupancy rate of the data queue used to store slice tasks and / or the execution results of slice tasks;
[0254] When the occupancy rate reaches the second threshold, the tasks to be processed are stored in the database, and a second preset number of non-lowest priority tasks are cut out from the tasks to be processed and stored in the corresponding priority data queue.
[0255] When the occupancy rate reaches the third threshold, the pending tasks and subsequent received pending tasks are stored in the database until the occupancy rate does not reach the fourth threshold. Then, the pending tasks are read from the database sequentially and sliced.
[0256] The embodiments of the time-slicing device shown in this application can be applied to electronic devices. Accordingly, this application discloses an electronic device that may include a processor.
[0257] Memory used to store processor-executable instructions.
[0258] The processor is configured to invoke executable instructions stored in the memory to implement the time slicing method shown in any of the foregoing embodiments.
[0259] Please see Figure 10 , Figure 10 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application.
[0260] like Figure 10 As shown, the electronic device may include a processor for executing instructions, a network interface for network connectivity, memory for storing operational data for the processor, and non-volatile memory for storing instructions corresponding to the time-slicing device.
[0261] The embodiments of the device can be implemented through software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of its host electronic device reading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, besides... Figure 10 In addition to the processor, memory, network interface, and non-volatile memory shown, the electronic device in which the device is located in the embodiment may also include other hardware depending on the actual function of the electronic device, which will not be described in detail here.
[0262] It is understandable that, in order to improve processing speed, the instructions corresponding to the time slicing device can also be directly stored in memory, and this is not limited here.
[0263] This application proposes a computer-readable storage medium storing a computer program that can be used to cause a processor to execute the time-slicing method shown in any of the foregoing embodiments.
[0264] Those skilled in the art will understand that one or more embodiments of this application can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (which may include, but are not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0265] In this application, "and / or" means having at least one of the two. The various embodiments in this application are described in a progressive manner, and similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the data processing device embodiments are basically similar to the method embodiments, so the description is relatively simple, and relevant parts can be referred to the description of the method embodiments.
[0266] While this application contains numerous specific implementation details, these should not be construed as limiting the scope of any disclosure or the scope of the claims, but rather are primarily used to describe the features of specific embodiments of a particular disclosure. Certain features described in the multiple embodiments of this application may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation of a sub-combination.
[0267] Similarly, although operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the described embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0268] The above are merely preferred embodiments of one or more embodiments of this application and are not intended to limit the scope of one or more embodiments of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this application should be included within the scope of protection of one or more embodiments of this application.
Claims
1. A time-slicing method, characterized in that, include: Get tasks to be processed; The task to be processed includes the target query conditions and the time slice type identifier; When the time slice type is identified as the first identifier, based on the query habit information learned from page turning patterns of several preset pages, the number of pages whose percentage of being turned exceeds a preset threshold under the target query condition is determined; the query habit information includes the percentage of each preset page being turned under different query conditions. The target slice duration is determined based on the number of pages, the amount of data displayed per page, and the amount of data per unit learned from historical query tasks. Based on the target slice duration, segment the target data query task; When the time slice type is identified as the second identifier, the complexity of the task to be processed is determined according to the task content of the task to be processed. The complexity indicates the degree of complexity of the task to be processed; Based on the slicing rules corresponding to the complexity, the task to be processed is sliced to obtain several sliced tasks; the slicing rules are used to slice out at least two priority tasks; the higher the priority of the sliced task, the shorter the slicing time; the slicing rules indicate that high-priority sliced tasks should be sliced out first. Compared to high complexity, low complexity results in more high-priority slice tasks, and the time interval between two adjacent high-priority slice tasks is shorter. The method further includes: Get the occupancy rate of the data queue used to store slice tasks and / or the execution results of slice tasks; When the occupancy rate reaches the second threshold, the tasks to be processed are stored in the database, and a second preset number of high-priority tasks are cut off from the tasks to be processed and stored in the corresponding priority data queue. When the occupancy rate reaches the third threshold, the pending tasks and subsequent received pending tasks are stored in the database until the occupancy rate does not reach the fourth threshold. Then, the pending tasks are read from the database sequentially and sliced.
2. The time slicing method according to claim 1, characterized in that, The step of determining the number of pages whose frequency of browsing exceeds a preset threshold under the target query condition, based on query habit information learned from page-turning patterns of several preset pages, includes: Query the query habit information; The percentage of each preset page corresponding to the target query condition that is viewed is obtained from the query habit information.
3. The time slicing method according to claim 1, characterized in that, The determination of the target slice duration based on the number of pages, the amount of data displayed per page, and the amount of unit data learned from historical query tasks includes: Input the number of pages, the amount of data displayed per page, and the amount of data per unit learned from historical query tasks into the formula T = (A * X) / N to determine the duration of the target slice; Where T is the target slice duration, A is the determined number of pages, X is the preset amount of data displayed per page, and N is the unit data volume.
4. The time-slicing method according to claim 1 or 2, characterized in that, The target query conditions include at least one of the following: Query time range; Query rules; page number.
5. The time slicing method according to claim 1, characterized in that, The preset pages are used to display the data retrieved by the historical query task; the page turning information includes the number of page turns. The methods for learning query habit information include: Obtain the historical query conditions included in the historical query task; Based on the user's page-turning actions, count the number of times each preset page is turned; Based on the number of queries, the percentage corresponding to each preset page under the historical query conditions is generated.
6. The time slicing method according to claim 1, characterized in that, The step of segmenting the target data query task according to the target slice duration includes: If the target slice duration does not reach the first preset duration, the first slice task of the target slice duration is cut out; When the target slice duration reaches the first preset duration, the percentage sorting is performed, and slices are performed sequentially from high to low until the target slice duration is completed; wherein each slice method includes: determining the current slice duration based on the amount of data to be sliced and the unit data amount corresponding to the current slice; when the current slice duration has not reached the second preset duration, a second slice task of the current slice duration is sliced out; and when the current slice duration reaches the second preset duration, several third slice tasks are sliced out, wherein the slice duration of the third slice task is less than the second preset duration.
7. The time slicing method according to claim 1, characterized in that, The task to be processed is a data query task. The task content of the data query task includes: the number of data queried reaches a first threshold; if the number of data queried does not reach the first threshold, the data query task is sliced again and executed. The method for further slicing the data query task includes: Get the current polling count; If the current number of polls has not reached the preset number, the data query task is sliced according to the initial slicing rules; When the current polling count reaches the preset count and the number of data points reached in each poll is 0, a first preset number of non-highest priority tasks are selected for the data query task.
8. The time slicing method according to claim 7, characterized in that, The method for further slicing the data query task also includes: If the polling result for the non-highest priority task is 0, the first preset number of non-highest priority tasks will continue to be sliced in the next polling cycle until the polling result for the non-highest priority task is not 0, and the data query task will be sliced according to the initial slicing rule.
Citation Information
Patent Citations
Method for providing quick content service for mobile phone user
CN101656752A
Data query method and device, storage medium and electronic device
CN110427390A