A method and apparatus for updating a traffic information policy

By introducing update flag and counter management into the RTA service, and utilizing multi-threading and soft links of dynamic libraries, the problems of blocked changes and high costs in traffic information policy updates are solved, achieving stable updates and zero-latency policy responses under high concurrency.

CN117171460BActive Publication Date: 2026-02-17DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311117367.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2026-02-17
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

Existing traffic information policy update methods suffer from problems such as obstructed changes, high design and maintenance costs, increased vulnerability to real-time reading, and significant traffic loss.

Method used

By introducing update flags, thread state arrays, unload counters, and symbolic link counters, and utilizing multiple threads and dynamic libraries in the RTA service, stable updates of traffic information policies are achieved, dynamic library update command conflicts are avoided, and the continuous operation of the RTA service is guaranteed.

Benefits of technology

It enables stable updates of traffic information policies, reduces design, maintenance and communication costs, avoids traffic loss, and ensures the continuous and uninterrupted operation of RTA services and high-concurrency policy response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117171460B_ABST
    Figure CN117171460B_ABST
Patent Text Reader

Abstract

The disclosure provides a traffic information policy updating method and device, and relates to the technical field of big data application. The specific implementation of the method comprises the following steps: receiving a traffic information request sent by one or more request ends; selecting a target thread for the traffic information request from multiple threads; judging whether the update flag is a first attribute value by using the target thread; in the case that the update flag is the first attribute value, the target thread acquires a traffic information policy corresponding to the update flag, and waits for the state change of other threads; until the state identifiers of the multiple threads all become the second state, the target thread returns the loaded traffic information policy to the request end in response to the traffic information request. The implementation can avoid the RTA service crash problem caused by the conflict of dynamic library update instructions, realize the scientific management of the super-high-concurrency traffic information policy response and the dynamic library, guarantee the continuous and uninterrupted operation of the RTA service, and improve the robustness of the dynamic library update.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of big data application technology, and in particular to a method and apparatus for updating traffic information strategies. Background Technology

[0002] Traffic information strategies, such as user data and ad placements, can be provided to marketers via RTA (Real-Time API) to help them decide whether to bid for ad placements. Successfully bid ad placements will then display the marketer's marketing strategy. As the market environment and user behavior continue to change, traffic information strategies need to be constantly adjusted.

[0003] The existing traffic information policy adjustment process mainly includes three methods: calling third-party interfaces to obtain the real-time changes to the traffic information policy; or using databases or other means to store the traffic information policy in order to read the changes in real time; or hardcoding the update of the traffic information policy into the RTA and restarting the RTA process each time a change is made.

[0004] However, third-party interfaces are subject to interruptions due to network latency, which can hinder changes, and their design, maintenance, and communication costs are high. Using databases to retrieve data is costly and limited by data quality and availability, which increases the vulnerability of databases and other storage methods during real-time reading. Hard-coded restarts have gaps, and load balancing rebalancing takes too long, resulting in significant traffic loss for policy requests. Summary of the Invention

[0005] In view of this, the present disclosure provides a method and apparatus for updating traffic information policies, which can solve the problems of obstructed changes, high design, maintenance and communication costs, high retrieval costs, increased vulnerability of real-time reading, and significant traffic loss.

[0006] To achieve the above objectives, according to one aspect of this disclosure, a method for updating a traffic information policy is provided. The update method is applied to an RTA service, which includes multiple threads and an update flag. The update method includes:

[0007] Receive traffic information requests from one or more requesting clients;

[0008] Select a target thread from multiple threads to request the traffic information;

[0009] The target thread determines whether the update flag is the first attribute value. If the update flag is the first attribute value, the target thread obtains the traffic information strategy corresponding to the update flag and waits for the state change of other threads.

[0010] Once all the status flags of the multiple threads have changed to the second state, in response to the traffic information request, the target thread returns the loaded traffic information strategy to the requesting end.

[0011] According to another aspect of this disclosure, an apparatus for updating a traffic information policy is provided, the updating apparatus being applied to an RTA service, the RTA service including multiple threads and update flags, the updating apparatus comprising:

[0012] The receiving module is used to receive traffic information requests sent by one or more requesting clients;

[0013] The selection module is used to select a target thread from multiple threads for the traffic information request;

[0014] The loading module is used to determine whether the update flag is the first attribute value using the target thread. If the update flag is the first attribute value, the target thread obtains the traffic information strategy corresponding to the update flag and waits for the state change of other threads.

[0015] The response module is used to respond to the traffic information request after all the status flags of the multiple threads have changed to the second state. The target thread returns the loaded traffic information policy to the requesting end.

[0016] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0017] Processor; and

[0018] Stored program memory,

[0019] The program includes instructions that, when executed by the processor, cause the processor to perform the method for updating the traffic information policy.

[0020] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform a method for updating the traffic information policy.

