WO2018166297A1 - 一种缓存分配方法,及设备 - Google Patents

一种缓存分配方法,及设备 Download PDF

Info

Publication number
WO2018166297A1
WO2018166297A1 PCT/CN2018/073851 CN2018073851W WO2018166297A1 WO 2018166297 A1 WO2018166297 A1 WO 2018166297A1 CN 2018073851 W CN2018073851 W CN 2018073851W WO 2018166297 A1 WO2018166297 A1 WO 2018166297A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
tenant
amount
partition
target
Prior art date
Application number
PCT/CN2018/073851
Other languages
English (en)
French (fr)
Inventor
赵清伟
顾翀
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2018166297A1 publication Critical patent/WO2018166297A1/zh
Priority to US16/566,431 priority Critical patent/US20200012602A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/084Multiuser, multiprocessor or multiprocessing cache systems with a shared cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0842Multiuser, multiprocessor or multiprocessing cache systems for multiprocessing or multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0844Multiple simultaneous or quasi-simultaneous cache accessing
    • G06F12/0846Cache with multiple tag or data arrays being simultaneously accessible
    • G06F12/0848Partitioned cache, e.g. separate instruction and operand caches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0871Allocation or management of cache space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0893Caches characterised by their organisation or structure
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0893Caches characterised by their organisation or structure
    • G06F12/0895Caches characterised by their organisation or structure of parts of caches, e.g. directory or tag array
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • G06F2212/1021Hit rate improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/60Details of cache memory
    • G06F2212/604Details relating to cache allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/60Details of cache memory
    • G06F2212/6042Allocation of cache space to multiple users or processors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a cache allocation method, and a device.
  • Cache is a buffer for data exchange. In the case of data read requirements, the required data will be queried first from the cache. If the query is reached, it can be directly executed. If the query is not available, it can be found from the memory. If you do not query in memory, you will be queried on the hard disk or other larger storage devices. Therefore, the cache runs fastest, much faster than the memory, so the role of the cache is to speed up the device.
  • each tenant can be allocated more limited cache resources.
  • a tenant in SaaS can contain multiple users. For example, a tenant can be a business and a user is an employee within the enterprise.
  • SaaS on-demand leasing model has been rapidly developed in the field of cloud computing.
  • SaaS provides software leasing services for multiple enterprise customers with multi-tenant technology architecture, enabling a large number of tenants/companies to share the same stack.
  • the goal of the multi-tenant sharing architecture is to achieve resource multi-tenant sharing, reasonable isolation between multi-tenants, and maximum resource revenue.
  • Cache is an important and limited resource for improving system performance. Traditional cache usage does not distinguish tenants. Under the architecture of multi-tenant sharing competition using cache resources, the following problems are caused:
  • SLA Service Level Agreement
  • the dynamic cache partitioning (DCP) technology is used to isolate and allocate the cache of each application, and the specific implementation of the cache isolation and allocation is: allocate a cache for each target application. Minimum value, target value, and maximum value; the target application is cached to a minimum value at startup, and the cache requirement will be larger and larger during the running of the target application. After the cache allocated to the target application reaches the target value, it continues to increase. According to certain rules, a part of the cache of other applications is allocated to the target application, and when the cache of the target application reaches the maximum value, the cache is no longer newly allocated to the target application.
  • DCP dynamic cache partitioning
  • the technical problem to be solved by the embodiments of the present application is to provide a cache allocation method and a device for improving cache sharing utilization.
  • the embodiment of the present application provides a cache allocation method, which is applicable to a software-as-a-service SaaS including at least two tenants, where the at least two tenants include a target tenant, and a cache partition of the target tenant.
  • Cache partitioning for the target the method includes:
  • the monitoring record includes a correspondence between the adjustment amount and the cache revenue change;
  • the first cache amount is a current cache amount of the target cache partition;
  • the monitoring the monitoring record adjusts the first buffer amount to a second buffer amount in a case where it is determined that the first buffer amount is adjusted to a second buffer amount that meets a cache revenue target.
  • the above tenants can usually be enterprise users. Tenants can have many users, such as enterprise employees. Then each tenant can have a cache partition. The cache partition can have an initial cache amount. Then the tenant's cache is adjusted during the tena user's use of SaaS. It can be understood that the cache amount of the cache partition is adjusted to obtain the cache revenue.
  • the cache revenue target may be to increase the system performance corresponding to the cache, or to reduce the loss caused by the system performance; the system performance corresponding to the cache may include: The average read cache response time, cache hit rate, etc. of the users in the tenant; the loss due to system performance may include: the loss of penalties caused by low system performance.
  • the above-mentioned monitoring record records the information of the correspondence between the adjustment amount and the change of the change of the turnover.
  • the adjustment amount is the buffer amount of the adjustment buffer partition.
  • the adjustment amount may be adjusted or decreased, and may correspond to the positive and negative numbers respectively.
  • the adjustment amount is the difference between the second buffer amount and the first buffer amount; the difference may be represented by a symbol to indicate an increase or decrease. It can be understood that if the second cache amount is larger, it means that a new cache is allocated for the target cache partition, and conversely, a part of the cache is released from the target cache partition.
  • adjusting the first buffer amount to the second buffer amount includes:
  • the buffer of the adjusted amount is allocated from the idle shared cache to the target a cache partition;
  • the first cache revenue change amount corresponds to the target cache partition, and the second cache revenue change amount corresponds to a cache partition of the other tenants of the at least two tenants;
  • the cached revenue change amount corresponds to the target cache partition
  • the fourth cached revenue change amount corresponds to a cache amount of a cache partition of the other tenants in the at least two tenants.
  • the idle shared cache refers to a cache that has not been allocated to the cache partition.
  • the first cache revenue change is greater than the second.
  • the judgment of the amount of change in the cache revenue can be used to filter the target cache partition with larger gains as the adjustment target in order to maximize the profit; since the latter is to release the cache of the target cache partition into the idle shared cache. Therefore, the third cache revenue change amount is smaller than the fourth cache revenue change amount, and the target cache partition with a smaller negative gain can be selected as the adjustment target in the case of reducing the cache amount, thereby minimizing the loss.
  • the cache revenue includes:
  • the cache revenue is caused by adjusting the buffer size of the cache partition.
  • the result of adjusting the buffer size of the cache partition may result in many.
  • the above two examples should not be construed as a unique limitation on the embodiments of the present application.
  • the quality of service benefits corresponding to changes in service quality, such as: increase or decrease in cache hit rate.
  • the quality of service revenue includes: a revenue of a cache hit ratio and/or a gain of a read cache response time;
  • the revenue of the service level agreement resulting from the quality of service revenue includes revenue that is penalized by the service level agreement due to the change in the quality of service.
  • This embodiment exemplifies the service quality benefit and the benefit of the service level agreement caused by the service quality benefit.
  • the service quality benefit corresponds to the change of service quality, but the change of service quality is not limited to The above examples are not to be construed as limiting the uniqueness of the embodiments of the present application.
  • the benefit of the penalty imposed by the service level agreement may generally be the amount of change in the penalty caused by the violation of the service level agreement, for example, how much the penalty is increased, the amount of change in the charge deduction coefficient, and the like.
  • the method before the acquiring the first buffer amount, the method further includes:
  • Receiving an account opening request of the target tenant recording account opening data of the target tenant, creating the target cache partition for the target tenant; and the account opening data includes a service level agreement.
  • the tenant can usually correspond to the enterprise, and the enterprise acts as the tenant and the employee is the user.
  • the enterprise needs to obtain the registration of the device providing the service, that is, opening the account; when opening the account, the tenant will reach some agreement with the party providing the service.
  • the agreement here may include: the number of online tenants, the number of online users refers to the largest online users; and may include: parameters of the quality of service, such as: average response time and other parameters affecting the quality of service; may also include: services
  • a level agreement that is, a penalty caused by a violation of the quality of service, may also include an award resulting from an excess of better quality of service.
  • the embodiment of the present application further provides an implementation solution for analyzing the monitoring record, as follows: the analyzing the monitoring record includes:
  • an adjustment amount including the target cache partition, a cache amount of the target cache partition, a usage amount of the target cache partition, a fit function of the number of online users of the tenant, and a cache hit ratio of the target cache partition Analyze the monitoring record.
  • the embodiment of the present application further provides an implementation scheme for calculating a cache hit ratio based on the parameters given above and a more specific prediction of the fitting function, as follows: the using the target cache partition is included The adjustment amount, the amount of cache of the target cache partition, the usage of the target cache partition, the fitting function of the number of online users of the tenant and the cache hit ratio of the target cache partition, the monitoring record includes:
  • the target tenant is the i-th tenant
  • the Hiti' is the cache hit ratio of the i-th tenant
  • the Ni is the number of online users specified by the i-th tenant in the service level agreement
  • the hit Lasti is the cache hit ratio of the i-th tenant after the cache partition is last adjusted
  • the Pi is the cache amount of the cache partition of the i-th tenant
  • the Ui is the cache of the i-th tenant
  • the ⁇ M is the adjustment amount of the cache partition of the i-th tenant.
  • the second cache amount is adjusted to the difference between the first buffer amount as the adjustment amount, and which adjustment amount is used to obtain the maximum benefit, and the embodiment of the present application further provides the determination.
  • Implementation of the adjustment amount The method further includes:
  • the last adjusted cache hit ratio the cache hit ratio before the last adjustment, the number of online users of the household, the cache utilization of the target cache partition, and The total cache amount of all tenants calculates the amount of adjustment for the target cache partition.
  • the embodiment of the present application further provides a specific implementation scheme for calculating an adjustment amount based on the foregoing technical parameters, as follows: the use includes the latest adjustment of the target cache partition. The amount, the most recently adjusted cache hit ratio, the cache hit rate before the last adjustment, the number of online users of the household, the cache utilization of the target cache partition, and the total cache size of all tenants are calculated.
  • the amount of adjustment for the partition includes:
  • the ⁇ M is an adjustment amount of the cache partition of the i-th tenant; the ⁇ M lasti is a cache amount adjusted by the i-th tenant last cache partition; the hit Lasti is the i-th tenant The cache hit ratio after the cache partition is adjusted last time, the hit Lasti-1 is the cache hit ratio before the latest cache partition adjustment; the Ni is the number of online users specified in the service level agreement of the i-th tenant,
  • the Ui is a cache utilization of the i-th tenant cache partition, the archtan is a tangent autoregressive conditional heteroscedasticity model, and the sin is sinusoidal, The total amount of cache for all tenant's cache partitions.
  • the embodiment of the present application further provides a pre-judgment and a scheme for quickly obtaining the adjustment amount, as follows: Before adjusting the amount, the method further includes:
  • an average read cache response time of the user within the target tenant is less than or equal to a read cache response time specified by a service level agreement of the target tenant, and the number of online users of the target tenant is less than or equal to the service level agreement designation
  • the number of online users determines that the adjustment amount of the target cache partition is zero.
  • the amount of calculation is extremely small, and the adjustment amount can be quickly determined to be 0, that is, the adjustment of the cache partition is not required, thereby reducing unnecessary calculation.
  • the embodiment of the present application provides a cache allocation apparatus, which is applicable to a software-as-a-service SaaS including at least two tenants, where the at least two tenants include a target tenant, and a cache partition of the target tenant Cache partitioning for the target, the cache allocation device includes:
  • a data acquisition unit configured to acquire a first cache amount, and a monitoring record of the target tenant; the monitoring record includes a correspondence between the adjustment amount and a cache revenue change; the first cache amount is current of the target cache partition Cache amount;
  • a cache adjustment unit configured to analyze the monitoring record to adjust the first buffer amount to a second buffer amount when determining that the first buffer amount is adjusted to a second buffer amount that meets a cache revenue target.
  • the cache adjusting unit is configured to: when the first cache revenue change amount is greater than the second cache revenue change amount, and the idle shared cache cache amount is greater than the adjustment amount, Allocating the buffer of the adjusted amount to the target cache partition in the idle shared cache; the first cache revenue change amount corresponds to the target cache partition, and the second cache revenue change amount corresponds to the at least the The cache partition of the other tenants in the two tenants;
  • the cached revenue change amount corresponds to the target cache partition
  • the fourth cached revenue change amount corresponds to a cache amount of a cache partition of the other tenants in the at least two tenants.
  • the cache revenue includes:
  • the quality of service revenue includes: a revenue of a cache hit ratio and/or a gain of a read cache response time;
  • the revenue of the service level agreement resulting from the quality of service revenue includes revenue that is penalized by the service level agreement due to the change in the quality of service.
  • the cache allocation apparatus further includes:
  • a request receiving unit configured to receive an account opening request of the target tenant
  • a data recording unit configured to record account opening data of the target tenant
  • a partition creation unit configured to create the target cache partition for the target tenant; the account opening data includes a service level agreement.
  • the cache adjustment unit includes:
  • An analysis subunit for using an adjustment amount including the target cache partition, a cache amount of the target cache partition, a usage amount of the target cache partition, a number of online users of the tenant, and a cache of the target cache partition
  • the fitted function of the hit rate analyzes the monitoring record.
  • the analyzing subunit is configured to calculate a cache hit ratio using the following formula:
  • the target tenant is the i-th tenant
  • the Hiti' is the cache hit ratio of the i-th tenant
  • the Ni is the number of online users specified by the i-th tenant in the service level agreement
  • the hit Lasti is the cache hit ratio of the i-th tenant after the cache partition is last adjusted
  • the Pi is the cache amount of the cache partition of the i-th tenant
  • the Ui is the cache of the i-th tenant
  • the ⁇ M is the adjustment amount of the cache partition of the i-th tenant.
  • the cache adjustment unit includes:
  • a calculation subunit for using the last adjustment amount including the target cache partition, the last adjusted cache hit ratio, the cache hit ratio before the last adjustment, the number of online users of the household, the target cache partition The cache utilization, as well as the total cache size of all tenants, calculates the amount of adjustment for the target cache partition.
  • the calculating subunit is configured to calculate an adjustment amount of the target cache partition by using the following formula:
  • the ⁇ M is an adjustment amount of the cache partition of the i-th tenant; the ⁇ M lasti is a cache amount adjusted by the i-th tenant last cache partition; the hit Lasti is the i-th tenant after the last adjustment of the cache partition the cache hit rate, the cache hit Lasti-1 is the most recent hit ratio of the cache partition prior to adjustment; Ni specified for the service level agreement of the tenants in the i-th number of online users,
  • the Ui is a cache utilization of the i-th tenant cache partition, the archtan is a tangent autoregressive conditional heteroscedasticity model, and the sin is sinusoidal, The total amount of cache for all tenant's cache partitions.
  • the cache adjusting unit is further configured to: determine that an average read cache response time of the user in the target tenant is less than or equal to a read cache response time specified by a service level agreement of the target tenant And determining, by the number of online users of the target tenant, that the number of online users is less than or equal to the number of online users specified by the service level agreement, determining that the adjustment amount of the target cache partition is zero.
  • the embodiment of the present application provides another cache allocation apparatus, including: a cache, a processor, and an input/output device; wherein the cache includes a cache partition of the tenant, the processor has executable code or hardware Form to implement the functionality of the method of the above aspect.
  • the monitoring record of the tenant can predict the cache revenue that will be obtained by adjusting the buffer size of the cache partition, and then the cache revenue target can be used. Choose which cache partition to adjust, and whether to increase or decrease the cache size of the cache partition, thereby achieving higher cache yield and correspondingly increasing cache share utilization.
  • FIG. 1 is a schematic structural diagram of a system according to an embodiment of the present application.
  • FIG. 2 is a schematic flow chart of a method according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a relationship between a tenant cache partition size and a tenant cache partition hit ratio in the embodiment of the present application;
  • FIG. 4 is a schematic structural view of an apparatus according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a server according to an embodiment of the present application.
  • FIG. 1 is a structural diagram of a system provided by an embodiment of the present application, including the following three parts: a client, a SaaS application server, and a cache management server;
  • the client is used to display the SaaS application operation interface and generate and send data to the SaaS application server according to user operations.
  • the function of the client is to communicate with the user.
  • SaaS application server for processing write/read (W/R) requests for data initiated by tenants, where data read requests involve query data, write requests involve data changes, and SaaS application servers provide tenants with Data query, update, transaction management, and other services.
  • W/R write/read
  • a cache management server that provides caching services for SaaS application servers and provides cache-partition-based dynamic caching services for tenants.
  • the following embodiments respectively describe the components included in the aforementioned SaaS application server and cache management server, and their functions.
  • the SaaS application server consists of the following units:
  • Request monitor monitors the response time of the service request initiated by the user of all tenants (for example, the time difference between the order placing service starts from the user initiating the request and the completion of the order execution), and the current tenant is counted according to the service request initiated by the user.
  • the number of all online users, and record monitoring records such as:
  • Tenant SLA model When the tenant registers, the SLA data is generated according to the tenant's registration information, such as the tenant online user number, business response time, and the SaaS application provider penalty clause when the SaaS application provider violates the SLA (eg, SLA violation rate 0) ⁇ & ⁇ 5% pay 95% of the fee or directly set the penalty amount such as $100.)
  • the SLA model of the tenant huawei is as follows:
  • the cache management server contains the following units:
  • Multi-tenant shared cache as shown in Figure 1 in the right rectangular area of the cache management server, the rectangular area is divided into two parts, one part is the cache block to be allocated, and the other part is the cache partition of the tenant; the multi-tenant shared cache is the data cache. Because multiple tenants share the same cache resource, they are partitioned by tenant, and each cache partition is used to cache data for the corresponding tenant.
  • the multi-tenant shared cache can be either memory or a storage register.
  • the cache partition is as shown in the square area in the lower part of the rectangular area on the right side of the file. When the account is opened, the cache partition can have a fixed amount of cache, and the buffer size of the cache partition is dynamically adjusted during the tenant use.
  • Tenant cache partitioner Creates a cache partition in the storage register/memory when the tenant opens an account, and records the mapping relationship between the tenant and the partition, such as:
  • the record data of the cache partition is:
  • Tenant Cache Partition Monitor Used to monitor the amount of cache of the tenant cache partition, the amount of cache actually used, and the hit result of the tenant read cache and record it as a monitoring record, such as:
  • Tenant Cache Partitioner It is used to analyze the monitoring records of the tenant cache partition and generate the usage characteristics of the cache partition. Based on this usage feature, the cache size of each tenant's cache partition can be dynamically adjusted to continuously improve the cache hit ratio of the cache partition. Maximize the overall cache hit rate; you can preferentially adjust the cache yield ratio, or the cache partition corresponding to the tenant with a large SLA penalty factor, to maximize cache utilization and revenue; and, in the overall cache, there is no free cache resource allocated to the tenant. In the case of a cache partition, the cache cache of the tenant's cache partition is reclaimed and then cached, and then allocated to the cache partition of the cached high tenant.
  • API application programming interface
  • the SaaS application server sends the cache manager to the cache manager to read and write the data in the tenant cache partition through the API, such as:
  • the content that needs to be defined in the freeSize interface includes:
  • a tenant is opened and a cache partition is created for the tenant, and then the cache size of the cache partition is adjusted as an example.
  • the specific processing flow is shown in Figure 2:
  • the client generates account opening data.
  • the tenant huawei fills in the account opening data and submits the application to request the system to open an account.
  • the tenant name in the account opening information is huawei.
  • the SLA can contain the following information: the maximum number of online users allowed, the response time of the service request, and the SLA violation penalty. information.
  • the client sends the account opening data of the tenant in step 201 to the SaaS application server, and requests to open an account for the tenant huawei.
  • the SaaS application server After receiving the account opening request of the tenant huawei, the SaaS application server records the account opening data of the tenant huawei.
  • the SaaS application server creates a cache partition for the tenant huawei.
  • the creation of the cache partition is performed by the tenant cache partitioner in the cache management server. For details, refer to the system description shown in Figure 1.
  • the SaaS application server creates a cache partition for the tenant huawei as follows:
  • a cache partition is created for the tenant huawei.
  • the cache size of the cache partition is initialized to a preset value, such as 1 M, and the identifier of the cache partition is phuawei.
  • the SaaS application server also needs to record the data model of the mapping relationship between the tenant huawei and the cache partition. The details are as follows:
  • the cache management server may send, to the SaaS application server, information that the cache partition is successfully created for the tenant huawei, and the SaaS application server returns a message that the tenant huawei is successfully opened to the client.
  • a client-side tenant operation results in the generation of business data.
  • the client records the tenant operation and generates corresponding service data, and sends the data to the SaaS application server.
  • the SaaS application server requests the cache management server to query the cached data.
  • the SaaS application server sends a query request to the tenant cache read/write API for querying the cached data. For example, if the user places an order, the user needs to query the order number sent by the mobile phone number in the currently logged-in user cache data item, and the cache data item is in the tenant cache partition.
  • the identifier stored in is "loginedUser".
  • the tenant cache read/write API requests the query for the cached data whose identifier is "loginedUser" according to the service request tenant identifier huawei, and the query request information is ⁇ "tenant": "huawei", "cacheKey”: "loginedUser” ⁇ .
  • the tenant cache read/write API sends the tenant ID huawei requesting the tenant cache partitioner to query the partition allocated by huawei, for example, the cache partition identified by the query is phuawei.
  • the tenant cache read/write API sends the tenant identifier, and the query cache data identifier queries the cache data from the cache partition, for example, the query cache data is:
  • the tenant cache read and write API returns the cached data query result.
  • the tenant cache read and write API notifies the cache partition monitor cache hit result.
  • the cache hit result is determined by the cache read result: if the cache read is empty, it is a miss, otherwise it hits.
  • tenant cache partition monitor records tenant cache partition cache query hit results, such as
  • the tenant cache partition monitor notifies the tenant cache partition adjuster to adjust the cache amount of the tenant cache partition in real time according to the tenant cache partition query hit rate and the tenant cache partition revenue.
  • the tenant cache partition adjuster records the adjustment type, the adjustment amount, and the adjustment time of the tenant cache partition.
  • the types of adjustments here include increasing the amount of buffering or reducing the amount of buffering.
  • the tenant cache partition adjuster updates the cache size of the tenant's cache partition recorded by the tenant cache partitioner to an adjusted value.
  • the cache size of the cache partition in the record model of the tenant huawei is as shown in Table 1:
  • step 209 is described in the following embodiments, which need to solve three aspects of the problem: 1. How to predict how much the amount of change in the cache revenue is after adjusting the buffer size of the cache partition; How to determine the amount of adjustment; 3. After determining the amount of adjustment and the amount of change, how to adjust specifically; based on the above three questions, this embodiment is explained as follows:
  • the amount of change in the predicted cache revenue is as follows:
  • Step A The tenant cache partition adjuster queries all requests for monitoring records.
  • the request to monitor the record is as follows:
  • Specific data of the tenant's cache partition monitoring record such as:
  • Step B The tenant cache partition adjuster reads all tenant SLA models, such as:
  • Step C The tenant cache partition adjuster analyzes the foregoing monitoring record request and the specific data of the monitoring record, and combines the tenant SLA model to establish a cache partition adjustment amount, a cache partition size, a cache partition usage size, a user volume, and a cache partition hit. Rate correlation relationship fit function.
  • the adjustment amount of the cache partition is referred to as the adjustment amount, the size of the cache partition, that is, the cache size of the cache partition, the usage size of the cache partition, that is, the usage of the cache partition, and the user quantity is the number of online users of the tenant, wherein the maximum online user is specified in the SLA.
  • the cache partition hit ratio is the cache hit ratio of the cache partition.
  • the above-mentioned fitting function is used to predict the cache hit ratio of the tenant cache partition adjusted according to the adjustment amount. As shown in this embodiment, the expression of the tenant cache partition cache hit ratio prediction function is:
  • Hiti' is the value of the predicted cache hit ratio after adjusting the buffer size of the cache partition of the i-th tenant
  • Ni is the number of online users defined in the i-th tenant SLA (that is, the maximum number of online users).
  • Hit Lasti is the last hit rate of the i-th tenant after adjusting the cache amount of the entire cache partition; the value can be obtained by analyzing the monitoring record of the tenant cache partition and counting the adjustment time of the latest tenant cache partition.
  • the adjustment time interval of a tenant cache partition is the time period from R(last).time to System.currentTime.
  • Pi is the value of the current cache size of the cache partition of the i-th tenant.
  • the value of totalSize in the tenant cache partition monitoring record is read. For example, the value of the tenant huawei is 12M.
  • Ui is the value of the currently used cache size for the i-th tenant's cache partition.
  • ⁇ M is the adjustment amount of the cache partition, and it is assumed that the value of the preset adjustment amount is 0.5M. Adjusting the cache size of the cache partition will cause the tenant cache partition cache hit rate to increase or decrease. By continuously adjusting the cache size of the tenant's cache partition dynamically, the cache hit rate of each tenant cache partition is continuously increased, thereby improving the overall cache hit rate. Maximize cache revenue.
  • the tenant size is different and the cache partition size is different.
  • the same amount of cache size is used to change the cache partition hit rate. If the tenant huawei A and A' are compared, the cache gain at A is relatively high, which should be adjusted greatly.
  • the value adjusts the size of the cache partition, and the cache yield ratio at A' is low.
  • the adjustment method should adjust the size of the cache partition by multiple times for each smaller adjustment value, so that more cache resources are allocated to the adjustment point with larger revenue ratio. Increase the cache revenue; the cache revenue of the tenant1B relative to the tenant huawei A is relatively low.
  • the tenant1 cache partition should be adjusted in a smaller manner than the adjustment value of the tenant huawei, and more cache resources are allocated to the cache.
  • the tenant huawei with large revenue ratio can realize multi-tenant and multi-stage fine-tuning cache resources by combining the characteristics of each tenant's cache partition, further improving the overall utilization of cache resources and cache hit rate, and maximizing cache revenue.
  • the implementation also provides a specific implementation plan to determine the adjustment amount:
  • the key to fine-tuning the size of the cache partition is to evaluate the value of each adjustment.
  • the embodiment further includes a history adjustment record combining the cache amount of the cache partition, monitoring data of the monitoring record of the cache partition, a history of request monitoring, a tenant SLA model, and dynamically calculating an adjustment amount of the cache partition for the tenant, that is, tuning ⁇ M', corresponding to the system shown in Figure 1, the tenant cache partition adjuster adjusts the buffer size of the cache partition before performing the following method to further calculate the adjusted adjustment amount, including the following steps:
  • Step A reading the history of the cache adjustment, the specific data of the monitoring record of the cache partition, the monitoring record of the tenant service request, and the tenant SLA model;
  • Step B Calculating the tuning value ⁇ M′: calculating the monitoring record of the tenant service request by using the last time the tenant adjusts the cache partition time as the start time, and the service request receiving time is greater than the monitoring record of the service request at the start time, and statistically solving The average response time per business request (the sum of all business request response durations and / business requests), and the number of tenant online users is read from the monitoring record of the business request.
  • Step B2 When the average response time of the tenant's service request > the request response duration defined in the tenant SLA model, the tenant SLA is not satisfied, and the method for calculating the adjusted value includes:
  • Step B3 According to the adjustment record of the last two cache partitions of the tenant from the monitoring record, ⁇ R(last), R(last-1) ⁇ , for example, the last two adjustment records of the cache partition corresponding to the tenant huawei are:
  • the adjustment amount of the last tenant cache partition adjustment is ⁇ Mlast.
  • the last adjustment value of the tenant huawei is 4M.
  • Step B4 Calculate a cache hit ratio in a buffer adjustment time interval of the last 2 cache partitions.
  • the monitoring record of the tenant cache partition is analyzed, and the cache hit ratio of the cache partition in the buffer adjustment time interval of the latest tenant cache partition is counted.
  • the first item that is, the record of the last adjustment of the cache partition is ⁇ time:2016-10-22 10:21:34.321, value: 4m ⁇ , indicating that in the statistical interval of the tenant huawei
  • the end time is the current system time System.currentTime.
  • the second item that is, the record of the cache partition before the last time is: ⁇ time:2016-10-22 10:18:33.321, value:2.5m ⁇ , indicating the statistical interval of the tenant huawei
  • Step B5 Calculate the cache utilization rate of each tenant cache partition.
  • the cache partition cache utilization U for each tenant is calculated by reading the cache size of each tenant's cache partition and the amount of cache used.
  • Step B6 Read the tenant SLA to obtain the number of online users of each tenant.
  • Step B7 Calculate the adjusted adjustment amount ⁇ M' according to the above data, as the calculation expression is:
  • M' is the adjustment amount of the cache partition of the tuned tenant i; when hitLasti-hitLast-1i>0, the size of the tenant cache partition is increased, and more cache resources are allocated; when hitLasti-hitLast-1i ⁇ 0 To reduce the size of the tenant cache partition and release the cache resources.
  • ⁇ M lasti is the value of the last cache partition adjustment of the tenant i.
  • the value of the tenant huawei is 4m.
  • Hit Lasti is the cache hit ratio of the last cache partition of the tenant i.
  • the value of the tenant huawei in the preceding example is 90%.
  • Hit Lasti-1 is the cache hit rate of the tenant i after the last time the cache partition was adjusted.
  • the value of the tenant huawei in the previous example is 75%.
  • Ni is the number of online users defined in the SLA of the tenant i, that is, the maximum number of online users allowed to be tenant. For example, the value of the tenant huawei is 100.
  • Ui is the current cache utilization of the cache partition of tenant i.
  • the value of the tenant huawei is 91.7%.
  • the value of the adjustment amount of the preferred cache calculated by the tenant huawei according to the above formula should be 7M.
  • Step C When the cache partition adjuster is triggered to adjust the tenant cache partition again, based on the formula for predicting the tenant cache hit ratio, predict the cache hit ratio of all tenants, and calculate the adjustment amount of the cache partition ⁇ M and the cache of the cache partition.
  • the yield ratio of the hit rate change value ⁇ hit is
  • This embodiment can be executed after the parameters of the foregoing two aspects have been prepared, that is, after the adjustment amount and the amount of change in revenue are determined.
  • the tenant cache partition adjuster adjusts the tenant cache partition based on the above revenue ratio, SLA model and monitoring information, and maximizes the revenue of the SaaS provider.
  • the specific process is as follows:
  • Step A Identify the tenant that satisfies the SLA as the queue S1, and identify the tenant whose response time and the online user amount do not satisfy the SLA as the queue S2.
  • Step B assuming the adjustment amount > 0:
  • queue S2 If queue S2 is empty, then the amount of buffer space can be allocated to the revenue to the largest tenant, thereby maximizing the overall cache hit rate. If the tenant with the highest revenue ratio is huawei, the cache will be allocated to the cache partition of the tenant huawei from the free shared cache.
  • queue S2 If queue S2 is not empty, then the cache can be allocated to a large penalty factor, the hit rate can be increased to the largest tenant, and the service provider loss is minimized.
  • Step B2 If the multi-tenant shares the cached idle resource ⁇ adjustment amount:
  • the cache that has been allocated to the cache partition needs to be released as an idle resource.
  • the cache utilization of each tenant is calculated according to the monitoring record of the cache partition, and the cache utilization is low, and the cache hit rate is low.
  • a tenant with a small penalty factor releases the cache and then allocates it to the cache partition of the tenant with the largest cache benefit and the penalty factor.
  • Step C assuming that the adjustment amount is ⁇ 0, the cache partition read/write API can be requested to release the cache space as a cache partition allocated to other tenants as free space.
  • FIG. 4 is a schematic structural diagram of a cache allocation apparatus according to an embodiment of the present application, applied to a software-as-a-service SaaS including at least two tenants, where the at least two tenants include a target tenant, and the target tenant
  • the cache partition is a target cache partition
  • the cache allocation means may include a data acquisition unit and a cache adjustment unit, wherein a detailed description of each unit is as follows.
  • a data acquisition unit 401 configured to acquire a first cache amount, and a monitoring record of the target tenant; the monitoring record includes a correspondence between the adjustment amount and a cache revenue change; the first cache amount is the target cache partition current Cache amount;
  • the cache adjustment unit 402 is configured to analyze the monitoring record to adjust the first buffer amount to a second buffer amount when determining that the first buffer amount is adjusted to a second buffer amount that meets a cache revenue target. .
  • the data obtaining unit 401 may correspond to the functions of the request monitor and the tenant cache partition monitor in the system structure diagram 1; the cache adjusting unit 402 may correspond to the tenant cache partition adjuster in the system structure diagram 1.
  • the monitoring record of the tenant can predict the cache revenue that will be obtained by adjusting the buffer size of the cache partition, and then the cache revenue target can be used. Choose which cache partition to adjust, and whether to increase or decrease the cache size of the cache partition, thereby achieving higher cache yield and correspondingly increasing cache share utilization.
  • the embodiment of the present application further provides a specific implementation scheme for allocating a new cache to a target cache partition and releasing the cache from the target cache partition, as follows:
  • the cache adjustment unit 402 is configured to allocate the first cached revenue change amount from the idle shared cache if the first cache revenue change amount is greater than the second cache revenue change amount, and the idle shared cache cache amount is greater than the adjustment amount. Adjusting a volume of the cache to the target cache partition; the first cache revenue change amount corresponds to the target cache partition, and the second cache revenue change amount corresponds to a cache partition of another tenant of the at least two tenants ;
  • the cached revenue change amount corresponds to the target cache partition
  • the fourth cached revenue change amount corresponds to a cache amount of a cache partition of the other tenants in the at least two tenants.
  • optional content of the cache revenue is also provided, as follows: the cache revenue includes:
  • the quality of service benefits include: revenue from cache hit ratios and/or gains from read cache response times;
  • the revenue of the service level agreement resulting from the quality of service revenue includes revenue that is penalized by the service level agreement due to the change in the quality of service.
  • the cache allocation apparatus further includes:
  • the request receiving unit 403 is configured to receive an account opening request of the target tenant
  • a data recording unit 404 configured to record account opening data of the target tenant; the account opening data includes a service level agreement;
  • a partition creation unit 405 is configured to create the target cache partition for the target tenant.
  • the cache adjusting unit 402 includes:
  • An analysis sub-unit 4021 configured to use an adjustment amount including the target cache partition, a cache amount of the target cache partition, a usage amount of the target cache partition, an online user number of the tenant, and a target cache partition
  • the fitted function of the cache hit ratio analyzes the monitoring record.
  • the embodiment further refines the content of the fitting function as follows: 17.
  • the analysis sub-unit 4021 is configured to calculate a cache hit ratio using the following formula:
  • the target tenant is the i-th tenant
  • the Hiti' is the cache hit ratio of the i-th tenant
  • the Ni is the number of online users specified by the i-th tenant in the service level agreement
  • the hit Lasti is the cache hit ratio of the i-th tenant after the cache partition is last adjusted
  • the Pi is the cache amount of the cache partition of the i-th tenant
  • the Ui is the cache of the i-th tenant
  • the ⁇ M is the adjustment amount of the cache partition of the i-th tenant.
  • a manner of calculating an adjustment amount is also provided, and the cache adjustment unit 402 includes:
  • the calculating sub-unit 4022 is configured to use the last adjustment amount including the target cache partition, the cached hit ratio after the last adjustment, the cache hit ratio before the last adjustment, the number of online users of the household, the target cache The cache utilization of the partition, and the total cache size of all tenants, calculates the amount of adjustment for the target cache partition.
  • the embodiment further refines the formula used in the calculation as follows:
  • the calculation sub-unit 4022 is configured to calculate the adjustment amount of the target cache partition using the following formula:
  • the ⁇ M is an adjustment amount of the cache partition of the i-th tenant; the ⁇ M lasti is a cache amount adjusted by the i-th tenant last cache partition; the hit Lasti is the i-th tenant The cache hit ratio after the cache partition is adjusted last time, the hit Lasti-1 is the cache hit ratio before the latest cache partition adjustment; the Ni is the number of online users specified in the service level agreement of the i-th tenant,
  • the Ui is a cache utilization of the i-th tenant cache partition, the archtan is a tangent autoregressive conditional heteroscedasticity model, and the sin is sinusoidal, The total amount of cache for all tenant's cache partitions.
  • the embodiment of the present application filters out a buffer amount adjustment that does not need to perform buffer partitioning, as follows: the cache adjustment unit 402 is further used for Determining that an average read cache response time of the user within the target tenant is less than or equal to a read cache response time specified by a service level agreement of the target tenant, and the number of online users of the target tenant is less than or equal to the service level agreement designation The number of online users determines that the adjustment amount of the target cache partition is zero.
  • FIG. 5 is a cache allocation apparatus according to an embodiment of the present disclosure.
  • the cache allocation apparatus includes: a cache 501, a processor 502, and an input/output device 503.
  • the cache 501 may be included in the memory or integrated.
  • a cache partition of the tenant is included in the cache 501; executable code may be stored in the foregoing memory, and the processor 502 has the foregoing executable executable code or implemented in hardware to implement the embodiment of the present application.
  • the functionality of the provided method The functions of the method in this embodiment are not described herein again.
  • the cache 501, the processor 502, and the input/output device 503 can be connected to each other through a bus.
  • the memory includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), and an erasable programmable read-only memory (Erasable Programmable Read). Only Memory (EPROM), or Compact Disc Read-Only Memory (CD-ROM), which can be used to store related instructions and data.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read-only memory
  • CD-ROM Compact Disc Read-Only Memory
  • the processor 502 may be one or more central processing units (CPUs). In the case where the processor 502 is a CPU, the CPU may be a single core CPU or a multi-core CPU.
  • CPUs central processing units
  • the processor 502 can implement the read/write monitor, the tenant cache partition monitor, the tenant cache partition adjuster, and the tenant cache partitioner in the system shown in FIG. Features.
  • FIG. 6 is a schematic structural diagram of a server provided by an embodiment of the present application.
  • the server 600 may have a large difference due to different configurations or performances, and may include one or more central processing units (CPUs) 622 (for example, , one or more processors) and memory 632, one or more storage media 630 storing application 642 or data 644 (eg, one or one storage device in Shanghai), cache space, and cache space based cache partitions may be integrated Memory 632.
  • the memory 632 and the storage medium 630 may be short-term storage or persistent storage.
  • the program stored on storage medium 630 may include one or more modules (not shown), each of which may include a series of instruction operations in the server.
  • central processor 622 can be configured to communicate with storage medium 630, executing a series of instruction operations in storage medium 630 on server 600.
  • Server 600 may also include one or more power sources 626, one or more wired or wireless network interfaces 650, one or more input and output interfaces 658, and/or one or more operating systems 641, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more.
  • the steps performed by the cache allocating means in the above embodiment may be based on the server structure shown in FIG.
  • the server can correspond to the functions of the SaaS application server and the cache management server of the system structure shown in FIG. 1.
  • the program can be stored in a computer readable storage medium, when the program is executed
  • the flow of the method embodiments as described above may be included.
  • the foregoing storage medium includes various media that can store program codes, such as a ROM or a random access memory RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

