A horizontally scalable client system

By designing a horizontally expanded client system using data buffering technology and underlying data persistence solutions, the problem of performance requirements of client systems in the futures and options market is solved, high throughput, capacity and low latency performance improvements are achieved, and client scalability is protected.

CN113064580BActive Publication Date: 2025-02-28SHANGHAI FINANCIAL FUTURES INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110335034.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-29
Publication Date
2025-02-28
Estimated Expiration
2041-03-29

AI Technical Summary

Technical Problem

The existing technology is difficult to meet the performance requirements of client systems for inactive trading varieties in the futures and options market, including high throughput, capacity, and low latency while achieving horizontal client expansion.

Method used

A horizontally scalable client system is designed, using data buffering technology and underlying data persistence scheme, and the data storage, management and display are realized through the combination of access modules, cache modules, service modules and display modules, and the performance and scalability of the system are improved through multi-threaded processing and publishing and subscription modes.

Benefits of technology

It realizes horizontal expansion of the client system, improves the system's performance, and can maintain stable operation under high throughput, capacity and low latency conditions, protecting the scalability of the client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113064580B_ABST
    Figure CN113064580B_ABST
Patent Text Reader

Abstract

The present invention discloses a horizontally expanded client system, which can not only meet the requirements of horizontal expansion of the client, but also improve the performance of the client. Its technical solution is as follows: the system includes: an access module, which is used to receive data pushed by the server and process it into a data format for internal communication of the client system; a cache module, which is used to store and manage data from the access module; a service module, which is used to package the data uploaded by the cache module so that the display module can directly display the data without further processing; and a display module, which is used to receive the packaged data from the service module and display the corresponding interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a design of a client system architecture, and in particular to a horizontally scalable client system implemented in C#. Background Art

[0002] In the futures and options market, exchanges usually implement a market maker system for inactive products. The market maker system has the characteristics of large order volume, fast order withdrawal, large number of market display contracts, etc., and the restart of the client must be quickly restored. The client needs to meet the requirements of horizontal expansion, and the better the client's machine performance, the better the client performance.

[0003] In actual production, the client needs to meet the following performance requirements:

[0004] 1. Throughput

[0005] The definition of throughput here is the maximum number of data records that the client can process per second when receiving data pushed by the middle platform while meeting the minimum latency requirement. In the design goal, a message contains only one data record. If the middle platform merges and pushes messages, the actual throughput will be higher than the design goal. The design goal of throughput is 50,000 records per second.

[0006] The following table lists the maximum processing capabilities for the following message categories in total.

[0007]

[0008] 2. Capacity

[0009] The capacity is measured in four dimensions: trading volume, number of unilateral orders, number of contracts, and number of market transactions per second. Changes in trading volume will directly lead to changes in a series of data such as positions, portfolio positions, portfolio risk value, portfolio profit and loss, and our own market conditions.

[0010] The number of unilateral orders includes ordinary unilateral orders (order) and two orders derived from quotations (quote), which directly affect the market conditions of this party. The client has the need to query order data. The increase in unilateral order data will increase the performance consumption of querying order data, and it is also likely to increase the client's memory overhead.

[0011] The number of contracts is related to the interface display capabilities, such as T-charts, combined queries, etc. Too many contracts at the same refresh frequency will cause the interface to freeze. At the same market frequency, the number of contracts is proportional to the number of market messages.

[0012] The market changes of the benchmark contract will affect the increase in the amount of derivative market data, derivative IV and other data.

[0013] Metrics Dimensions Metrics Volume 200,000 transactions per day Number of unilateral orders 20 million transactions per day Contract quantity 3000 Number of market transactions per second 3000 records

[0014] 3. Delay

[0015] Different data has different requirements for latency, and different latency requirements are set according to the importance and volume of the data. As shown in the following table, the data with the highest latency requirement, such as market conditions, has a maximum latency of 50ms. This maximum latency is the design target when the throughput and capacity reach the maximum design value.

[0016] Data Type Maximum delay (ms) Market Conditions 50 Derivatives, derivatives iv 100 Order and quotation 1000 Transactions, positions, and combined positions 50 Portfolio risk value, portfolio profit and loss 200 Configuration data, such as combinations and contract parameters 50

[0017] Currently, the industry is in urgent need of a client architecture design that meets the above requirements. Summary of the invention