[0021] The one or more technical solutions provided in this application embodiment, by introducing update flags, thread state arrays, unload counters, and soft link counters, and setting up separate policy units to store each dynamic library, achieve stable updates of traffic information policies, avoid the RTA service crash problem caused by dynamic library update command conflicts, and eliminate the need for third-party interfaces, database fetching, and hard coding. Based on the control of thread states and the judgment of various counters and update flags, the robustness of traffic information policy updates of dynamic libraries is ensured. Moreover, after loading, subsequent requests can directly reuse the system without repeated calls and fetching. This enables traffic information policy response and scientific management of dynamic libraries at ultra-high concurrency (e.g., 100,000 QPS on a single machine), ensuring the continuous and uninterrupted operation of RTA services, avoiding service interruptions due to network latency and update restarts, reducing design, maintenance, communication, and fetching costs, avoiding traffic loss, and achieving the technical effect of uninterrupted and latency-free policy dynamic library updates. Attached Figure Description

[0022] Further details, features, and advantages of this disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0023] Figure 1 A flowchart illustrating a method for updating a traffic information policy according to an exemplary embodiment of the present disclosure is shown;

[0024] Figure 2 A framework diagram of an RTA service according to an exemplary embodiment of this disclosure is shown;

[0025] Figure 3 A schematic diagram illustrating an application of an RTA service according to an exemplary embodiment of the present disclosure is shown;

[0026] Figure 4 A schematic diagram illustrating the thread ID for the initial startup of an RTA service according to an exemplary embodiment of this disclosure is shown;

[0027] Figure 5 A schematic diagram illustrating the initial allocation of a thread ID according to an exemplary embodiment of the present disclosure is shown;

[0028] Figure 6 A schematic diagram illustrating the subsequent allocation of thread IDs according to an exemplary embodiment of this disclosure is shown;

[0029] Figure 7 A flowchart is shown of a method for managing the lifecycle of dynamic library update instructions according to an exemplary embodiment of this disclosure;

[0030] Figure 8 A schematic diagram showing the RTA service without an update flag in Comparative Embodiment 1 is illustrated;

[0031] Figure 9A schematic diagram showing the RTA service without an update flag in Comparative Embodiment 2 is illustrated;

[0032] Figure 10 A schematic diagram showing the RTA service without an update flag in Comparative Embodiment 3 is illustrated;

[0033] Figure 11 A schematic diagram illustrating the addition of an update flag to an RTA service according to an exemplary embodiment of this disclosure is shown;

[0034] Figure 12 A flowchart illustrating a method for obtaining traffic information strategy of a target thread according to an exemplary embodiment of the present disclosure is shown;

[0035] Figure 13 A flowchart illustrating a method for loading a traffic information policy according to an exemplary embodiment of the present disclosure is shown;

[0036] Figure 14 This diagram illustrates a previous version of a dynamic library before it is uninstalled, according to an exemplary embodiment of this disclosure.

[0037] Figure 15 This diagram illustrates the state of a dynamic library after being uninstalled in a previous version according to an exemplary embodiment of this disclosure.

[0038] Figure 16 This diagram illustrates the completion of loading the traffic information policy of the current updated version of the dynamic library for the target thread according to an exemplary embodiment of this disclosure;

[0039] Figure 17 A flowchart is shown showing the completion of the loading of the traffic information policy of the current updated version of the dynamic library for all threads according to an exemplary embodiment of this disclosure;

[0040] Figure 18 A schematic diagram illustrating the initial startup of an RTA service according to an exemplary embodiment of this disclosure is shown;

[0041] Figure 19 A schematic block diagram of a traffic information policy update apparatus according to an exemplary embodiment of the present disclosure is shown;

[0042] Figure 20 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0043] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0044] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0045] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0046] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0047] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0048] RTA: Real-Time API, refers to a real-time interface that sends traffic information strategies, such as ad placements and user information, to marketers based on user behavior when visiting a website or application.

[0049] Dynamic Library (DLL): A DLL is a library containing executable code that can be used by multiple programs simultaneously, allowing processes to directly call functions in the DLL. For example, a C++ dynamic library can be a .so file.

[0050] A soft link, also called a symbolic link, is a separate file whose content is the path string of the linked target. It can be understood as a shortcut to the linked target, allowing for flexible switching between different linked targets. For example, the linked target can be different versions of a dynamic library.

[0051] Compared to existing RTA methods that update traffic information policies by calling third-party interfaces, real-time database retrieval, or hard-coding, the traffic information policy update method disclosed herein uses symbolic links to different dynamic libraries. This eliminates reliance on external interfaces and databases, avoids restarting the RTA service process, and prevents update disruptions caused by network latency. It also avoids the communication and maintenance costs of third-party interfaces and the costs of database retrieval. This allows for continuous, real-time updates of traffic information policies while the RTA service is running normally without interruption, preventing traffic loss during policy requests. When a policy changes, simply linking to the new dynamic library allows for reloading and updating the policy using the compiled library. This enables latency-free hot reloading of policies under high concurrency, achieving dynamic management of traffic information policies. Ultimately, this satisfies the policy requests of marketers, allowing them to select traffic information policies based on the latest market environment and user behavior, leading to more rational decision-making.

