Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method and system for concurrent processing of API request

A task processing and task technology, applied in the field of network communication, can solve the problem of not being able to realize API requests at the same time

Active Publication Date: 2018-05-29
北京云杉世纪网络科技有限公司
View PDF6 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] In order to overcome the above-mentioned problem that the high-concurrency processing and order-preserving processing of API requests cannot be realized at the same time, or at least partially solve the above-mentioned problems, the present invention provides a method and system for concurrently processing API requests

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and system for concurrent processing of API request
  • Method and system for concurrent processing of API request

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0045] The specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0046] In one embodiment of the present invention, a method for concurrently processing API requests is provided, figure 1 It is a schematic diagram of the overall flow of the method for concurrently processing API requests provided by the embodiment of the present invention. The method includes: S1. If the current task corresponding to the current API request includes I / O operations, use the current service coroutine to generate the first task of the current task. A triple, the current service coroutine is pre-created in the main thread for the current API request; S2, when the asynchronous waiting time of the current service coroutine reaches a preset duration, the main ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a method and system for concurrent processing of an API request. The method comprises the steps that S1, if a current task corresponding to the current API request comprises anI / O operation, a first triad of the current task is generated by using a current service co-routine; S2, when the asynchronous waiting time of the current service co-routine reaches preset duration, the scheduling logic of a main thread is switched to other service co-routines meeting preset conditions, and second triads generated by the other service co-routines are acquired; S3, according to theorder-preserving identifier of the current task in the first triad and order-preserving identifiers of other tasks in the second triads, the current task and the other tasks are distributed to a waiting queue by using a scheduling thread; S4, the current task and other tasks are processed by using a task processing thread, and processing results are stored in a request result queue of the first triad and the second triads. The method and the device achieve order-preserving high-concurrent processing of the API request.

Description

technical field [0001] The invention belongs to the technical field of network communication, and more specifically relates to a method and system for concurrently processing API requests. Background technique [0002] In order to achieve scalability, module decoupling and code reuse, large-scale software systems generally adopt a service-oriented architecture, that is, the entire software system is composed of API modules that provide various services. The original API service architecture is implemented by single process and single thread. In order to improve the concurrency capability of the service, multi-process, multi-thread or coroutine is usually used. [0003] The problem with the multi-process architecture lies in the complexity of inter-process communication, the difficulty of maintaining global resource locks, and the resource overhead caused by thread context switching. In addition, both multi-process and multi-thread architectures face the problem that they c...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/48G06F9/50
CPCG06F9/4881G06F9/5027G06F9/5038G06F2209/5011G06F2209/5018
Inventor 向阳金捷
Owner 北京云杉世纪网络科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products