[0018] A brief summary of one or more aspects is given below to provide a basic understanding of these aspects. This summary is not an exhaustive overview of all conceived aspects, and is neither intended to identify the key or critical elements of all aspects nor to define the scope of any or all aspects. Its only purpose is to give some concepts of one or more aspects in a simplified form as a prelude to a more detailed description that will be given later.

[0019] The purpose of the present invention is to solve the above problems and provide a horizontally scalable client system that can not only meet the requirements of horizontal expansion of the client, but also improve the performance of the client.

[0020] The technical solution of the present invention is: the present invention discloses a horizontally expanded client system, the system comprising:

[0021] The access module is used to receive the data pushed by the server and process it into the data format for internal communication of the client system;

[0022] A cache module, used for storing and managing data from the access module;

[0023] The service module is used to package the data uploaded by the cache module so that the display module can directly display the data without further processing;

[0024] The display module is used to receive the packaged data from the service module and display the corresponding interface.

[0025] According to an embodiment of the horizontally expanded client system of the present invention, the cache module is configured to change the data refresh mode of the notification mode: after the data changes, a notification is sent to the service module, and then the service module notifies the interface to refresh.

[0026] According to an embodiment of the horizontally expanded client system of the present invention, the cache module is further configured to trigger the callback function of the service module by the cache module after the data changes, and then send the message of the data change to the interface of the display module through the publish-subscribe mode implemented by the service module publish-subscribe service. After the interface receives the notification of the message, the interface decides whether to obtain the data from the service module.

[0027] According to an embodiment of the horizontally expanded client system of the present invention, data is transmitted from the storage module in the cache module to the business service in the service module, and the presentation module obtains the data to be presented from the business service in the service module through the subscription service.

[0028] According to an embodiment of the horizontally expanded client system of the present invention, the client system operates on data through multiple threads, including:

[0029] Data receiving thread, used to receive data and put it into the queue;

[0030] The data processing thread is used to take data from the queue and process the data accordingly, including unpacking and generating corresponding data model objects, and store them in the cache module;

[0031] The cache event-driven thread is used to perform event checking tasks, determine whether to generate change notifications, and send change notifications to the user interface, which determines whether to make service calls;

[0032] The interface thread refreshes the interface when data changes are detected.

[0033] According to an embodiment of the horizontally expanded client system of the present invention, the table in the data model includes a basic table, a transition table and a condition trigger table, wherein:

[0034] Basic table: data is stored in memory through the basic table. After the access layer receives the data, the basic table converts the character data into the corresponding entity class and stores it in the queue.

[0035] The transition table does not store any data itself, but only passes the data to the downstream for processing, including: passing the data to the persistence module in the cache module to store it on the hard disk, or passing the data to the service layer for direct processing for data that requires specialized processing;.

[0036] The conditional trigger table is a combination of the basic table and the transition table. It not only stores the data in the memory, but also processes the data in a specialized way.

[0037] According to one embodiment of the horizontally scalable client system of the present invention, the cache module implements the change notification mode through triggers, wherein the relationship between the triggers and the tables is managed by the table manager, and the triggers include ordinary triggers and conditional triggers, wherein the ordinary triggers are associated with the base table and the conditional trigger table; the conditional triggers are only associated with the conditional triggers.

[0038] According to one embodiment of the horizontally expanded client system of the present invention, the communication protocols between the server and the client system are the websocket protocol and the http protocol, wherein the websocket protocol is used for the server to actively push data to the client system, and the http protocol is used for the client system to actively request data from the server.

[0039] Compared with the prior art, the present invention has the following beneficial effects: the client system of the present invention realizes horizontal scalability of the architecture through data buffering technology and the characteristics of underlying data persistence.

[0040] Specifically, data buffering technology means that when the client receives a large amount of data instantly, it does not directly refresh the display on the interface. Refreshing the interface will consume a lot of operating system resources. Instead, when data arrives, the data is first inserted into the cache, and the internal event loop mechanism of the cache drives the refresh of the interface, thereby controlling the refresh frequency of the interface within a range. The system can receive tens of thousands of quotes per second, and the refresh frequency of the interface cannot reach tens of thousands per second anyway. The traditional solution is to use polling technology. The disadvantage is that data will be obtained for refresh when no data arrives, wasting system resources. For example, if an event detection is set every 50 milliseconds in the cache, that is, 20 event checks are performed per second. If the data has not changed, it will not be refreshed. If the data has changed, the interface will be notified to refresh. A maximum of 20 refreshes can be performed within 1 second, protecting the scalability of the client.