[0052] The present disclosure is described below with reference to the accompanying drawings.

[0053] Figure 1 A flowchart illustrating a method for updating a traffic information policy according to an exemplary embodiment of this disclosure is shown, such as... Figure 1 As shown, the method for updating the traffic information policy disclosed herein includes the following steps:

[0054] In this embodiment of the disclosure, the method for updating the traffic information policy is executed by the RTA service, such as... Figure 2 As shown, the RTA service includes multiple threads, update flags, symbolic links (represented by ellipses), a symbolic link counter in the upper right corner of the symbolic link, one or more dynamic libraries (represented by circles), and an uninstallation counter.

[0055] Step S101: Receive traffic information requests sent by one or more requesting ends.

[0056] In the embodiments disclosed herein, such as Figure 3 As shown, the RTA service receives traffic information requests from various marketers and responds by returning the latest traffic information strategy to them. Marketers then evaluate the value of the ad placement based on the received strategy and decide whether to bid for it. The marketing strategy of the winning marketer can be displayed on the ad placement. The traffic information strategy includes user information and ad placement location information. User information includes user type, user preferences, and user behavior, while location information includes location area, ad size, and display style.

[0057] Step S102: Select a target thread from multiple threads for the traffic information request.

[0058] In this embodiment of the disclosure, the RTA service randomly or sequentially selects one thread from multiple threads as the target thread and determines the thread ID of the target thread. The thread ID is the ID assigned to a thread by the RTA service to uniquely identify a thread. When the RTA service starts for the first time, such as... Figure 4 As shown, none of the threads have processed traffic information requests yet. The initial value of the thread ID is set to "-1" as a flag indicating whether it is the first allocation. A sequential selection method is used, allocating target threads to traffic information requests according to the thread order of idle threads. The corresponding thread IDs are 0, 1, and 2, respectively. Figure 5 As shown; by using a random selection method, any idle thread can be randomly selected as the target thread and assigned a thread ID.

[0059] Furthermore, after the initial allocation is completed, the thread ID has been generated. When processing subsequent traffic information requests, such as... Figure 6 As shown, target threads can be assigned to each traffic information request in a random or sequential manner.

[0060] Furthermore, when each dynamic library is loaded for the first time, traffic information requests of the same number as the total number of threads in the RTA service are randomly or sequentially allocated to each thread, so that each thread can quickly load traffic information strategies and provide strategy services to the marketing parties at each requesting end in a timely manner.

[0061] Step S103: The target thread determines whether the update flag is the first attribute value. If the update flag is the first attribute value, the target thread obtains the traffic information strategy corresponding to the update flag and waits for the state change of other threads.

[0062] In this embodiment of the disclosure, the RTA service is provided with an independent policy unit for storing various dynamic libraries. The dynamic libraries in the policy unit can be added in real time or offline. Each time a dynamic library is added, an update message is sent to the RTA service. The RTA service then issues a dynamic library update instruction based on the update message, causing each thread to execute the function of the dynamic library corresponding to the dynamic library update instruction to load the new dynamic library and obtain the current updated version of the traffic information policy.

[0063] Furthermore, since the issuance of dynamic library update commands involves changes to symbolic links and a unified reset of thread state flags across multiple threads, and the RTA service's process mechanism requires all threads to be in the same state before switching to the next thread, this disclosure of the RTA service adds an update flag to ensure a smooth transition between different dynamic library update commands. This flag is used to prevent RTA service crashes caused by conflicts in pointers and state flags due to small time differences between the issuance times of different dynamic library update commands. Figure 7 As shown, the lifecycle management method for dynamic library update instructions disclosed herein includes the following steps:

[0064] In this embodiment of the disclosure, the method for managing the lifecycle of dynamic library update instructions is executed by the RTA service.

[0065] Step S701: Obtain the count value of the soft chain counter.

[0066] Step S702: Determine whether the count value of the soft chain counter is equal to the total number of threads. If yes, proceed to step S703; otherwise, proceed to step S710.

[0067] In this embodiment, the initiation of dynamic library update commands and dynamic library version queries can only be triggered when the soft link counter's count value equals the total number of threads. Therefore, before responding to a dynamic library update message, it is necessary to determine whether the soft link counter's count value equals the total number of threads. Specifically, a soft link counter count value equal to the total number of threads indicates that the previous version of the dynamic library has been loaded, and the next version of the dynamic library can be loaded.

[0068] Step S703: Respond to the update message of the dynamic library; wherein the update message includes the update path of the dynamic library.

[0069] In this embodiment of the disclosure, when the count value of the soft link counter is equal to the total number of threads, it indicates that the thread state of all threads is loaded and can respond to the update message of the dynamic library. The dynamic library stores the code parsed from the traffic information strategy. That is, the dynamic library includes the relevant functions of the traffic message strategy, and each thread can obtain the corresponding traffic message strategy by executing the function.

[0070] Furthermore, the update path includes the version identifier of the current updated version of the dynamic library.