一种缓存分配方法,及设备,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分区为目标缓存分区,所述方法包括:获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;分析所述监控记录在确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述第一缓存量调整为第二缓存量。采用该方法,可以获得更高的缓存收益,相应地提高缓存共享利用率。

Description

一种缓存分配方法,及设备
本申请要求于2017年3月17日提交中国专利局、申请号为201710161725.2,发明名称为“一种缓存分配方法,及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种缓存分配方法,及设备。
背景技术
缓存(Cache)是数据交换的缓冲区,在有数据读取需求的情况下,会首先从缓存中查询需要的数据,如果查询到了则可以直接执行,若查询不到则从内存中找,在内存中查询不到则会到硬盘或者其他更大的存储设备中查询。因此,缓存的运行速度最快,比内存快得多,故缓存的作用是加快设备的运行速度。
基于以上说明可知:在缓存中查询到的概率越大则速度越快,即:缓存命中率越高速度越快,缓存命中率是指:查询缓存且不为空的次数/查询缓存的总次数。举个例子如下:如查询100次缓存,30次查询到数据则缓存命中率为30/100=30%。通常来说,缓存空间越大存储的数据越多,则缓存命中率会越高;但是缓存空间是有限的,特别是在多用户存在的情况下,例如:在软件即服务(Software as a Service,SaaS)的应用场景下,每个租户可被分配的缓存资源更为有限。在SaaS中一个租户可以包含多个用户。例如:租户可以是企业,用户则是企业内的员工。
随着网络技术的迅速发展,SaaS按需租赁模式在云计算领域得到了迅速发展,SaaS以多租户技术架构为多个企业客户提供软件租赁服务,能够使大量的租户/企业共享使用同一堆栈的软件、硬件资源,最大化共享资源利用率。
多租户共享架构的目标是:既要实现资源多租户共享,也要实现多租户之间合理隔离,还要达到资源收益最大化。缓存是提高系统性能的一种重要且有限的资源,传统的缓存使用是不区分租户的,在多租户共享竞争使用缓存资源的架构下,会引起如下问题:
由于资源竞争,访问系统频率高的租户使用较多缓存资源,访问系统频率低的租户只能使用很少的缓存资源甚至无缓存资源供其使用,缓存资源过小则会引起服务质量违反其服务等级协议(Service Level Agreement,SLA),导致服务提供商因此受到惩罚造成经济损失。SLA是租户和SaaS提供商签订的服务等级协议。
为了解决以上问题提出了如下解决方案:通过动态高速缓存分区(Dynamic Cache Partition,DCP)技术对各应用的缓存进行隔离和分配,缓存隔离和分配的具体实现方式为:为每个目标应用分配缓存的最小值、目标值以及最大值;目标应用启动时缓存为最小值,在目标应用运行过程中缓存需求会越来越大,在分配给目标应用的缓存到达目标值后继续增大,则需要根据一定的规则从其他应用的缓存中划分一部分分配给目标应用,在目标应用的缓存到达最大值的情况下不再新分配缓存给该目标应用。
采用以上DCP技术,实践已经表明采用以上方案一部分应用的缓存利用率较低,而另一部分应用因缓存匮乏导致服务质量低,因此缓存的共享利用效率较低。
发明内容
本申请实施例所要解决的技术问题在于,提供一种缓存分配方法,及设备,用于提高缓存共享利用率。
第一方面,本申请实施例提供了一种缓存分配方法,其特征在于,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分区为目标缓存分区,所述方法包括:
获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;
分析所述监控记录在确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述所述第一缓存量调整为第二缓存量。
上述租户通常可以是企业用户,租户可以有很多用户,例如企业员工;那么每个租户可以有一个缓存分区,缓存分区可以有初始的缓存量,之后在租户的用户使用SaaS过程中调整租户的缓存量;可以理解的是,调整缓存分区的缓存量是为了获得缓存收益,缓存收益目标可以是增加缓存对应的系统性能,也可以是减少因系统性能导致的损失;缓存对应的系统性能可以包括:租户内的用户平均读缓存的响应时间、缓存命中率等等;因系统性能导致的损失可以包括:系统性能低导致被处罚的损失等。
上述监控记录所记录的是调整量与换手收益变化的对应关系的信息,调整量是调整缓存分区的缓存量,这里调整量可以是调多也可以是调少,可以分别对应正数和负数,也可以使用绝对值记录缓存调整的大小然后记录缓存收益是正的收益还是负的收益;缓存收益与前述缓存收益目标是对应的,在此不再赘述。
另外,由于将第一缓存量调整为了第二缓存量,因此调整量即为第二缓存量与第一缓存量的差值;这个差值可以带有符号来表示调大或者调小。可以理解的是,如果第二缓存量更大,则表示为目标缓存分区分配了新的缓存,反之则是从目标缓存分区中释放出一部分缓存。
在一种可选的实现方式中,所述确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述第一缓存量调整为第二缓存量包括:
在第一缓存收益变化量大于第二缓存收益变化量,且空闲的共享缓存的缓存量大于调整量的情况下,从所述空闲的共享缓存中分配所述调整量大小的缓存到所述目标缓存分区;所述第一缓存收益变化量对应所述目标缓存分区,所述第二缓存收益变化量对应所述所述至少两个租户中其他租户的缓存分区;
或者,在第三缓存收益变化量小于第四缓存收益变化量,且所述空闲的共享缓存的缓存量小于所述调整量的情况下,从所述目标缓存分区中释放缓存;所述第三缓存收益变化量对应所述目标缓存分区,所述第四缓存收益变化量对应所述至少两个租户中其他租户的缓存分区的缓存量。
在本实施例中,空闲的共享缓存是指还没有分配给缓存分区的缓存;在本实施例中,由于前者是为目标缓存分区分配新的缓存,因此上述第一缓存收益变化量大于第二缓存收益变化量的判断,可以筛选出增加缓存量的情况下正收益更大的目标缓存分区作为调整对象,从而最大化收益;由于后者是为了释放目标缓存分区的缓存到空闲的共享缓存中,因此上述第三缓存收益变化量小于第四缓存收益变化量,则可以筛选出减少缓存量的情况下负收益更小的目标缓存分区作为调整对象,从而最小化损失。
在一种可选的实现方式中,所述缓存收益包括:
服务质量收益,或,因所述服务质量收益导致的服务等级协议的收益。
可以理解的是,缓存收益是因调整缓存分区的缓存量导致,调整缓存分区的缓存量可以导致的结果有很多,以上两个举例不应理解为对本申请实施例的唯一性限定。其中服务质量收益,对应到服务质量的变化,例如:缓存命中率的增加或减少。
在一种可选的实现方式中,所述服务质量收益包括:缓存命中率的收益和/或读缓存响应时间的收益;
所述因所述服务质量收益导致的所述服务等级协议的收益包括:因所述服务质量变化导致受所述服务等级协议的惩罚的收益。
本实施例对服务质量收益以及因所述服务质量收益导致的服务等级协议的收益进行了举例说明,正如前文所记载的,服务质量收益对应到服务质量的变化,然而服务质量的变化并不仅限于以上举例;以上举例不应理解为对本申请实施例的唯一性限定。在本实施例中,受服务等级协议的惩罚的收益,通常可以是违反服务等级协议导致的惩罚的变化量,例如:惩罚增加了多少、费用扣除系数的变化量等。
在一种可选的实现方式中,在所述获取第一缓存量之前,所述方法还包括:
接收所述目标租户的开户请求,记录所述目标租户的开户数据,为所述目标租户创建所述目标缓存分区;所述开户数据包括服务等级协议。
在本实施例中,租户通常可以对应到企业,企业作为租户其员工作为用户,该企业需要在提供服务的设备获得注册,即:开户;在开户时,租户会与提供服务的一方达成一些约定,这里的约定可以包含:租户的在线人数,这里的在线人数是指最大可以在线的用户;还可以包含:服务质量的参数,例如:平均响应时间等影响服务质量的参数;还可以包含:服务等级协议,即:违反服务质量的要求导致的惩罚,也可以包含超额提供更好的服务质量导致的奖励。
在一种可选的实现方式中,本申请实施例还提供了分析监控记录的实现方案,如下:所述分析所述监控记录包括:
使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录。
在一种可选的实现方式中,本申请实施例还提供了基于以上给出的参数以及拟合函数的更具体预测计算缓存命中率的实现方案,如下:所述使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录包括:
使用如下公式计算缓存命中率:
Figure PCTCN2018073851-appb-000001
其中,所述目标租户为第i个租户,所述Hiti’为所述第i个租户的缓存命中率,所述Ni为所述第i个租户在服务等级协议中指定的在线用户数;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率;所述Pi为所述第i个租户的缓存分区的缓存量;所述Ui为所述第i个租户的缓存分区实际使用的缓存量;所述ΔM为所述第i个租户的缓存分区的调整量。
在一种可选的实现方式中,由于第二缓存量调整为第一缓存量之间的差值为调整量,具体采用哪一个调整量才能获得最大化收益,本申请实施例还提供了确定调整量的实现方案: 所述方法还包括:
使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量。
在一种可选的实现方式中,为了最大化缓存收益,本申请实施例还提供了基于以上技术参数计算调整量的具体实现方案,如下:所述使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量包括:
使用如下公式计算所述目标缓存分区的调整量:
Figure PCTCN2018073851-appb-000002
其中,所述ΔM为所述第i个租户的缓存分区的调整量;所述ΔM lasti为所述第i个租户最近一次缓存分区调整的缓存量;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率,所述hit Lasti-1为最近一次缓存分区调整前的缓存命中率;所述Ni为所述第i个租户的服务等级协议中指定的在线用户数,所述Ui为所述第i个租户缓存分区的缓存利用率,所述archtan为正切自回归条件异方差模型,所述sin为正弦,所述
Figure PCTCN2018073851-appb-000003
为所有租户的缓存分区的总缓存量。
在一种可选的实现方式中,由于计算缓存调整量的计算量比较大,本申请实施例还提供了前置判断,快速获得调整量的方案,具体如下:在计算所述目标缓存分区的调整量之前,所述方法还包括:
在确定所述目标租户内用户的平均读缓存响应时间小于或等于所述目标租户的服务等级协议指定的读缓存响应时间,并且所述目标租户的在线用户数小于或等于所述服务等级协议指定的在线用户数,则确定所述目标缓存分区的调整量为0。
本实施例计算量极少,可以迅速确定调整量为0,即:不需要进行缓存分区的调整的情况,从而减少不必要的计算。
第二方面,本申请实施例提供了一种缓存分配装置,其特征在于,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分区为目标缓存分区,所述缓存分配装置包括:
数据获取单元,用于获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;
缓存调整单元,用于分析所述监控记录在确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述所述第一缓存量调整为第二缓存量。
在一种可选的实现方式中,所述缓存调整单元,用于在第一缓存收益变化量大于第二缓存收益变化量,且空闲的共享缓存的缓存量大于调整量的情况下,从所述空闲的共享缓存中分配所述调整量大小的缓存到所述目标缓存分区;所述第一缓存收益变化量对应所述目标缓存分区,所述第二缓存收益变化量对应所述所述至少两个租户中其他租户的缓存分区;
或者,在第三缓存收益变化量小于第四缓存收益变化量,且所述空闲的共享缓存的缓存量小于所述调整量的情况下,从所述目标缓存分区中释放缓存;所述第三缓存收益变化量对应所述目标缓存分区,所述第四缓存收益变化量对应所述至少两个租户中其他租户的缓存分 区的缓存量。
在一种可选的实现方式中,所述缓存收益包括:
服务质量收益,或,因所述服务质量收益导致的服务等级协议的收益。
在一种可选的实现方式中,所述服务质量收益包括:缓存命中率的收益和/或读缓存响应时间的收益;
所述因所述服务质量收益导致的所述服务等级协议的收益包括:因所述服务质量变化导致受所述服务等级协议的惩罚的收益。
在一种可选的实现方式中,所述缓存分配装置还包括:
请求接收单元,用于接收所述目标租户的开户请求;
数据记录单元,用于记录所述目标租户的开户数据;
分区创建单元,用于为所述目标租户创建所述目标缓存分区;所述开户数据包括服务等级协议。
在一种可选的实现方式中,所述缓存调整单元包括:
分析子单元,用于使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录。
在一种可选的实现方式中,所述分析子单元,用于使用如下公式计算缓存命中率:
Figure PCTCN2018073851-appb-000004
其中,所述目标租户为第i个租户,所述Hiti’为所述第i个租户的缓存命中率,所述Ni为所述第i个租户在服务等级协议中指定的在线用户数;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率;所述Pi为所述第i个租户的缓存分区的缓存量;所述Ui为所述第i个租户的缓存分区实际使用的缓存量;所述ΔM为所述第i个租户的缓存分区的调整量。
在一种可选的实现方式中,所述缓存调整单元包括:
计算子单元,用于使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量。
在一种可选的实现方式中,所述计算子单元,用于使用如下公式计算所述目标缓存分区的调整量:
Figure PCTCN2018073851-appb-000005
其中,所述ΔM为所述第i个租户的缓存分区的调整量;所述ΔM lasti为所述第i个租户最近一次缓存分区调整的缓存量;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率,所述hit Lasti-1为最近一次缓存分区调整前的缓存命中率;所述Ni为所述第i个租户的服务等级协议中指定的在线用户数,所述Ui为所述第i个租户缓存分区的缓存利用率,所述archtan为正切自回归条件异方差模型,所述sin为正弦,所述
Figure PCTCN2018073851-appb-000006
为所 有租户的缓存分区的总缓存量。
在一种可选的实现方式中,所述缓存调整单元,还用于在确定所述目标租户内用户的平均读缓存响应时间小于或等于所述目标租户的服务等级协议指定的读缓存响应时间,并且所述目标租户的在线用户数小于或等于所述服务等级协议指定的在线用户数,则确定所述目标缓存分区的调整量为0。
第三方面,本申请实施例提供了另一种缓存分配装置,包括:缓存、处理器以及输入输出设备;其中,缓存内包含租户的缓存分区,所述处理器具有执行可执行代码或者以硬件形式来实现以上一方面的方法的功能。
通过实施本申请实施例,由于监控记录包含调整量与缓存收益变化的对应关系,通过租户的监控记录,则可以预测调整缓存分区的缓存量将会获得的缓存收益,那么可以基于缓存收益目标来选择调整哪一个缓存分区,以及,是调大还是调小该缓存分区的缓存量,从而获得更高的缓存收益,相应地提高缓存共享利用率。
附图说明
下面将对本申请实施例中所需要使用的附图进行说明。
图1是本申请实施例系统结构示意图;
图2是本申请实施例方法流程示意图;
图3是本申请实施例租户缓存分区大小和租户缓存分区命中率关联关系的示意图;
图4是本申请实施例装置结构示意图;
图5是本申请实施例装置结构示意图;
图6是本申请实施例服务器结构示意图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。
请参见图1,图1是本申请实施例提供的系统结构图,包括如下三部分:客户端、SaaS应用服务器以及缓存管理服务器;
其中,客户端,用于显示SaaS应用操作界面及根据用户操作生成和发送数据到SaaS应用服务器。客户端的功能在于与用户的沟通。
SaaS应用服务器,用于处理租户发起的数据的写/读(Write/Read,W/R)请求,其中数据读请求会涉及到查询数据,写请求会涉及到数据变更;SaaS应用服务器为租户提供数据查询、更新、事务管理、等服务。
缓存管理服务器,用于为SaaS应用服务器提供缓存服务,为租户提供基于缓存分区的动态缓存服务。
以下实施例对前述SaaS应用服务器和缓存管理服务器所包含组成部分,及其功能分别进行说明。
SaaS应用服务器包含以下单元:
请求监控器:监控所有租户的用户发起的业务请求的响应时长(如,“订单下单”业务从用户发起请求开始到下单业务执行完成的时间差),根据用户发起的业务请求统计当前租户的所有在线用户数量,并记录监控记录如:
Figure PCTCN2018073851-appb-000007
Figure PCTCN2018073851-appb-000008
租户SLA模型:租户注册时,根据租户的注册信息生成SLA数据,具体如租户在线用户数、业务响应时间以及当SaaS应用提供商违反SLA时对SaaS应用提供商惩罚条款(如:SLA违反率0<&<5%付95%费用或者直接设置惩罚金额如$100等方式)。如租户huawei的SLA模型如下:
Figure PCTCN2018073851-appb-000009
缓存管理服务器包含以下单元:
多租户共享缓存:如图1中缓存管理服务器中右侧矩形区域,该矩形区域分为两部分,一部分为待分配缓存块,另一部分为租户的缓存分区;该多租户共享缓存是数据缓存,由于多个租户共享使用同一缓存资源,因此按租户进行分区,每个缓存分区用于缓存对应租户的数据。该多租户共享缓存可以是内存也可以是存储寄存器。缓存分区如图1右侧矩形区域下部的正方形区域,在开户时缓存分区可以具有一个固定大小的缓存量,后续在租户使用过程中动态调整缓存分区的缓存量。
租户缓存分区器:租户开户时在存储寄存器/内存中创建缓存分区,并记录租户和分区的映射关系,如:
为租户huawei创建缓存量为1M标识为p0的缓存分区,该缓存分区的记录数据为:
Figure PCTCN2018073851-appb-000010
Figure PCTCN2018073851-appb-000011
租户缓存分区监控器:用于监控租户缓存分区的缓存量、实际使用的缓存量,以及租户读缓存的命中结果并记录为监控记录,如:
Figure PCTCN2018073851-appb-000012
{//这一段是访问缓存分区的另一条记录,假定访问缓存为未命中,相关说明参照前一记录的说明
Figure PCTCN2018073851-appb-000013
租户缓存分区调整器:用于分析租户缓存分区的监控记录,生成缓存分区的使用特征,可以基于此使用特征动态调整每个租户的缓存分区的缓存量,从而持续提升缓存分区的缓存命中率,最大化整体的缓存命中率;可以优先调整缓存收益比高,或,SLA惩罚因子大的租户对应的缓存分区,从而最大化缓存利用率和收益;以及,在整体缓存没有空闲缓存资源分配给租户的缓存分区的情况下,回收缓存收益低的租户的缓存分区的缓存,然后分配给缓存收益高的租户的缓存分区。上述缓存收益比,是指缓存命中率提升量/缓存调整量,例如:命中率提升20%、缓存调整量为20M,则缓存收益比为20%/20=1%;上述缓存收益低是指缓存收益比低或SLA惩罚因子低,上述缓存收益高是指缓存收益比高或SLA惩罚因子高。每次调整租户的缓存分区的缓存量后记录调整数据,如:
Figure PCTCN2018073851-appb-000014
租户缓存读写应用程序接口(Application Programming Interface,API):SaaS应用服务器发送给缓存管理器,用于读写缓存数据时通过该API对租户缓存分区内的数据执行读写操作,如:
Figure PCTCN2018073851-appb-000015
以及接收租户缓存分区调整器指令释放租户缓存分区的缓存空间,如租户缓存分区调整器调用freeSize接口:
freeSize(huawei,1m)//租户huawei缓存分区释放1M缓存空间
该freeSize接口内需要定义的内容包括:
定位到租户huawei的缓存分区,确定huawei的缓存分区位置,然后释放使用较少的缓存项占用的缓存。具体可以是:获得huawei的缓存分区内各缓存项的读次数,按照各缓存项的读次数由低到高依次累加缓存项占用的缓存量,直到计算得到缓存量的累加值>=1M时,停止统计,并删除参与统计的缓存项占用的缓存。
基于以上系统架构,以及各组成部件的说明,本申请实施例提供了如下缓存分配的解决方案,本实施例以租户开通并为租户创建缓存分区,然后调整缓存分区的缓存量为例进行说明,具体的处理流程如图2所示:
201、客户端生成开户数据;
具体例如:租户huawei通过客户端填写开户数据并提交申请,请求系统开户;例如开户信息中租户名称为huawei,SLA可以包含的信息有:允许最大的在线用户数、业务请求响应时长、SLA违反惩罚信息。
202、客户端发送步骤201中租户的开户数据到SaaS应用服务器,请求为租户huawei开户。
203、SaaS应用服务器收到租户huawei的开户请求后记录租户huawei的开户数据。
记录租户huawei开户信息具体如下:
Figure PCTCN2018073851-appb-000016
204、SaaS应用服务器为租户huawei创建缓存分区。
缓存分区的创建由缓存管理服务器中的租户缓存分区器执行,具体可以参照图1所示系 统说明。
SaaS应用服务器为租户huawei创建缓存分区具体如下:
2041、在多租户的共享缓存中为租户huawei创建缓存分区,可以初始化该缓存分区的缓存量为预先设定的值如1M,该缓存分区的标识为phuawei。创建缓存分区存储块的方式如:char*phuawei=new char[1024*1024]。
2042、在为租户huawei创建缓存分区,SaaS应用服务器还需要记录租户huawei与缓存分区的映射关系的数据模型,具体可以如下:
Figure PCTCN2018073851-appb-000017
205、缓存管理服务器可以向SaaS应用服务器发送为租户huawei创建缓存分区成功的信息,SaaS应用服务器向客户端返回租户huawei开户成功的消息。
206:客户端一侧租户操作会导致生成业务数据。
207、客户端记录租户操作并生成对应的业务数据,发送给SaaS应用服务器。
208、SaaS应用服务器请求缓存管理服务器查询缓存数据。
参照图1所示的系统结构,查询缓存数据的具体流程,如下:
2081、SaaS应用服务器的发送查询请求给租户缓存读写API,用于查询缓存数据,如用户下订单需要查询当前登录用户缓存数据项中的手机号发送的订单号,缓存数据项在租户缓存分区中存储的标识为“loginedUser”。
2082、租户缓存读写API根据业务请求租户标识huawei,请求查询标识为”loginedUser”的缓存数据,查询请求信息如{“tenant”:”huawei”,”cacheKey”:”loginedUser”}。
2083、租户缓存读写API发送租户标识huawei请求租户缓存分区器查询为huawei分配的分区,如查询得到的标识为phuawei的缓存分区。
2084、租户缓存读写API发送租户标识、查询缓存数据标识从所述缓存分区查询缓存数据,如查询缓存数据为:
“{name:test,mobile:1803545451}}”
2085、租户缓存读写API返回缓存数据查询结果。
2086、租户缓存读写API通知缓存分区监控器缓存命中结果。
缓存命中结果依缓存读取结果来确定:缓存读取为空则为未命中,否则命中。
2087、租户缓存分区监控器记录租户缓存分区缓存查询命中结果,如
Figure PCTCN2018073851-appb-000018
…//下面是历史记录的一个举例
Figure PCTCN2018073851-appb-000019
209、租户缓存分区监控器通知租户缓存分区调节器根据租户缓存分区查询命中率及租户缓存分区收益,在线实时调整租户缓存分区的缓存量。
210、租户缓存分区调节器记录租户缓存分区的调整类型、调整量、调整时间。
这里调整类型包括:增大缓存量或者减小缓存量。
211、租户缓存分区调节器更新租户缓存分区器记录的租户的缓存分区的缓存量为调整后的值,如租户huawei的记录模型中缓存分区的缓存量如下表1所示:
表1
租户标识T 缓存分区标识 缓存分区大小
huawei P1 1.5M
212、返回查询到缓存数据。
213、返回业务处理结果。
在前述实施了中,步骤209在以下实施例中进行说明,该步骤需要解决三个方面的问题:1、是如何预测调整缓存分区的缓存量之后,缓存收益的变化量到底有多少问题;2、如何确定调整量的问题;3、在确定调整量以及变化量以后,具体如何调整的问题;基于以上三个问题,本实施例说明如下:
一、调整缓存分区的缓存量之后,预测缓存收益的变化量具体如下:
步骤A、租户缓存分区调节器查询所有监控记录的请求。
监控记录的请求如:
Figure PCTCN2018073851-appb-000020
Figure PCTCN2018073851-appb-000021
租户的缓存分区的监控记录的具体数据,如:
Figure PCTCN2018073851-appb-000022
步骤B、租户缓存分区调节器读取所有租户SLA模型,如:
Figure PCTCN2018073851-appb-000023
Figure PCTCN2018073851-appb-000024
步骤C、租户缓存分区调节器分析上述监控记录的请求以及监控记录的具体数据,并结合上述租户SLA模型,建立包含缓存分区调整量、缓存分区大小、缓存分区使用大小、用户量以及缓存分区命中率关联关系拟合函数。其中的缓存分区的调整量简称为调整量、缓存分区大小即缓存分区的缓存量、缓存分区使用大小即缓存分区的使用量、用户量即为租户在线用户数,其中SLA中会指定最大在线用户数,缓存分区命中率即为缓存分区的缓存命中率。上述拟合函数用于预测租户缓存分区按调整量调整后的缓存命中率,如本实施例提出租户缓存分区缓存命中率预测函数表达式为:
Figure PCTCN2018073851-appb-000025
其中,Hiti’为第i个租户的缓存分区的缓存量调整后,预测到的缓存命中率的值;
Ni为第i个租户SLA中定义的在线用户量(即最大在线用户数),读取租户SLA获取每个租户的在线用户数nuser的值,如租户huawei的N=100
hit Lasti为第i个租户的最近一次调其整缓存分区的缓存量后的命中率;该值具体可以是通过如下方式获得:分析租户缓存分区的监控记录,统计最近一次租户缓存分区的调整时间区间内,缓存分区的缓存命中率。例如:租户huawei的统计区间中,最近一次调整缓存分区的起始时间为R(last).time=2016-10-22 10:21:34.321,结束时间为当前系统时间System.currentTime;那么上述最近一次租户缓存分区的调整时间区间,为R(last).time到System.currentTime的时间段。上述缓存命中率的计算方式可以是:缓存分区的监控记录中hit:”Yes”的记录数/总记录数,例如计算得到的结果为:hitLast=90%。
Pi为第i个租户的缓存分区当前缓存大小的值,读取租户缓存分区监控记录中totalSize的值,如租户huawei的值为12M。
Ui为第i个租户的缓存分区当前实际使用的缓存大小的值。
读取租户缓存分区监控历史记录集中usedSize的值,如租户huawei的值为11M。
△M为缓存分区的调整量,假定预设置调整量的值为0.5M。调整缓存分区的缓存量会引起租户缓存分区缓存命中率的提高或降低,通过动态持续调整租户的缓存分区的缓存量来持续提高每个租户缓存分区的缓存命中率,从而提升缓存整体命中率,最大化缓存收益。
同时,租户缓存分区大小和租户缓存分区命中率之间,即:缓存量与缓存命中率之间,具有如下关联特征,如图3所示:
租户不同、缓存分区大小不同,调整相同量的缓存大小带来缓存分区命中率的变化差别很大;如租户huawei A和A’两处相比较,A处缓存收益比较高,应以较大调整值调整缓存分区大小,A’处缓存收益比低,调整方式应以每次较小的调整值通过多次来调整缓存分区大小,使更多的缓存资源被调配给收益比大的调整点,提高缓存收益;租户tenant1B处相对租户huawei A处的缓存收益比较低,同样每次调整其缓存分区应以比租户huawei的调整值小的方式调整租户tenant1缓存分区,调配更多的缓存资源给缓存收益比大的租户huawei;通过结合每个租户的缓存分区使用特征,实现多租户、多阶段精细化调配缓存资,进一步提升缓存资源整体利用率和缓存命中率,最大化缓存收益。
二、本实施还提供了确定调整量的具体实现方案:
实现精细化调整缓存分区大小的关键是评估计算每次调整量的值。
本实施例进一步包含结合缓存分区的缓存量的历史调整记录、缓存分区的监控记录的监控数据、请求监控的历史记录、租户SLA模型,动态地计算面向租户的缓存分区的调整量,即调优的△M’,对应到图1所示系统,租户缓存分区调整器调整缓存分区的缓存量之前执行以下方法进一步计算得到调优的调整量,包括如下步骤:
步骤A、读取缓存调整的历史记录、缓存分区的监控记录的具体数据、租户业务请求的监控记录、租户SLA模型;
其中,缓存调整的历史记录如:
Figure PCTCN2018073851-appb-000026
步骤B、计算调优值△M’:以租户最近一次调整缓存分区时间为开始时间,计算出租户业务请求的监控记录,业务请求接收时间大于上述开始时间的业务请求的监控记录,并统计求解每次业务请求的平均响应时长(所有业务请求响应时长的和/业务请求的次数),并从业务请求的监控记录中读取租户在线用户数。
步骤B1、当租户业务请求的平均响应时长<=租户SLA模型中定义的请求响应时长,并 且记录的拒绝用户数为0,则满足租户SLA,此时可以确定△M’=0。
步骤B2、当租户的业务请求的平均响应时长>租户SLA模型中定义的请求响应时长,则不满足租户SLA,计算调优的值方法包括:
步骤B3、根据从监控记录中读取租户最近2次缓存分区的调整记录{R(last),R(last-1)},例如:租户huawei对应的缓存分区最近两次的调整记录为:
{{time:2016-10-22 10:21:34.321,value:4m},{time:2016-10-22 10:18:33.321,value:2.5}};
最近一次租户缓存分区调整的调整量△Mlast,如租户huawei最近一次调整值为4M。
步骤B4、计算最近2次缓存分区的缓存量调整时间区间内的缓存命中率。
分析租户缓存分区的监控记录,统计最近一次租户缓存分区的缓存量调整时间区间内的缓存分区的缓存命中率。例如:前述缓存调整的历史记录中,第一项,即最近一次调整缓存分区的记录为{time:2016-10-22 10:21:34.321,value:4m},表示租户huawei的统计区间中,最近一次调整缓存分区的起始时间为R(last).time=2016-10-22 10:21:34.321,结束时间为当前系统时间System.currentTime。前述缓存调整的历史记录中,第二项,即最近一次之前一次调整缓存分区的记录为:{time:2016-10-22 10:18:33.321,value:2.5m},表示租户huawei的统计区间中,最近一次之前一次的调整区间的起始时间为(R(last-1).time=2016-10-2210:18:33.321,结束时间为R(last).time=2016-10-22 10:21:34.321。例如缓存命中率分别为:hitLast=90%,hitlast-1=75%。
步骤B5、计算每个租户缓存分区的缓存利用率。
读取每个租户的缓存分区的缓存量和已使用的缓存量,计算每个租户的缓存分区缓存利用率U。缓存利用U的计算方式为:(已使用的缓存量/缓存分区的缓存量)*100%,例如:在前述示例中租户huawei记录中记录了,缓存分区的缓存量为“totalSize”:”12m”,已使用的缓存量“usedSize”:”11m”,,那么缓存利用率U为(11/12)*100%=91.7%。
步骤B6、读取租户SLA获取每个租户的在线用户数。
在前述举例中在线用户数为nuser的值N,如租户huawei的N=100。
步骤B7、根据以上数据计算调优的调整量△M’,如计算表达式为:
Figure PCTCN2018073851-appb-000027
其中,M’为调优后的租户i的缓存分区的调整量;在hitLasti-hitLast-1i>0时,调大租户缓存分区大小,分配更多的缓存资源;hitLasti-hitLast-1i<0时,调小租户缓存分区大小,释放缓存资源。
ΔM lasti为租户i最近一次缓存分区调整的值,如租户huawei的值为4m;当租户最近一次缓存分区调整值为0,即ΔM lasti=0时,按时间降序遍历租户调整分区记录集,当记录的调整值△M≠0时停止遍历,并设置ΔM lasti=△M。
hit Lasti为租户i最近一次缓存分区调整后的缓存命中率,例如:前述举例中租户huawei的值为90%。
hit Lasti-1为租户i最近一次之前一次调整缓存分区后的缓存命中率,例如:前述举例中 租户huawei的值为75%。
Ni为租户i的SLA中定义的在线用户数,即:允许租户的最大在线用户数,例如:租户huawei的值为100。
Ui为租户i的缓存分区当前缓存利用率,例如:租户huawei的值为91.7%。
如租户huawei根据上述公式计算的较优后缓存的调整量的值应为7M。
步骤C、缓存分区调整器再次被触发调整租户缓存分区时,基于上述预测租户缓存命中率的公式,预测所有租户调整后的缓存命中率,并计算缓存分区的调整量△M与缓存分区的缓存命中率变化值△hit的收益比|△hit/△M|,如下表2所示:
表2
Figure PCTCN2018073851-appb-000028
三、选择需要调整的缓存分区,以及具体如何调整。本实施例可以在前述两个方面的参数已经准备好后执行,即在确定调整量以及收益变化量以后执行。
结合图1所示的系统结构,租户缓存分区调整器基于上述收益比、SLA模型以及监测信息,并基于SaaS服务商收益最大化调整租户缓存分区,具体流程如下:
步骤A、识别满足SLA的租户作为队列S1,识别响应时间和在线用户量不满足SLA的租户作为队列S2。
步骤B、假定调整量>0:
步骤B1、如果多租户共享缓存的空闲资源>=调整量:
如果队列S2为空,则可以分配调整量的缓存空间给收益比最大租户,从而最大化整体缓存命中率。假定收益比最大的租户为huawei,那么将从空闲的共享缓存中分配缓存给租户huawei的缓存分区。
如果队列S2不为空,那么可以分配缓存给惩罚因子大,命中率可提升最大的租户,最小化服务提供商损失。
步骤B2、如果多租户共享缓存的空闲资源<调整量:
这种情况下需要释放一部分已经被分配给缓存分区的缓存成为空闲资源,具体可以是:根据缓存分区的监控记录计算每个租户的缓存利用率,识别缓存利用率低、缓存命中率收益少、惩罚因子小的租户,释放缓存然后再分配给缓存收益比与惩罚因子最大的租户的缓存分区。
步骤C,假定调整量<0,可以请求缓存分区读写API释放缓存空间,作为空闲空间分配给其他租户的缓存分区。
上述详细阐述了本申请实施例的方法,下面提供了本申请实施例的装置。
请参见图4,图4是本申请实施例提供的一种缓存分配装置的结构示意图,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分 区为目标缓存分区,该缓存分配装置可以包括数据获取单元以及缓存调整单元,其中,各个单元的详细描述如下。
数据获取单元401,用于获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;
缓存调整单元402,用于分析所述监控记录在确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述所述第一缓存量调整为第二缓存量。
本实施例可以参考前述方法实施例,以及发明内容中关于方法实施例的介绍,在此不再一一赘述,在本实施例之后的装置实施例中,也可以一并参考方法实施例的内容。在本实施例中,数据获取单元401可以对应到系统结构图1中的请求监控器和租户缓存分区监控器的功能;缓存调整单元402可以对应到系统结构图1中的租户缓存分区调整器。
通过实施本申请实施例,由于监控记录包含调整量与缓存收益变化的对应关系,通过租户的监控记录,则可以预测调整缓存分区的缓存量将会获得的缓存收益,那么可以基于缓存收益目标来选择调整哪一个缓存分区,以及,是调大还是调小该缓存分区的缓存量,从而获得更高的缓存收益,相应地提高缓存共享利用率。
在一个可选的实现方式中,本申请实施例还提供了为目标缓存分区分配新的缓存以及从目标缓存分区中释放缓存的具体实现方案,如下:
所述缓存调整单元402,用于在第一缓存收益变化量大于第二缓存收益变化量,且空闲的共享缓存的缓存量大于调整量的情况下,从所述空闲的共享缓存中分配所述调整量大小的缓存到所述目标缓存分区;所述第一缓存收益变化量对应所述目标缓存分区,所述第二缓存收益变化量对应所述所述至少两个租户中其他租户的缓存分区;
或者,在第三缓存收益变化量小于第四缓存收益变化量,且所述空闲的共享缓存的缓存量小于所述调整量的情况下,从所述目标缓存分区中释放缓存;所述第三缓存收益变化量对应所述目标缓存分区,所述第四缓存收益变化量对应所述至少两个租户中其他租户的缓存分区的缓存量。
在一个可选的实现方式中,还提供了缓存收益的可选内容,具体如下:所述缓存收益包括:
服务质量收益,或,因所述服务质量收益导致的服务等级协议的收益。
在一个可选的实现方式中,还提供了服务质量收益以及因所述服务质量收益导致的所述服务等级协议的收益的具体举例,如下:
所述服务质量收益包括:缓存命中率的收益和/或读缓存响应时间的收益;
所述因所述服务质量收益导致的所述服务等级协议的收益包括:因所述服务质量变化导致受所述服务等级协议的惩罚的收益。
在一个可选的实现方式中,如图4所示,所述缓存分配装置还包括:
请求接收单元403,用于接收所述目标租户的开户请求;
数据记录单元404,用于记录所述目标租户的开户数据;所述开户数据包括服务等级协议;
分区创建单元405,用于为所述目标租户创建所述目标缓存分区。
在一个可选的实现方式中,还提供了分析监控记录的具体实现方案如下:所述缓存调整单元402包括:
分析子单元4021,用于使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录。
基于前述实施例中分析监控记录所使用的拟合函数,本实施例进一步进行细化该拟合函数的内容,如下:17、根据权利要求16所述缓存分配装置,
所述分析子单元4021,用于使用如下公式计算缓存命中率:
Figure PCTCN2018073851-appb-000029
其中,所述目标租户为第i个租户,所述Hiti’为所述第i个租户的缓存命中率,所述Ni为所述第i个租户在服务等级协议中指定的在线用户数;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率;所述Pi为所述第i个租户的缓存分区的缓存量;所述Ui为所述第i个租户的缓存分区实际使用的缓存量;所述ΔM为所述第i个租户的缓存分区的调整量。
在一个可选的实现方式中,还提供了计算调整量的方式,所述缓存调整单元402包括:
计算子单元4022,用于使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量。
基于前述实施例中计算调整量的实现方案,本实施例还进一步细化了计算所使用的公式如下:所述计算子单元4022,用于使用如下公式计算所述目标缓存分区的调整量:
Figure PCTCN2018073851-appb-000030
其中,所述ΔM为所述第i个租户的缓存分区的调整量;所述ΔM lasti为所述第i个租户最近一次缓存分区调整的缓存量;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率,所述hit Lasti-1为最近一次缓存分区调整前的缓存命中率;所述Ni为所述第i个租户的服务等级协议中指定的在线用户数,所述Ui为所述第i个租户缓存分区的缓存利用率,所述archtan为正切自回归条件异方差模型,所述sin为正弦,所述
Figure PCTCN2018073851-appb-000031
为所有租户的缓存分区的总缓存量。
在一个可选的实现方式中,为了进一步减少可能不必要的计算量,本申请实施例筛选出不需要进行缓存分区的缓存量调整的情况,具体如下:所述缓存调整单元402,还用于在确定所述目标租户内用户的平均读缓存响应时间小于或等于所述目标租户的服务等级协议指定的读缓存响应时间,并且所述目标租户的在线用户数小于或等于所述服务等级协议指定的在线用户数,则确定所述目标缓存分区的调整量为0。
请参见图5,图5是本申请实施例提供的一种缓存分配装置,该缓存分配装置包括:缓存501、处理器502以及输入输出设备503;其中,缓存501可以包含在存储器中也可以集成在处理器502中,在缓存501内包含租户的缓存分区;在上述存储器中可以存储有可执行代码,所述处理器502具有读取上述执行可执行代码或者以硬件形式来实现本申请实施例提供的方法的功能。在本实施例中方法的功能在此不再赘述。缓存501、处理器502以及输入输出设备503可以通过总线相互连接。
如果缓存包含在存储器中,那么存储器包括但不限于是随机存储记忆体(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、或便携式只读存储器(Compact Disc Read-Only Memory,CD-ROM),该存储器可以用于存储相关指令及数据。输入输出设备503用于接收和发送数据。
处理器502可以是一个或多个中央处理器(Central Processing Unit,CPU),在处理器502是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。
可以理解的是,如果由处理器502完成以上全部方法流程,那么处理器502可以实现图1所示系统中读写监控器、租户缓存分区监控器、租户缓存分区调整器以及租户缓存分区器的功能。
图6是本申请实施例提供的一种服务器结构示意图,该服务器600可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)622(例如,一个或一个以上处理器)和存储器632,一个或一个以上存储应用程序642或数据644的存储介质630(例如一个或一个以上海量存储设备),缓存空间以及基于缓存空间的缓存分区可以集成在存储器632。其中,存储器632和存储介质630可以是短暂存储或持久存储。存储在存储介质630的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更进一步地,中央处理器622可以设置为与存储介质630通信,在服务器600上执行存储介质630中的一系列指令操作。
服务器600还可以包括一个或一个以上电源626,一个或一个以上有线或无线网络接口650,一个或一个以上输入输出接口658,和/或,一个或一个以上操作系统641,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
上述实施例中由缓存分配装置所执行的步骤可以基于该图6所示的服务器结构。该服务器可以对应到图1所示系统结构的SaaS应用服务器以及缓存管理服务器的功能。
需要说明的是,各个操作的实现可以对应到前述实施例的的相应描述,因此在本实施例中未予赘述。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (20)

  1. 一种缓存分配方法,其特征在于,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分区为目标缓存分区,所述方法包括:
    获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;
    分析所述监控记录,在确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述所述第一缓存量调整为第二缓存量。
  2. 根据权利要求1所述方法,其特征在于,所述确定将所述第一缓存量调整为第二缓存量符合缓存收益目标的情况下,将所述第一缓存量调整为第二缓存量包括:
    在第一缓存收益变化量大于第二缓存收益变化量,且空闲的共享缓存的缓存量大于调整量的情况下,从所述空闲的共享缓存中分配所述调整量大小的缓存到所述目标缓存分区;所述第一缓存收益变化量对应所述目标缓存分区,所述第二缓存收益变化量对应所述所述至少两个租户中其他租户的缓存分区;
    或者,在第三缓存收益变化量小于第四缓存收益变化量,且所述空闲的共享缓存的缓存量小于所述调整量的情况下,从所述目标缓存分区中释放缓存;所述第三缓存收益变化量对应所述目标缓存分区,所述第四缓存收益变化量对应所述至少两个租户中其他租户的缓存分区的缓存量。
  3. 根据权利要求1或2所述方法,其特征在于,所述缓存收益包括:
    服务质量收益,或,因所述服务质量收益导致的服务等级协议的收益。
  4. 根据权利要求3所述方法,其特征在于,
    所述服务质量收益包括:缓存命中率的收益和/或读缓存响应时间的收益;
    所述因所述服务质量收益导致的所述服务等级协议的收益包括:因所述服务质量变化导致受所述服务等级协议的惩罚的收益。
  5. 根据权利要求4所述方法,其特征在于,在所述获取第一缓存量之前,所述方法还包括:
    接收所述目标租户的开户请求,记录所述目标租户的开户数据,为所述目标租户创建所述目标缓存分区;所述开户数据包括服务等级协议。
  6. 根据权利要求1至5任意一项所述方法,其特征在于,所述分析所述监控记录包括:
    使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录。
  7. 根据权利要求6所述方法,其特征在于,所述使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录包括:
    使用如下公式计算缓存命中率:
    Figure PCTCN2018073851-appb-100001
    其中,所述目标租户为第i个租户,所述Hiti’为所述第i个租户的缓存命中率,所述Ni为所述第i个租户在服务等级协议中指定的在线用户数;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率;所述Pi为所述第i个租户的缓存分区的缓存量;所述Ui为所述第i个租户的缓存分区实际使用的缓存量;所述ΔM为所述第i个租户的缓存分区的调整量。
  8. 根据权利要求1至7任意一项所述方法,其特征在于,所述方法还包括:
    使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量。
  9. 根据权利要求8所述方法,其特征在于,所述使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量包括:
    使用如下公式计算所述目标缓存分区的调整量:
    Figure PCTCN2018073851-appb-100002
    其中,所述ΔM为所述第i个租户的缓存分区的调整量;所述ΔM lasti为所述第i个租户最近一次缓存分区调整的缓存量;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率,所述hit Lasti-1为最近一次缓存分区调整前的缓存命中率;所述Ni为所述第i个租户的服务等级协议中指定的在线用户数,所述Ui为所述第i个租户缓存分区的缓存利用率,所述archtan为正切自回归条件异方差模型,所述sin为正弦,所述
    Figure PCTCN2018073851-appb-100003
    为所有租户的缓存分区的总缓存量。
  10. 根据权利要求9所述方法,其特征在于,在计算所述目标缓存分区的调整量之前,所述方法还包括:
    在确定所述目标租户内用户的平均读缓存响应时间小于或等于所述目标租户的服务等级协议指定的读缓存响应时间,并且所述目标租户的在线用户数小于或等于所述服务等级协议指定的在线用户数,则确定所述目标缓存分区的调整量为0。
  11. 一种缓存分配装置,其特征在于,应用于包含至少两个租户的软件即服务SaaS,所述至少两个租户包括目标租户,所述目标租户的缓存分区为目标缓存分区,所述缓存分配装置包括:
    数据获取单元,用于获取第一缓存量,以及所述目标租户的监控记录;所述监控记录包含调整量与缓存收益变化的对应关系;所述第一缓存量为所述目标缓存分区当前的缓存量;
    缓存调整单元,用于分析所述监控记录在确定将所述第一缓存量调整为第二缓存量符合 缓存收益目标的情况下,将所述所述第一缓存量调整为第二缓存量。
  12. 根据权利要求11所述缓存分配装置,其特征在于,
    所述缓存调整单元,用于在第一缓存收益变化量大于第二缓存收益变化量,且空闲的共享缓存的缓存量大于调整量的情况下,从所述空闲的共享缓存中分配所述调整量大小的缓存到所述目标缓存分区;所述第一缓存收益变化量对应所述目标缓存分区,所述第二缓存收益变化量对应所述所述至少两个租户中其他租户的缓存分区;
    或者,在第三缓存收益变化量小于第四缓存收益变化量,且所述空闲的共享缓存的缓存量小于所述调整量的情况下,从所述目标缓存分区中释放缓存;所述第三缓存收益变化量对应所述目标缓存分区,所述第四缓存收益变化量对应所述至少两个租户中其他租户的缓存分区的缓存量。
  13. 根据权利要求11或12所述缓存分配装置,其特征在于,所述缓存收益包括:
    服务质量收益,或,因所述服务质量收益导致的服务等级协议的收益。
  14. 根据权利要求13所述缓存分配装置,其特征在于,
    所述服务质量收益包括:缓存命中率的收益和/或读缓存响应时间的收益;
    所述因所述服务质量收益导致的所述服务等级协议的收益包括:因所述服务质量变化导致受所述服务等级协议的惩罚的收益。
  15. 根据权利要求14所述缓存分配装置,其特征在于,所述缓存分配装置还包括:
    请求接收单元,用于接收所述目标租户的开户请求;
    数据记录单元,用于记录所述目标租户的开户数据;
    分区创建单元,用于为所述目标租户创建所述目标缓存分区;所述开户数据包括服务等级协议。
  16. 根据权利要求11至15任意一项所述缓存分配装置,其特征在于,所述缓存调整单元包括:
    分析子单元,用于使用包含所述目标缓存分区的调整量、所述目标缓存分区的缓存量、所述目标缓存分区的使用量,所述租户的在线用户数以及所述目标缓存分区的缓存命中率的拟合函数分析所述监控记录。
  17. 根据权利要求16所述缓存分配装置,其特征在于,
    所述分析子单元,用于使用如下公式计算缓存命中率:
    Figure PCTCN2018073851-appb-100004
    其中,所述目标租户为第i个租户,所述Hiti’为所述第i个租户的缓存命中率,所述Ni为所述第i个租户在服务等级协议中指定的在线用户数;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率;所述Pi为所述第i个租户的缓存分区的缓存量;所述Ui为所述第i个租户的缓存分区实际使用的缓存量;所述ΔM为所述第i个租户的缓存分区的 调整量。
  18. 根据权利要求11至17任意一项所述缓存分配装置,其特征在于,所述缓存调整单元包括:
    计算子单元,用于使用包含所述目标缓存分区最近一次的调整量、最近一次调整后的缓存命中率、最近一次调整前的缓存命中率、所述住户的在线用户数、所述目标缓存分区的缓存利用率,以及所有租户的总缓存量计算所述目标缓存分区的调整量。
  19. 根据权利要求18所述缓存分配装置,其特征在于,
    所述计算子单元,用于使用如下公式计算所述目标缓存分区的调整量:
    Figure PCTCN2018073851-appb-100005
    其中,所述ΔM为所述第i个租户的缓存分区的调整量;所述ΔM lasti为所述第i个租户最近一次缓存分区调整的缓存量;所述hit Lasti为所述第i个租户最近一次调整缓存分区后的缓存命中率,所述hit Lasti-1为最近一次缓存分区调整前的缓存命中率;所述Ni为所述第i个租户的服务等级协议中指定的在线用户数,所述Ui为所述第i个租户缓存分区的缓存利用率,所述archtan为正切自回归条件异方差模型,所述sin为正弦,所述
    Figure PCTCN2018073851-appb-100006
    为所有租户的缓存分区的总缓存量。
  20. 根据权利要求19所述缓存分配装置,其特征在于,
    所述缓存调整单元,还用于在确定所述目标租户内用户的平均读缓存响应时间小于或等于所述目标租户的服务等级协议指定的读缓存响应时间,并且所述目标租户的在线用户数小于或等于所述服务等级协议指定的在线用户数,则确定所述目标缓存分区的调整量为0。
PCT/CN2018/073851 2017-03-17 2018-01-23 一种缓存分配方法,及设备 WO2018166297A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/566,431 US20200012602A1 (en) 2017-03-17 2019-09-10 Cache allocation method, and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710161725.2 2017-03-17
CN201710161725.2A CN108628769A (zh) 2017-03-17 2017-03-17 一种缓存分配方法,及设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/566,431 Continuation US20200012602A1 (en) 2017-03-17 2019-09-10 Cache allocation method, and apparatus

Publications (1)

Publication Number Publication Date
WO2018166297A1 true WO2018166297A1 (zh) 2018-09-20

Family

ID=63521772

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/073851 WO2018166297A1 (zh) 2017-03-17 2018-01-23 一种缓存分配方法,及设备

Country Status (3)

Country Link
US (1) US20200012602A1 (zh)
CN (1) CN108628769A (zh)
WO (1) WO2018166297A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10642668B2 (en) 2018-04-18 2020-05-05 Open Text GXS ULC Producer-side prioritization of message processing
US11055128B2 (en) * 2018-07-30 2021-07-06 Open Text GXS ULC System and method for request isolation
US10884959B2 (en) * 2019-02-13 2021-01-05 Google Llc Way partitioning for a system-level cache
US11520767B2 (en) * 2020-08-25 2022-12-06 Servicenow, Inc. Automated database cache resizing
CN112417350B (zh) * 2020-09-17 2023-03-24 上海哔哩哔哩科技有限公司 数据存储调整方法、装置及计算机设备
US11762770B2 (en) * 2020-10-22 2023-09-19 EMC IP Holding Company LLC Cache memory management
US12001705B2 (en) * 2021-05-26 2024-06-04 Arm Limited Memory transaction parameter settings
US11934672B2 (en) 2021-08-26 2024-03-19 International Business Machines Corporation Cached workload management for a multi-tenant host
CN116132705B (zh) * 2023-04-17 2023-06-09 北京盘腾科技有限公司 一种直播缓存量的调节方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101652787A (zh) * 2007-03-30 2010-02-17 微软公司 共享可定制多租户数据的存储器中高速缓存
CN104252454A (zh) * 2013-06-25 2014-12-31 广州中国科学院软件应用技术研究所 一种面向云计算多租户模式的数据权限控制方法和系统
CN104679886A (zh) * 2015-03-17 2015-06-03 浪潮集团有限公司 一种多租户模式下Hive数据隔离的方法和装置
CN105357296A (zh) * 2015-10-30 2016-02-24 河海大学 一种Docker云平台下弹性缓存系统
CN106453665A (zh) * 2016-12-16 2017-02-22 东软集团股份有限公司 基于分布式缓存系统的数据缓存方法、服务器和系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101652787A (zh) * 2007-03-30 2010-02-17 微软公司 共享可定制多租户数据的存储器中高速缓存
CN104252454A (zh) * 2013-06-25 2014-12-31 广州中国科学院软件应用技术研究所 一种面向云计算多租户模式的数据权限控制方法和系统
CN104679886A (zh) * 2015-03-17 2015-06-03 浪潮集团有限公司 一种多租户模式下Hive数据隔离的方法和装置
CN105357296A (zh) * 2015-10-30 2016-02-24 河海大学 一种Docker云平台下弹性缓存系统
CN106453665A (zh) * 2016-12-16 2017-02-22 东软集团股份有限公司 基于分布式缓存系统的数据缓存方法、服务器和系统

Also Published As

Publication number Publication date
US20200012602A1 (en) 2020-01-09
CN108628769A (zh) 2018-10-09

Similar Documents

Publication Publication Date Title
WO2018166297A1 (zh) 一种缓存分配方法,及设备
CN107329837B (zh) 一种负载均衡的方法和单元、分布式NewSQL数据库系统
US9311376B2 (en) Performance service level agreements in multi-tenant database systems
Fu et al. DRS: Auto-scaling for real-time stream analytics
JP7511477B2 (ja) データクエリ方法、装置、およびデバイス
Villela et al. Provisioning servers in the application tier for e-commerce systems
WO2016188099A1 (zh) 基于账户活跃度的系统资源分配方法及装置
US7849180B2 (en) Load balanced storage provisioning
CN110109953A (zh) 一种数据查询方法、装置及设备
JP2020173778A (ja) リソースの割り当て方法、装置、電子設備、コンピュータ可読媒体およびコンピュータプログラム
JP2018517201A (ja) 仮想マシンのためのネイティブなストレージサービス品質
JP2012181580A (ja) リソース制御装置、リソース制御方法、及びリソース制御プログラム
US11461300B2 (en) Dynamic model server for multi-model machine learning inference services
US20190310900A1 (en) System, method, and computer-readable medium for allocating digital data processing system resources
US9817698B2 (en) Scheduling execution requests to allow partial results
CN111737168A (zh) 一种缓存系统、缓存处理方法、装置、设备及介质
WO2024094104A1 (zh) 一种动态反馈加权云存储资源调度方法、装置及设备
JP7192645B2 (ja) 情報処理装置、分散処理システム及び分散処理プログラム
WO2016078388A1 (zh) 一种数据老化方法及装置
CN113079062A (zh) 一种资源调整方法、装置、计算机设备和存储介质
JPWO2016092604A1 (ja) データ処理システムおよびデータアクセス方法
CN109451008B (zh) 一种云平台下多租户的带宽保障框架和成本优化方法
CN109905333B (zh) 一种媒体信息处理方法、装置及存储介质
CN109005071A (zh) 一种决策部署方法和调度设备
CN114444853A (zh) 一种性能控制方法、装置及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18767232

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18767232

Country of ref document: EP

Kind code of ref document: A1