[0041] The persistence of underlying data solves the problem of increased memory usage and inability to scale horizontally due to the increase in data volume. Some scalable data (such as orders, quotes, transactions, and inquiries) are stored on the hard disk, so that the memory occupied by the client is kept within a certain range. When accessing, data with high access frequency (such as orders in a confirmed state) is stored in the memory, while data with low access frequency (such as orders in a canceled state) is stored on the hard disk, minimizing the loss of access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The above features and advantages of the present invention can be better understood after reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings. In the drawings, the components are not necessarily drawn to scale, and components with similar related properties or features may have the same or similar reference numerals.

[0043] Figure 1 A schematic diagram showing a layered design of an embodiment of a horizontally scalable client system of the present invention is shown.

[0044] Figure 2 A schematic diagram of the architecture of an embodiment of a horizontally scalable client system of the present invention is shown.

[0045] Figure 3 A data flow diagram of an embodiment of a horizontally expanded client system of the present invention is shown.

[0046] Figure 4 A schematic diagram showing a thread model of an embodiment of a horizontally scalable client system of the present invention. DETAILED DESCRIPTION

[0047] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. Note that the aspects described below in conjunction with the accompanying drawings and specific embodiments are only exemplary and should not be construed as limiting the scope of protection of the present invention in any way.

[0048] Figure 1 A schematic diagram showing a hierarchical design of an embodiment of a horizontally scalable client system of the present invention. Figure 1 The client system of this embodiment includes four layers: user interface layer, service layer, cache layer and data access layer. The user interface layer is the client interface part, which is used for data display and parameter setting interface. The service layer is used to provide the data required by the user interface layer. The cache layer is used to store data and provide a trigger mechanism. The service layer subscribes to the data of interest to the cache layer and provides the data required by the service layer. The data access layer subscribes to and receives the market, transaction and other business data provided by the middle platform. After processing the data, it calls back the processing function registered in the cache layer, and provides persistent storage for data traceability and inversion.

[0049] Figure 2 The structure of an embodiment of the horizontally expanded client system of the present invention is shown. Figure 2 The client system of this embodiment accesses the server through websocket and http protocols, so as to be extended to the client to use web pages, and can be divided into multiple processes to coordinate work.

[0050] Figure 2 The display module, service module, cache module and access module in the client are respectively Figure 1 The user interface layer, service layer, cache layer and data access layer shown in the figure correspond to each other. Figure 2 The architecture modules shown are Figure 1 The specific implementation of the layered design pattern shown in Figure 1 Shown is an abstract expression of the design pattern. Figure 2 The arrows in the figure indicate the direction of data flow. The communication protocols from the server to the client are the websocket protocol and the http protocol. The websocket protocol is used for the server to actively push data to the client, while the http protocol is used for the client to actively request data from the server.

[0051] The access module is used to receive data pushed by the server and process it into the data format for internal communication of the client.

[0052] The cache module is used for data storage and management. The data comes from the access module. The cache module is an important component of the present invention. Its core is the change notification mode, that is, the trigger management module therein. It only sends notifications to the service module when the data changes, and then the service module notifies the interface to refresh. Data is transmitted from the storage module to the business service, and the display module obtains the specific data to be displayed from the business service.

[0053] The service module is a wrapper for the data uploaded by the cache module, so that the display module can directly display the data without further processing. The service module transmits the changes of the underlying data to the interface in the display module through the subscription service. The HTTP forwarding in the service module is to forward the HTTP request of the interface directly to the server.

[0054] The display module is used to display specific interfaces, such as T-chart, query, strategy and other interfaces.

[0055] Figure 3 The data flow method of an embodiment of the horizontally expanded client system of the present invention is shown, that is, the entire process from the client receiving data to the data refreshing.