[0071] Step S704: Generate a dynamic library update instruction for the dynamic library according to the update path.

[0072] In this embodiment of the disclosure, the RTA service generates a dynamic library update instruction based on the update path, so as to modify the pointer of the soft link based on the update path, so that each thread calls the function of the dynamic library according to the new pointer of the soft link, thereby loading the traffic information strategy in the dynamic library.

[0073] Step S705: Determine whether the attribute value of the update flag is the first attribute value. If yes, proceed to step S706; otherwise, proceed to step S707.

[0074] In this embodiment, due to the frequent occurrence of dynamic library update messages, multiple dynamic library update instructions may be triggered within a short time difference when the soft link counter value equals the total number of threads. To avoid the aforementioned conflict problem of dynamic library update instructions, an added update flag is used to manage the execution status of dynamic library update instructions, ensuring that only one dynamic library update instruction is executed and processed at any given time, thus preventing conflicts from causing RTA service crashes. An RTA service crash occurs when, due to a small time difference, the state switching of some threads in a previous dynamic library update instruction is reset by the subsequent dynamic library update instruction, making it impossible to reach a consistent state with other threads (the switched thread is either unloaded or loaded, while other threads are either not unloaded or not loaded), resulting in all threads being unable to maintain consistency and crashing, thus failing to provide RTA services.

[0075] Furthermore, the existence of a currently executing dynamic library update command is determined based on the attribute value of the update flag. The update flag is an atomic boolean variable used to prevent RTA service crashes caused by conflicts between multiple dynamic library update commands. The update flag has two attribute values: a first attribute value of "TRUE" and a second attribute value of "FALSE". A "TRUE" update flag indicates that a current dynamic library update command is being initiated; a "FALSE" update flag indicates that the previous dynamic library update command has been completed.

[0076] Step S706, continue waiting, proceed to step S705.

[0077] In this embodiment of the disclosure, if the attribute value of the update flag is the first attribute value, it indicates that the RTA service is initiating a dynamic library update command. Therefore, in order to prevent conflicts in the dynamic library update command, the update flag is waited for its attribute value to change.

[0078] Step S707: Issue the dynamic library update command.

[0079] In this embodiment of the disclosure, when the attribute value of the update flag is the second attribute value, it indicates that the previous dynamic library update instruction has been initiated and completed. Furthermore, since the count value of the soft link counter is equal to the total number of threads, it also indicates that the previous dynamic update instruction has been loaded and completed. Therefore, the RTA service can issue a new dynamic library update instruction.

[0080] Step S708: Modify the target of the symbolic link to the update path.

[0081] In this embodiment of the disclosure, when issuing the dynamic library update instruction, the soft link is modified to point to the update path of the dynamic library update instruction. This allows each thread to reference the dynamic library based on the modified soft link, thereby enabling the loading and updating of traffic information strategies. For example, before the update, the soft link points to dynamic library A, and after the update, the soft link points to dynamic library B.

[0082] Step S709: Set the thread state of the multiple threads to the first state, modify the update flag to the first attribute value, and reset the unload counter to zero.

[0083] In this embodiment of the disclosure, while issuing the dynamic library update instruction, the thread state of all threads is uniformly set to the first state (i.e., "2"), the update flag is modified to the first attribute value "TRUE", and the unload counter is reset to zero, so that each thread starts loading the dynamic library traffic information strategy of the dynamic library update instruction without being interfered with by other dynamic library update instructions.

[0084] To better illustrate the conflict issue of dynamic library update commands mentioned above, let's take the case without an update flag as an example. When the soft link counter's count value equals 5, the short-time difference RTA service detects that the soft link counter's count value equals the total number of threads and consecutively issues dynamic library B update commands and dynamic library C update commands. Issuing the dynamic library B update command will directly set the status flag of all threads to "2". Figure 8 As shown; after threads 0 and 2 successfully uninstall dynamic library B and update the previous version of dynamic library A, they change the status flag to "0", as shown. Figure 9 As shown; at this time, the dynamic library C update instruction is issued, directly resetting the status flag of all threads to "2", as shown. Figure 10 As shown, dynamic library A has not been uninstalled for threads 1, 3, and 4, and there are no uninstallable dynamic libraries for threads 0 and 2, causing all threads to be unable to reach a consensus and the RTA service to crash.

[0085] After adding the update flag in this disclosure, even if the RTA service issues update commands for dynamic library B and dynamic library C consecutively within a short time interval, the update command for dynamic library B will directly modify the attribute value of the update flag to "TRUE". Figure 11As shown, the update flag attribute value will only be changed to "FALSE" after all threads have finished loading the traffic information policy of dynamic library B, thereby processing the update instruction of dynamic library C, ensuring the complete update of dynamic library B, and thus ensuring the stable operation of RTA service.

[0086] Step S710: Suspend the update message of the dynamic library and proceed to step S701.

[0087] In this embodiment of the disclosure, if the count value of the soft link counter is not equal to the total number of threads, the received dynamic library update message is suspended, and the count value of the soft link counter is further determined.

