Method for client to query user characteristics in real time
Patent Information
- Application Number
- CN202210645091.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-06-08
AI Technical Summary
[0004](1)存储空间浪费:每种用户特征均需要存进数据库,例如,对于以下三个用户特征,某用户7天内下载游戏的记录、某用户最后一次下载游戏的时间、某7天内下载的游戏数量,均需要存进数据库,占用较多的存储空间;(2)每次新增用户特征,均需要重新开发,效率低下、周期长
[0019] (1) Effectively reduce storage space usage.
Smart Images

Figure CN114911802B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer information processing, and in particular relates to a method for a client to query user characteristics in real time. Background Art
[0002] When machine learning predicts user preferences, it needs to first query user features. The traditional process of client querying user features is: 1) store each user feature in the database; 2) the server reads the data in the database and queries the user features.
[0003] The above method has the following problems:
[0004] (1) Waste of storage space: Each user feature needs to be stored in the database. For example, the following three user features, the record of a user downloading games within 7 days, the time when a user last downloaded a game, and the number of games downloaded within 7 days, all need to be stored in the database, which takes up a lot of storage space; (2) Each time a new user feature is added, it needs to be redeveloped, which is inefficient and takes a long time. Summary of the invention
[0005] In view of the defects in the prior art, the present invention provides a method for a client to query user characteristics in real time, which can effectively solve the above problems.
[0006] The technical solution adopted by the present invention is as follows:
[0007] The present invention provides a method for a client to query user characteristics in real time, comprising the following steps:
[0008] Step 1, create an event base table event_detail_base and a real-time feature table realtime_feature; the event base table event_detail_base is used to store the description information of each user behavior event event to be processed;
[0009] The real-time feature table realtime_feature is used to store multiple user feature statistical models model;
[0010] Step 2: collect user behavior data. Each piece of collected user behavior data is called a user behavior event. The collected user behavior event event is stored in a message queue in the hard disk.
[0011] Step 3, start the flink task, use the flink consumer component to read the user behavior event event in the message queue, and parse and filter the read user behavior event event according to the event base table event_detail_base, obtain multiple user behavior event events that meet the event base table event_detail_base, and save them to the redis real-time feature data source;
[0012] Whenever the event base table event_detail_base changes, or the message queue changes, the flink task is started, thereby ensuring the timeliness of the redis real-time feature data source;
[0013] Step 4: the feature service module periodically starts a Groovy task thread, the Groovy task thread reads the real-time feature table realtime_feature, and dynamically generates a Groovy instance object for each user feature statistical model model in the real-time feature table realtime_feature according to a script template file;
[0014] Step 5: Whenever the feature service interface receives a query request for querying user features from the caller, the query request carries a user feature query keyword, and the feature service interface reads the redis real-time feature data source to obtain multiple user behavior events that match the user feature query keyword; at the same time, the Groovy instance object that matches the user feature query keyword is called, and the multiple user behavior events that are queried are sent to the calling Groovy instance object;
[0015] The called Groovy instance object performs statistical analysis on the received multiple user behavior events, obtains the user feature analysis results, and returns the user feature analysis results to the caller.
[0016] Preferably, the message queue is a Kafka message queue.
[0017] Preferably, the redis real-time feature data source is stored in a cache.
[0018] The method for real-time query of user characteristics by a client provided by the present invention has the following advantages:
[0019] (1) Effectively reduce storage space usage.
[0020] (2) When the user features of the query change, only the real-time feature table realtime_feature and the event base table event_detail_base need to be updated. There is no need to redevelop the entire query program, which improves efficiency and reduces development costs and cycles. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic flow chart of a method for real-time query of user characteristics by a client provided by the present invention. DETAILED DESCRIPTION
[0022] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0023] The present invention provides a method for real-time query of user characteristics by a client, which is a method for real-time query of user characteristics by a client that reduces storage space occupation and avoids repeated coding. Figure 1 , including the following steps:
[0024] Step 1, create an event base table event_detail_base and a real-time feature table realtime_feature; the event base table event_detail_base is used to store the description information of each user behavior event event to be processed;
[0025] The real-time feature table realtime_feature is used to store multiple user feature statistical models model;
[0026] For example, a user behavior event event, whose description information is: game download events in the past month, includes the following fields: game ID of the downloaded game, time of game download, and user ID of the downloaded game. Or, a user behavior event event, whose description information is: app launch event, includes the following fields: user ID of the app launch, game ID, and time of app launch.
[0027] The user feature statistical model model is used to perform statistical analysis on the acquired user behavior events event to obtain user feature results that reflect user preferences. Since there are different statistical analysis algorithms for different statistical requirements, a corresponding user feature statistical model model is generated for each algorithm. For example, when it is necessary to count the number of game downloads in 3 days and the number of game downloads in 7 days, a user feature statistical model model for the number of game downloads in 3 days and a user feature statistical model model for the number of game downloads in 7 days are generated respectively.
[0028] When statistics of other user features are needed, it is only necessary to simply update the real-time feature table realtime_feature and generate the corresponding user feature statistical model model. No other content needs to be changed.
[0029] Step 2: collect user behavior data, each piece of collected user behavior data is called a user behavior event; store the collected user behavior event event in a message queue on the hard disk; wherein the message queue may be a Kafka message queue.
[0030] Step 3, start the flink task, use the flink consumer component, read the user behavior event event in the message queue, and parse and filter the read user behavior event event according to the event base table event_detail_base, obtain multiple user behavior event events that meet the event base table event_detail_base, and save them to the redis real-time feature data source; wherein, to ensure the reading and writing speed, the redis real-time feature data source is stored in the cache.
[0031] For example, the description information of the user behavior event event in the event base table event_detail_base is: the game download event in the past month, including the following fields: the game ID of the downloaded game, the time of downloading the game, and the user ID of the downloaded game. However, among the user behavior events event in the message queue, there are user behavior events with empty game ID, which do not meet the requirements of the event base table event_detail_base and are directly deleted. Alternatively, if the user behavior event event in the message queue is not a game download event, but other events, it is directly deleted.
[0032] Whenever the event base table event_detail_base changes, or the message queue changes, the flink task is started, thereby ensuring the timeliness of the redis real-time feature data source;
[0033] Step 4: the feature service module periodically starts a Groovy task thread, the Groovy task thread reads the real-time feature table realtime_feature, and dynamically generates a Groovy instance object for each user feature statistical model model in the real-time feature table realtime_feature according to a script template file;
[0034] Step 5: Whenever the feature service interface receives a query request for querying user features from the caller, the query request carries a user feature query keyword, and the feature service interface reads the redis real-time feature data source to obtain multiple user behavior events that match the user feature query keyword; at the same time, the Groovy instance object that matches the user feature query keyword is called, and the multiple user behavior events that are queried are sent to the calling Groovy instance object;
[0035] The called Groovy instance object performs statistical analysis on the received multiple user behavior events, obtains the user feature analysis results, and returns the user feature analysis results to the caller.
[0036] It can be seen that the present invention provides a method for a client to query user characteristics in real time, which has the following characteristics:
[0037] (1) You only need to store the collected user behavior events through the message queue, and then filter the message queue and store the user behavior events that meet specific requirements through the redis real-time feature data source; in the subsequent process, according to the user feature query requirements, directly call the Groovy instance object to generate and return the user feature analysis results. In the whole process, there is no need to store the user feature analysis results, only the message queue and the redis real-time feature data source need to be used to store the user behavior event events, thereby effectively reducing the storage space occupied.
[0038] (2) When the user features of the query change, only the real-time feature table realtime_feature and the event base table event_detail_base need to be updated. There is no need to redevelop the entire query program, which improves efficiency and reduces development costs and cycles.
[0039] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.
Claims
1. A method for a client to query user characteristics in real time, characterized in that: The following steps are involved: Step 1, create an event base table event_detail_base and a real-time feature table realtime_feature; the event base table event_detail_base is used to store the description information of each user behavior event event to be processed; The real-time feature table realtime_feature is used to store multiple user feature statistical models model; Step 2: collect user behavior data. Each piece of collected user behavior data is called a user behavior event. The collected user behavior event event is stored in a message queue in the hard disk. Step 3, start the flink task, use the flink consumer component to read the user behavior event event in the message queue, and parse and filter the read user behavior event event according to the event base table event_detail_base, obtain multiple user behavior event events that meet the event base table event_detail_base, and save them to the redis real-time feature data source; Whenever the event base table event_detail_base changes, or the message queue changes, the flink task is started, thereby ensuring the timeliness of the redis real-time feature data source; Step 4: the feature service module periodically starts a Groovy task thread, the Groovy task thread reads the real-time feature table realtime_feature, and dynamically generates a Groovy instance object for each user feature statistical model model in the real-time feature table realtime_feature according to a script template file; Step 5: Whenever the feature service interface receives a query request for querying user features from the caller, the query request carries a user feature query keyword, and the feature service interface reads the redis real-time feature data source to obtain multiple user behavior events that match the user feature query keyword; at the same time, the Groovy instance object that matches the user feature query keyword is called, and the multiple user behavior events that are queried are sent to the calling Groovy instance object; The called Groovy instance object performs statistical analysis on the received multiple user behavior events, obtains the user feature analysis results, and returns the user feature analysis results to the caller.
2. The method for real-time query of user characteristics by a client according to claim 1, characterized in that: The message queue is a kafka message queue.
3. The method for real-time query of user characteristics by a client according to claim 1, characterized in that: The redis real-time feature data source is stored in the cache.