[0056] After receiving the data, the client system puts it into the queue in the access module, then unpacks the data and generates data model objects in turn. The processed data is stored in the cache module. Figure 3 The "notification" shown is that after the data changes, the cache module triggers the callback function of the service module, and then sends the message of the data change to the interface of the display module through the publish-subscribe mode implemented by the service module publish-subscribe service. The interface receives the message, that is, receives the notification. After the interface receives the notification, it decides whether to obtain data from the service module. The data in the present invention is bound to the interface, and the interface will refresh the display when the data changes.

[0057] from Figure 3 As can be seen from the figure, the client system of the present invention uses the change notification mode, that is, the data is not directly pushed to the interface, which can prevent the impact of instantaneous data.

[0058] Figure 4The thread model of an embodiment of the horizontally expanded client system of the present invention is shown. Multiple threads will operate on data, and each thread will perform its own task, such as data reception and data processing. The data receiving thread and the data processing thread communicate using queues, and after receiving the data, they are put into the queue and wait for the data processing thread to retrieve and process it. The cache event-driven thread performs the event checking task to determine whether to generate an event notification. The change event is notified to the user interface layer, and the user interface determines whether to make a service call (such as a query service). The interface thread refreshes the interface when it detects that the data has changed.

[0059] from Figure 4 As can be seen, the thread model is clear and controllable, and the cache event driver is an event-driven thread that does not perform blocking IO.

[0060] The data model is the core design of software development. The data model design in the present invention is described below. The received data is processed into the corresponding data model in the access module and stored in the cache module. The data used by the display module and the service module are all within the scope of the data model.

[0061] The horizontally expanded client system of this embodiment stores data in memory through the basic table. After the access layer receives the data, the basic table converts the character data into the corresponding entity class and stores it in the queue. Data with small data volume is stored in the basic table, such as contract data. The basic table can only be associated with ordinary triggers, and the notification mechanism of the trigger will be activated as long as there is a change in the table.

[0062] The transition table itself does not store any data. It only passes the data to the downstream for processing. For example, the data is passed to the persistence module in the cache module to store on the hard disk, or the data is passed to the service layer for direct processing for some data that requires specialized processing. Data with large amounts of data, such as order data, will be defined as a transition table, and the actual data will be stored in the conditional trigger with storage described below. In addition, data such as policy logs, which have large amounts of data, are not stored in memory, but in business services, storing the latest specified amount of data, which can reduce memory consumption while meeting business needs.

[0063] The meaning of the conditional trigger table is a combination of the basic table and the transition table. It not only stores the data in memory, but also processes the data in a specialized way, so that it can determine whether the corresponding conditions are met. Only when the conditions are met can the trigger notification mechanism be activated. This solution is suitable for data with high access frequency, high data update frequency, large data volume, and low latency, such as market data, which can subscribe to market data information of certain contracts.

[0064] The client system of the present invention uses a table manager TableManager to create table instances, provide an update data interface, provide an additional trigger interface, obtain table objects, access data, drive data notification events, and the like.

[0065] In addition, the client system of the present invention provides a notification mechanism for data table data changes through triggers, which is determined by judging the update time of the table data, so whether it is added, deleted or updated, it will be notified. Ordinary triggers can only obtain the latest data by accessing the entire table data, and the granularity is relatively coarse.

[0066] Triggers are associated with data tables, and the relationship between triggers and tables is managed by the table manager TableManager. Ordinary triggers can be associated with base tables and conditional trigger tables, because the table itself stores data and can be accessed directly.

[0067] Conditional triggers are used to notify data changes in conditional trigger tables. Only when the defined conditions are met will the notification be triggered. Conditional definitions only need to implement a specific ICondition interface, which has only one method:

[0068] FitResult Fit <t>(T t)

[0069] Where T is the entity class type, FitResult is the return value enumeration, which contains the following definition:

[0070]

[0071]

[0072] In the above definition, both AddOrUpdate and TryDelete will perform change notifications.

[0073] Conditional triggers can only be associated with conditional trigger tables, because once triggered, the data in the conditional trigger table has been updated and can be accessed directly.

[0074] Conditional triggers with storage are used for data notifications of transition tables. Data is stored in the trigger. The typical implementation is to define a table with a large amount of data as a transition table, and then store the data persistently in this type of conditional trigger. The corresponding conditional index is built in memory, and the data is accessed based on the index. This type of conditional trigger with storage is used to trigger notifications for data with low access frequency and general latency requirements. Storage usually uses LevelDB for efficient read and write access.