[0088] In this embodiment, the lifecycle management method for dynamic library update commands disclosed herein manages the execution of dynamic library update commands based on the attribute value of the update flag when issuing them. This ensures that only one dynamic library update command is executed at any given time, preventing RTA service crashes caused by command conflicts and guaranteeing the stable operation of the RTA service.

[0089] In the embodiments disclosed herein, such as Figure 12 As shown, when the update flag is the first attribute value, the method for obtaining the traffic information strategy of the target thread disclosed herein includes the following steps:

[0090] In this embodiment of the disclosure, the target thread executes the method for obtaining the traffic information strategy of the target thread.

[0091] Step S1201: Determine whether the traffic information request is the first request processed by the target thread corresponding to the current update version. If yes, proceed to step S1202; otherwise, proceed to step S1204.

[0092] In this embodiment of the disclosure, since the marketer may initiate traffic information requests at any time, during the execution of the dynamic library update instruction, that is, during the loading of the traffic information strategy, each thread may receive multiple traffic information requests. The traffic information strategy only needs to be loaded once for the first traffic information request, and subsequent traffic information requests can be directly reused. Therefore, before obtaining the traffic information strategy, it is necessary to determine whether the traffic information request processed by the target thread is the first request after the dynamic library update instruction is issued.

[0093] Step S1202: Load the traffic information strategy corresponding to the currently updated version of the dynamic library.

[0094] In this embodiment of the disclosure, when the traffic information request is the first request processed by the target thread corresponding to the current updated version, the dynamic library is determined according to the soft link corresponding to the dynamic library update instruction, and the function of the dynamic library is executed to load the traffic information strategy corresponding to the current updated version of the dynamic library.

[0095] Furthermore, it should be noted that the loading of traffic information policies depends on the processing of traffic information requests by each thread. Each thread only has the motivation to load the dynamic library's traffic information policy in order to respond to a traffic information request. Therefore, to implement dynamic library updates, each thread needs to respond to traffic information requests and load the dynamic library's update instruction traffic information policy, such as... Figure 13 As shown, the method for loading traffic information policies disclosed herein includes the following steps:

[0096] In this embodiment of the disclosure, the method for loading the traffic information strategy is executed by each target thread.

[0097] Step S1301: Uninstall the previous version of the dynamic library.

[0098] In this embodiment, since each thread can only store one version of the traffic information policy corresponding to the requester's identifier, each thread needs to unload the previous version of the dynamic library before loading the current updated version to obtain the current updated traffic information policy and update the traffic information policy. Therefore, the target thread needs to unload the previous version of the dynamic library stored on it first. For example, if the previous version of the dynamic library is dynamic library A and the current updated version of the dynamic library is dynamic library B, the previous version of dynamic library A should be unloaded first.

[0099] Step S1302: After the unloading is completed, update the status identifier of the target thread's thread state from the first state to the third state.

[0100] In this embodiment, the thread state includes pending loading, loading, and loading completed, representing the dynamic library's traffic information strategy being in the pending loading, loading, and loading completed states, respectively. The thread state can be represented by a state identifier, the data type of which is an atomic integer to achieve variability in value. Specifically:

[0101] The status indicators for "Pending Load," "Loading," and "Loading Completed" are respectively the first state (represented by "2"), the second state (represented by "1"), and the third state (represented by "0"). The thread status indicator can switch between the first, second, and third states. Specifically, the event that triggers the status indicator to change from "2" to "0" is the completion of unloading the dynamic library; the event that triggers the status indicator to change from "0" to "1" is the completion of loading the dynamic library; and the event that triggers the status indicator to change from "1" to "2" is the issuance of a policy update command.

[0102] Furthermore, after the previous version of the dynamic library is unloaded from the target thread, the thread state flag of the target thread changes from "2" to "0", that is, from the first state to the third state. For example, if the target thread's thread ID is 2, and the update flag is "TRUE", the target thread will unload the previous version of the dynamic library A before loading the current updated version of the dynamic library B. Before unloading, the target thread's state flag is "2", such as... Figure 14 As shown; after uninstallation is complete, the target thread changes the status flag to "0", indicating that the previous version of dynamic library A was successfully uninstalled, as shown. Figure 15 As shown.

[0103] Step S1303: Increment the count value of the unloading counter and decrement the value of the soft chain counter.

[0104] In this embodiment of the disclosure, the uninstallation counter is used to count the number of threads that have uninstalled the previous version of the dynamic library. For example, if the thread ID of the target thread is 2, then... Figure 15 As shown, after the previous version of the dynamic library is uninstalled, the uninstallation counter increases from 2 to 3.

[0105] Furthermore, during the unloading process of the previous version of the dynamic library, the value of the symbolic link counter represents the remaining number of threads in the previous version of the dynamic library. For example, if the target thread's thread ID is 2, then... Figure 15 As shown, after the target thread is unloaded, the soft link counter decreases to 2.

[0106] Step S1304: Determine whether the count value of the unloading counter is equal to the total number of threads. If yes, proceed to step S1306; otherwise, proceed to step S1305.

[0107] Step S1305, continue waiting, proceed to step S1304.

[0108] In this embodiment of the disclosure, it should be noted that, since the process mechanism of the RTA service requires all threads to be in the same state before switching to the next thread state, each thread of the RTA service continuously checks whether the thread states of other threads are completely consistent with its own during the transition between the pending, loading, and loading completed states. Only when the thread states of other threads are completely consistent with its own will the next processing step continue. That is, during the execution of each thread, it will only change to the next thread state when it is determined that all thread states are consistent. The consistency of the thread states is determined by the count values ​​of the unload counter and the soft link counter.

[0109] Furthermore, if the count value of the unloading counter is not equal to the total number of threads, it indicates that other threads are still unloading. Therefore, we continue to wait for the unloading of other threads until the count value of the unloading counter reaches the total number of threads, that is, all threads have finished unloading the previous version of the dynamic library, before the current updated version of the traffic information strategy can be loaded.

[0110] Step S1306: Load the traffic information policy of the current update version according to the soft link corresponding to the dynamic library update instruction.

[0111] In this embodiment of the disclosure, the target thread determines the current updated version of the dynamic library based on the pointer of the symbolic link, and executes the function of the current updated version of the dynamic library to load the traffic information policy of the current updated version.

[0112] Furthermore, since the symbolic links point to the update paths of each dynamic library, the impact of changes in dynamic library names on policy updates can be isolated.

[0113] Step S1307: Determine whether the traffic information policy of the current updated version has been loaded. If yes, proceed to step S1309; otherwise, proceed to step S1308.

[0114] Step S1308, continue waiting, proceed to step S1307.

[0115] In this embodiment of the disclosure, the target thread continues to load traffic information policies even if the current updated version has not been fully loaded.

[0116] Step S1309: Update the thread state identifier of the target thread to the second state.

[0117] In this embodiment of the disclosure, when the current updated version of the traffic information policy has been loaded, the status identifier of the target thread's thread state is updated to the second state. For example, if the target thread's thread ID is 2, then... Figure 16 As shown, the status flag is updated to 1.

[0118] Step S1310: Increment the count value of the soft chain counter.

[0119] In this embodiment of the disclosure, during the loading process of the traffic information strategy of the currently updated version of the dynamic library, a soft link counter is used to count the number of threads that have loaded the currently updated version of the dynamic library. For example, if the thread ID of the target thread is 2, then... Figure 16 As shown, the count value of the soft chain counter is 1.

[0120] Step S1311: Determine whether the count value of the soft chain counter is equal to the total number of threads. If yes, proceed to step S1313; otherwise, proceed to step S1312.

[0121] Step S1312, continue waiting, proceed to step S1311.

[0122] In this embodiment of the disclosure, if the count value of the soft link counter is not equal to the total number of threads, it indicates that other threads are still loading and have not been completed. Therefore, we continue to wait for the loading of other threads until the current updated version of the traffic information strategy of all threads is loaded.

[0123] Step S1313: Determine that the traffic information policy of the current updated version has been loaded, and modify the attribute value of the update flag to the second attribute value.

[0124] In this embodiment, by changing the attribute value of the update flag, interference from other instructions before the dynamic library update instruction is completed is avoided, ensuring a smooth update of the dynamic library. Therefore, when the soft link counter equals the total number of threads, it indicates that the traffic information policy for the current update version has been loaded for all threads, the dynamic library update is complete, and the last thread to finish loading modifies the attribute value of the update flag to "FALSE," allowing the RTA service to continue issuing the next dynamic library update instruction. For example, as... Figure 17 As shown, the soft link counter value is equal to the total number of threads, which is 5, and the current updated version of the traffic information strategy has been loaded.

[0125] In this embodiment of the disclosure, or when the RTA service is first started, such as Figure 18As shown, since each thread does not need to unload the previous version of the traffic information policy, the initial values ​​of the update flag, unload counter, and soft link counter are empty, and steps S1301-S1305 do not need to be executed. That is, after receiving the traffic information request, the RTA service allocates a target thread for each traffic information request, so that the status flag of each target thread changes to 0. Starting from step S1306, the target thread directly loads the current updated version of the dynamic library A and obtains the current updated version of the traffic information policy. Accordingly, after loading is completed, the status flag of each target thread changes from 0 to 1, and the traffic information policy of the dynamic library A is loaded.

[0126] In this embodiment of the disclosure, the traffic information policy loading method can be used to directly call the function of the dynamic library to load the current updated version of the traffic information policy when the RTA service is first started, or the previous version of the dynamic library can be uninstalled first and then the current updated version of the dynamic library can be executed to load the current updated version of the traffic information policy during the operation of the RTA service. This can achieve dynamic updates of the traffic information policy, avoid restarting the RTA service, ensure the continuous and uninterrupted operation of the RTA service, and avoid the loss of request volume caused by restart.

[0127] Step S1203: Obtain the currently updated traffic information policy after loading.