[0075] For large amounts of data, there is a need for paging query. Traditional paging query uses the user to click to initiate a request or poll to update the data. However, the client of the present invention does not want to waste system resources, so a paging index is designed. The paging index is applied to the conditional trigger with storage. When the conditional trigger updates data, the paging index is constructed according to the conditional information.

[0076] Pagination index can only be paginated according to a specific data sorting method, and does not support switching of data sorting methods. Generate sequence values ​​based on data, update index data information based on sequence values ​​and primary key keys, maintain a sorted sequence, and obtain the corresponding primary key set according to pagination information. Data can be accessed from the stored data based on the primary key set. Pagination index is the core technology that supports fast large data volume queries on the client side.

[0077] Although the above methods are illustrated and described as a series of actions for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the actions, because according to one or more embodiments, some actions may occur in a different order and / or concurrently with other actions from those illustrated and described herein or not illustrated and described herein but understandable to those skilled in the art.

[0078] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. The technician may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.

[0079] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in cooperation with a DSP core, or any other such configuration.

[0080] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, a storage medium may be integrated into a processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and the storage medium may reside in a user terminal as discrete components.

[0081] In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented as a computer program product in software, each function may be stored on or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include both computer storage media and communication media, including any medium that facilitates the transfer of a computer program from one place to another. Storage media may be any available medium that can be accessed by a computer. As an example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer. Any connection is also properly referred to as a computer-readable medium. For example, if the software is transmitted from a website, a server, or other remote source using a coaxial cable, a fiber optic cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wherein disk often reproduces data magnetically, while disc reproduces data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0082] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.< / t>

Claims

1. A horizontally scalable client system, characterized in that: The system includes: The access module is used to receive the data pushed by the server and process it into the data format for internal communication of the client system; A cache module, used for storing and managing data from the access module; The service module is used to package the data uploaded by the cache module so that the display module can directly display the data without further processing; The display module is used to receive the packaged data from the service module and display the corresponding interface; The client system operates on data through multiple threads, including: Data receiving thread, used to receive data and put it into the queue; The data processing thread is used to take data from the queue and process the data accordingly, including unpacking and generating corresponding data model objects, and store them in the cache module; The cache event-driven thread is used to perform event checking tasks, determine whether to generate change notifications, and send change notifications to the user interface, which determines whether to make service calls; The interface thread refreshes the interface when it detects changes in data; The tables in the data model include basic tables, transition tables, and conditional trigger tables, among which: Basic table, through which data is stored in memory. After the access module receives the data, the basic table converts the character data into the corresponding entity class and stores it in the queue; The transition table does not store any data itself, but only passes the data to the downstream for processing, including: passing the data to the persistence module in the cache module to store it on the hard disk, or passing the data to the service module for direct processing for data that requires specialized processing; The conditional trigger table is a combination of the basic table and the transition table. It not only stores data in memory, but also processes data in a specialized way. Among them, specialized processing includes defining the order data as a transition table and storing the actual data in a conditional trigger with storage.

2. The horizontally scalable client system according to claim 1, characterized in that: The cache module is configured as a data refresh method in change notification mode: a notification is sent to the service module after the data changes, and the service module then notifies the interface to refresh.

3. The horizontally scalable client system according to claim 2, characterized in that: The cache module is further configured to trigger the callback function of the service module after the data changes, and then send the message of the data change to the interface of the display module through the publish-subscribe model implemented by the service module publish-subscribe service. After the interface receives the notification of the message, it decides whether to obtain the data from the service module.

4. The horizontally scalable client system according to claim 1, characterized in that: The data is transmitted from the storage module in the cache module to the business service in the service module, and the display module obtains the data to be displayed from the business service in the service module through the subscription service.

5. The horizontally scalable client system according to claim 1, characterized in that: The cache module implements the change notification mode through triggers, where the relationship between triggers and tables is managed by the table manager. Triggers include common triggers and conditional triggers, where common triggers are associated with base tables and conditional trigger tables. Condition triggers are only associated with condition triggers.

6. The horizontally scalable client system according to claim 1, characterized in that: The communication protocols between the server and the client system are the websocket protocol and the http protocol, where the websocket protocol is used for the server to actively push data to the client system, and the http protocol is used for the client system to actively request data from the server.

Citation Information

Patent Citations

  • Information processing device

    CN105847405A