[0128] In this embodiment of the disclosure, once the target thread is loaded, the traffic information policy of the current updated version can be obtained.

[0129] Step S1204: Wait for the target thread to complete the processing of the traffic information request.

[0130] In this embodiment of the disclosure, if the traffic information request is not the first request corresponding to the current updated version processed by the target thread, it indicates that the target thread has already responded to the previous traffic information request and is loading the traffic information policy of the current updated version. Therefore, it is sufficient to wait for the traffic information request that the target thread has already responded to to complete processing and directly obtain the traffic information policy corresponding to the traffic information request that has already been responded to.

[0131] Step S1205: Based on the requester identifier of the requesting end, find the current updated version of the traffic information policy of the target thread.

[0132] In this embodiment of the disclosure, when the dynamic library is updated, the requesting end that is allowed to use its traffic information policy can be specified. Therefore, the target thread may store multiple traffic information policies with multiple requesting end identifiers. Thus, the target thread can find the traffic information policy of the current updated version based on the requesting end identifier.

[0133] In this embodiment of the disclosure, the method for obtaining traffic information policies for the target thread determines whether to directly search based on the requester's identifier or to fully load the policy based on whether the thread is processing the first request of the current updated version. This improves the efficiency and smoothness of traffic information policy updates and returns, eliminates the need for development, design, communication, and retrieval costs, ensures uninterrupted and continuous RTA service, meets the requirement of obtaining policies without delay under high request traffic concurrency, and enhances the user experience for marketers.

[0134] In step S104, after all the status identifiers of the multiple threads have changed to the second state, in response to the traffic information request, the target thread returns the loaded traffic information policy to the requesting end.

[0135] In this embodiment of the disclosure, based on the consistency principle of each thread in the RTA service process, the target thread returns the loaded traffic information strategy to the requesting end after determining that all threads have been loaded—that is, the status flag of all threads has become 1—that is, the count value of the soft link counter is equal to the total number of threads.

[0136] In this embodiment of the disclosure, when the target thread determines that the update flag is a second attribute value in step S103, the strategy for the target thread to obtain the traffic information corresponding to the update flag includes:

[0137] Based on the requester identifier of the requesting end, the current updated version of the traffic information policy of the target thread is found.

[0138] In this embodiment of the disclosure, the traffic information policy update method utilizes the policy unit in the RTA service to update the traffic information policy according to the update flag, thereby preventing the retrieval cost and invocation cost of the traffic information policy and avoiding the restart of the RTA service. This enables policy updates to be performed under normal operation of the RTA service, ensuring successful policy updates unaffected by communication, retrieval, or restart, and reducing the coupling between the RTA service and the traffic information policy update.

[0139] In this embodiment of the disclosure, similar to dynamic library update instructions, the RTA service can only receive dynamic library version query requests if the soft link counter's count value equals the total number of threads, including:

[0140] Receive one or more query requests for dynamic library versions sent by the requesting end; wherein, the query request includes a requesting end identifier;

[0141] Based on the direction pointed to by the symbolic link, determine the most recent update path of the most recent dynamic library update instruction;

[0142] Determine the latest version identifier from the most recently updated path;

[0143] In response to the query request, the latest version identifier is returned to the requesting client.

[0144] In this embodiment of the disclosure, or similar to the dynamic library update instruction, only when the count value of the soft link counter is equal to the total number of threads, the RTA service can also receive query requests for thread health status.

[0145] Figure 19 This is a schematic diagram of the main modules of a traffic information policy update apparatus according to an embodiment of the present disclosure, such as... Figure 19 As shown, the traffic information policy updating device 1900 of this disclosure includes:

[0146] The receiving module 1901 is used to receive traffic information requests sent by one or more requesting ends.

[0147] The selection module 1902 is used to select a target thread from multiple threads for the traffic information request.

[0148] The loading module 1903 is used to determine whether the update flag is the first attribute value using the target thread. If the update flag is the first attribute value, the target thread obtains the traffic information strategy corresponding to the update flag and waits for the state change of other threads.

[0149] The response module 1904 is used to respond to the traffic information request after all the status flags of the multiple threads have changed to the second state, and the target thread returns the loaded traffic information policy to the requesting end.

[0150] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the electronic device to perform a method according to an embodiment of this disclosure.

[0151] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to embodiments of this disclosure.

[0152] Exemplary embodiments of this disclosure also provide a computer program product, including a computer program, wherein, when executed by a processor of a computer, the computer program is used to cause the computer to perform a method according to an embodiment of this disclosure.

[0153] refer to Figure 20The present invention describes a structural block diagram of an electronic device 2000 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0154] like Figure 20 As shown, the electronic device 2000 includes a computing unit 2001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 2002 or a computer program loaded from a storage unit 2008 into a random access memory (RAM) 2003. The RAM 2003 may also store various programs and data required for the operation of the device 2000. The computing unit 2001, ROM 2002, and RAM 2003 are interconnected via a bus 2004. An input / output (I / O) interface 2005 is also connected to the bus 2004.

[0155] Multiple components in electronic device 2000 are connected to I / O interface 2005, including: input unit 2006, output unit 2007, storage unit 2008, and communication unit 2009. Input unit 2006 can be any type of device capable of inputting information to electronic device 2000. Input unit 2006 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 2007 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 2004 may include, but is not limited to, disk and optical disk. Communication unit 2009 allows electronic device 2000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMa20 devices, cellular communication devices, and / or the like.

[0156] The computing unit 2001 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 2001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 2001 performs the various methods and processes described above. For example, in some embodiments, Figure 1 , Figure 7 , Figures 12 to 13 The method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 2008. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 2000 via ROM 2002 and / or communication unit 2009. In some embodiments, computing unit 2001 can be configured to execute by any other suitable means (e.g., by means of firmware). Figure 1 , Figure 7 , Figures 12 to 13 The method.

[0157] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0158] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0159] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0160] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0161] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0162] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

Claims

1. A method of updating a traffic information policy, characterized by, The updating method is applied to an RTA service, the RTA service comprises a plurality of threads and an updating flag, and the updating method comprises: receiving a traffic information request sent by one or more requestors; selecting a target thread for the traffic information request from the plurality of threads; judging, by the target thread, whether the updating flag is a first attribute value, in a case where the updating flag is the first attribute value, the target thread acquires a traffic information policy corresponding to the updating flag, and waits for state changes of other threads; until state identifiers of the plurality of threads all become second states, the target thread returns the loaded traffic information policy to the requestor in response to the traffic information request.

2. The update method according to claim 1, wherein The first attribute value of the updating flag is triggered by a dynamic library updating instruction issued by the RTA service, and the dynamic library updating instruction comprises a current updating version of a dynamic library; The target thread acquires the traffic information policy corresponding to the updating flag, comprising: The target thread judges whether the traffic information request is a first request corresponding to the current updating version and handled by the target thread, and in a case where the traffic information request is the first request, loads a traffic information policy corresponding to the dynamic library of the current updating version; The target thread acquires the loaded traffic information policy of the current updating version.

3. The updating method according to claim 2, characterized by, The target thread unloads the dynamic library of a previous version, updates the state identifier of the thread state of the target thread from the first state to a third state; The target thread increments a count value of an uninstallation counter and decrements a value of a soft chain counter; The target thread determines that the count value of the uninstallation counter is equal to a total thread number, and loads the traffic information policy of the current updating version according to a pointing of a soft link corresponding to the dynamic library updating instruction. Further comprising:

4. The update method of claim 3, wherein, The target thread updates the state identifier of the thread state of the target thread to the second state after the traffic information policy of the current updating version is loaded; The target thread increments the count value of the soft chain counter; The target thread waits until the count value of the soft chain counter is equal to the total thread number, determines that the traffic information policy of the current updating version of all threads is loaded, and modifies the attribute value of the updating flag to a second attribute value. In a case where the traffic information request is not the first request, further comprising:

5. The updating method according to claim 2, wherein waiting for a traffic information request processing of the target thread to be completed; finding the traffic information policy of the current updating version of the target thread according to a requestor identifier of the requestor. Further comprising:

6. The update method of claim 4, wherein, judging whether the count value of the soft chain counter is equal to the total thread number, and in a case where the count value of the soft chain counter is equal to the total thread number, responding to an updating message of the dynamic library; wherein the updating message comprises an updating path of the dynamic library; generating a dynamic library updating instruction of the dynamic library according to the updating path. Further comprising:

7. The update method of claim 6, wherein, The target thread judges whether the attribute value of the updating flag is changed to the second attribute value; ​ In a case where the attribute value of the update flag is changed to the second attribute value, the dynamic library update instruction is issued, and the pointing of the soft link is modified to the update path; The thread states of the plurality of threads are unified to a first state, the update flag is modified to a first attribute value, and the offloading counter is reset to zero.

8. An apparatus for updating a traffic information policy, characterized by comprising: The updating device is applied to an RTA service, the RTA service includes a plurality of threads and an update flag, and the updating device includes: A receiving module configured to receive a traffic information request sent by one or more requestors; A selecting module configured to select a target thread for the traffic information request from the plurality of threads; A loading module configured to determine, by the target thread, whether the update flag is the first attribute value, in a case where the update flag is the first attribute value, the target thread acquires a traffic information strategy corresponding to the update flag, and waits for state changes of other threads; A responding module configured to, until the state identifiers of the plurality of threads all become second states, respond to the traffic information request, and return the loaded traffic information strategy to the requestor by the target thread.

9. An electronic device comprising: a processor; and a memory storing a program, wherein the program includes instructions that, when executed by the processor, cause the processor to perform the traffic information strategy updating method according to any one of claims 1-7. The computer instructions are used to cause the computer to perform the traffic information strategy updating method according to any one of claims 1-7.

10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, ​

Citation Information

Patent Citations

  • Method for updating logging-on state of network camera and device thereof

    CN104065626A

  • Efficient marking of shared cache lines

    US20080140935A1