CN109981757A - A kind of API gateway load-balancing algorithm towards small-scale micro services framework - Google Patents

A kind of API gateway load-balancing algorithm towards small-scale micro services framework Download PDF

Info

Publication number
CN109981757A
CN109981757A CN201910188288.2A CN201910188288A CN109981757A CN 109981757 A CN109981757 A CN 109981757A CN 201910188288 A CN201910188288 A CN 201910188288A CN 109981757 A CN109981757 A CN 109981757A
Authority
CN
China
Prior art keywords
micro services
api gateway
rear end
balancing algorithm
load
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201910188288.2A
Other languages
Chinese (zh)
Other versions
CN109981757B (en
Inventor
于震
黄伟
鞠强
魏亮
周国庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Teld New Energy Technology Co Ltd
Original Assignee
Qingdao Tgood Electric Co Ltd
Qingdao Teld New Energy Co Ltd
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 Qingdao Tgood Electric Co Ltd, Qingdao Teld New Energy Co Ltd filed Critical Qingdao Tgood Electric Co Ltd
Priority to CN201910188288.2A priority Critical patent/CN109981757B/en
Publication of CN109981757A publication Critical patent/CN109981757A/en
Application granted granted Critical
Publication of CN109981757B publication Critical patent/CN109981757B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Abstract

The invention belongs to field of cloud computer technology, are related to a kind of load-balancing algorithm.A kind of API gateway load-balancing algorithm towards small-scale micro services framework includes the following steps: that micro services identify whether to be included in API gateway routing table in (1) judgement request source;(2) it is identified according to micro services and determines its affiliated business cluster;(3) according to the qualified rear end micro services container list of business cluster information retrieval;(4) last 1 digit of Millisecond for obtaining the API gateway instant time using the remainder as the index of rear end micro services container list, elects as qualified rear end micro services container rear end micro services number of containers remainder;(5) API gateway carries micro services required parameter and initiates service call to specific rear end micro services container.API gateway load-balancing algorithm towards small-scale micro services framework of the invention, substantially increases API gateway system high-available, while succinct load-balancing algorithm is easy to implement, harmonious strong.

Description

A kind of API gateway load-balancing algorithm towards small-scale micro services framework
Technical field
The invention belongs to field of cloud computer technology, are related to a kind of load-balancing algorithm.
Background technique
Micro services framework is based on business dimension for large complicated software application as a kind of lightweight cloud computing solution Multiple micro services are split into, there is decentralization feature, realize agile development and rapid deployment.Micro services framework is in computer cloud Calculating field is more and more widely used.API service gateway would generally be built in micro services framework to be uniformly processed from each All kinds of services for really providing business operation are hidden in rear end by the request of client, this framework, can be to business operation mould Block plays the role of safeguard protection, is also convenient for flexible configuration dilatation.Since rear end micro services number of containers is numerous, in solution It will relate to how that selection specified containers provide the load-balancing algorithm of service.Universal load equalization algorithm include random, poll, Weighted polling, dynamic polling, minimum connection, most fast algorithm, observation etc..Traditional load-balancing algorithm is all based on fixed road By table, rear end micro services container must be changed when changing restarts API gateway after routing table and can just come into force.Can not provide it is continuous not between Disconnected service.And excessive preposition processing is added before load balancing, such as current limliting inspection, black and white lists, server availability inspection. Cause algorithm overweight, performance is poor.API gateway spends most of expense in preposition processing, pays close attention to the dynamic of routing table It is insufficient.
Summary of the invention
It is an object of the invention to support static, dynamic routing table, simplify reverse proxy process, focuses the negative of API gateway Carry equalization characteristic.
The present invention realize its purpose the technical solution adopted is that: a kind of API gateway towards small-scale micro services framework is negative Equalization algorithm is carried, is included the following steps:
(1) micro services identify whether to be included in API gateway routing table in judgement request source;
(2) it is identified according to micro services and determines its affiliated business cluster;
(3) according to the qualified rear end micro services container list of business cluster information retrieval;
(4) last 1 digit of Millisecond for obtaining the API gateway instant time, to rear end micro services number of containers remainder, by the remainder As the index of rear end micro services container list, elect as qualified rear end micro services container;
(5) API gateway carries micro services required parameter and initiates service call to specific rear end micro services container.
Further, the API gateway routing table includes under micro services mark and services sets group relation, each business cluster Two category information of micro services container list for including, wherein micro services information of container includes the port of IP address and opening.
It is further preferred that routing table permission is dynamically updated in the case where not restarting API gateway.
It is further preferred that due to safety concerns, avoiding micro services container by malicious attack, IP address is internal address.
It is further preferred that if the micro services of request identify not in API gateway routing table, being returned in step (1) The unavailable mistake of 403 resources gives service requester.
It is further preferred that if affiliated business cluster is not present, returning to the unavailable mistake of 403 resources in step (2) To service requester.
It is further preferred that in step (3), if returning to 403 resources without qualified rear end micro services container Unavailable mistake gives service call side.
Compared with traditional load-balancing algorithm, the API gateway load of the invention towards small-scale micro services framework is equal Method is accounted, beneficial effect is:
1, API gateway routing table supports dynamic to update, and can come into force under the premise of not restarting API gateway, and it is available to improve system Property;
2, it is based on each micro services container of business cluster management;
3, it is not placed on API gateway level for inspections such as the control of micro services container flow, Resource Availability, health status, rejects Various complicated factors are absorbed in equilibrium in itself so that load-balancing algorithm itself is succinct efficiently, reduction overhead, at raising Manage efficiency;
4, harmonious strong.
API gateway load-balancing algorithm towards small-scale micro services framework of the invention, substantially increases API gateway system System high availability, while succinct load-balancing algorithm is easy to implement, balanced type is strong.
Detailed description of the invention
Fig. 1 is the API gateway load-balancing algorithm flow chart towards small-scale micro services framework of the embodiment of the present invention.
Specific embodiment
Below using the Nginx Reverse Proxy of mainstream as API gateway illustrated using example it is of the invention detailed Thin technical solution and feature and advantage.
1, static routing table information is configured on Nginx or the management services module of dynamic routing table update is supported in deployment;
2, route service module of the deployment comprising load-balancing algorithm of the present invention realization process on Nginx;
3, client initiates micro services request to API gateway, wherein being GetOrders comprising micro services identification information;
4, API gateway checks that micro services mark GetOrder exists from micro services routing table, and retrieves the business belonging to it Group type is Order;
5, API gateway is micro- according to qualified rear end is retrieved from container routing table according to business group type mark Order Service container list obtains 3 qualified micro services containers;
6, API gateway obtains the instant time as 2018-11-22 10:05:04:135, the last one digit number 7 of its millisecond is obtained, to appearance 3 remainder of device quantity obtains 1, obtains micro services container 2(index from the micro services container list of rear end as index for 1 and opens from 0 Begin);
7, API gateway carries client request parameter and initiates service request to micro services container 2;
8, micro services container 2 returns to request results to API gateway, and ApI gateway feeds back to client.

Claims (7)

1. a kind of API gateway load-balancing algorithm towards small-scale micro services framework, characterized by the following steps:
(1) micro services identify whether to be included in API gateway routing table in judgement request source;
(2) it is identified according to micro services and determines its affiliated business cluster;
(3) according to the qualified rear end micro services container list of business cluster information retrieval;
(4) last 1 digit of Millisecond for obtaining the API gateway instant time, to rear end micro services number of containers remainder, by the remainder As the index of rear end micro services container list, elect as qualified rear end micro services container;
(5) API gateway carries micro services required parameter and initiates service call to specific rear end micro services container.
2. the API gateway load-balancing algorithm according to claim 1 towards small-scale micro services framework, feature exist In: the API gateway routing table includes that the micro services for including are held under micro services mark and services sets group relation, each business cluster Two category information of device list, wherein micro services information of container includes the port of IP address and opening.
3. the API gateway load-balancing algorithm according to claim 2 towards small-scale micro services framework, feature exist In: IP address is internal address.
4. the API gateway load-balancing algorithm according to claim 1-3 towards small-scale micro services framework, Be characterized in that: routing table permission is dynamically updated in the case where not restarting API gateway, but routing table supports dynamic to update non-calculation The precondition that method is set up.
5. the API gateway load-balancing algorithm according to claim 1-3 towards small-scale micro services framework, Be characterized in that: in step (1), if the micro services of request identify not in API gateway routing table, returning to 403 resources can not Service requester is given with mistake.
6. the API gateway load-balancing algorithm according to claim 1-3 towards small-scale micro services framework, It is characterized in that: in step (2), if affiliated business cluster is not present, returning to the unavailable mistake of 403 resources to service request Side.
7. the API gateway load-balancing algorithm according to claim 1-3 towards small-scale micro services framework, Be characterized in that: in step (3), if without qualified rear end micro services container, return the unavailable mistake of 403 resources to Service call side.
CN201910188288.2A 2019-03-13 2019-03-13 API gateway load balancing method for small-scale micro-service architecture Active CN109981757B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910188288.2A CN109981757B (en) 2019-03-13 2019-03-13 API gateway load balancing method for small-scale micro-service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910188288.2A CN109981757B (en) 2019-03-13 2019-03-13 API gateway load balancing method for small-scale micro-service architecture

Publications (2)

Publication Number Publication Date
CN109981757A true CN109981757A (en) 2019-07-05
CN109981757B CN109981757B (en) 2022-07-08

Family

ID=67078708

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910188288.2A Active CN109981757B (en) 2019-03-13 2019-03-13 API gateway load balancing method for small-scale micro-service architecture

Country Status (1)

Country Link
CN (1) CN109981757B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532101A (en) * 2019-09-03 2019-12-03 中国联合网络通信集团有限公司 The deployment system and method for micro services cluster
CN111225030A (en) * 2019-12-16 2020-06-02 航天信息股份有限公司 Method and system for selecting micro-service based on trust evaluation strategy
CN111683133A (en) * 2020-06-04 2020-09-18 重庆英楼维兴信息科技有限公司 Business current limiting method based on micro-service architecture and related device
CN112738175A (en) * 2020-12-23 2021-04-30 深圳壹账通智能科技有限公司 Request processing method and related equipment
CN113114765A (en) * 2021-04-13 2021-07-13 成都九洲电子信息系统股份有限公司 Interface calling system based on reverse proxy

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107612955A (en) * 2016-07-12 2018-01-19 深圳市远行科技股份有限公司 Micro services provide method, apparatus and system
US20180321993A1 (en) * 2017-05-08 2018-11-08 Datapipe, Inc. System and method for management of deployed services and applications
CN108965007A (en) * 2018-07-19 2018-12-07 北京车和家信息技术有限公司 API gateway interface configures update method and device
CN108989389A (en) * 2018-06-11 2018-12-11 北京航空航天大学 A method of establishing intelligent contract micro services
CN109194760A (en) * 2018-09-14 2019-01-11 深圳市佰仟金融服务有限公司 Method for processing business, network system and server
CN109218212A (en) * 2018-09-03 2019-01-15 四川长虹电器股份有限公司 Method for limiting flow through API gateway

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107612955A (en) * 2016-07-12 2018-01-19 深圳市远行科技股份有限公司 Micro services provide method, apparatus and system
US20180321993A1 (en) * 2017-05-08 2018-11-08 Datapipe, Inc. System and method for management of deployed services and applications
CN108989389A (en) * 2018-06-11 2018-12-11 北京航空航天大学 A method of establishing intelligent contract micro services
CN108965007A (en) * 2018-07-19 2018-12-07 北京车和家信息技术有限公司 API gateway interface configures update method and device
CN109218212A (en) * 2018-09-03 2019-01-15 四川长虹电器股份有限公司 Method for limiting flow through API gateway
CN109194760A (en) * 2018-09-14 2019-01-11 深圳市佰仟金融服务有限公司 Method for processing business, network system and server

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532101A (en) * 2019-09-03 2019-12-03 中国联合网络通信集团有限公司 The deployment system and method for micro services cluster
CN110532101B (en) * 2019-09-03 2022-05-03 中国联合网络通信集团有限公司 Deployment system and method of micro-service cluster
CN111225030A (en) * 2019-12-16 2020-06-02 航天信息股份有限公司 Method and system for selecting micro-service based on trust evaluation strategy
CN111683133A (en) * 2020-06-04 2020-09-18 重庆英楼维兴信息科技有限公司 Business current limiting method based on micro-service architecture and related device
CN111683133B (en) * 2020-06-04 2023-04-28 重庆英楼维兴信息科技有限公司 Service flow limiting method based on micro-service architecture and related device
CN112738175A (en) * 2020-12-23 2021-04-30 深圳壹账通智能科技有限公司 Request processing method and related equipment
CN112738175B (en) * 2020-12-23 2022-08-23 深圳壹账通智能科技有限公司 Request processing method and related equipment
CN113114765A (en) * 2021-04-13 2021-07-13 成都九洲电子信息系统股份有限公司 Interface calling system based on reverse proxy

Also Published As

Publication number Publication date
CN109981757B (en) 2022-07-08

Similar Documents

Publication Publication Date Title
CN109981757A (en) A kind of API gateway load-balancing algorithm towards small-scale micro services framework
US11595328B2 (en) Methods, media and computing devices for implementing instant messaging system based on blockchain
US9747093B2 (en) Device driver aggregation in operating system deployment
US8140441B2 (en) Workflow management in a global support organization
US10659371B1 (en) Managing throttling limits in a distributed system
US11681757B2 (en) Similar email spam detection
WO2020244233A1 (en) Data storage method and apparatus
CN108200018B (en) Flow forwarding method and equipment, computer equipment and readable medium in cloud computing
US10666713B2 (en) Event processing
CN112953982B (en) Service processing method, service configuration method and related device
CN108234784A (en) Intelligent cloud customer service system
US20160241649A1 (en) Directory service discovery and/or learning
CN103067486B (en) Based on the large data processing method of PaaS platform
US11005718B2 (en) Determining capabilities of cognitive entities in a distributed network based on application of cognitive protocols
CN111031020B (en) Method for managing network and tenant network communication based on port mapping
EP4049425A1 (en) Email security in a multi-tenant email service
CN107086937A (en) A kind of monitoring method and equipment
US10382335B2 (en) MAC learning in a multiple virtual switch environment
CN116775167A (en) Service processing method, device, electronic equipment and computer readable medium
US20220329529A1 (en) 5g filters for virtual network functions
CN113609349A (en) Rental vehicle inventory detection method, apparatus and medium
US11100106B1 (en) Query engine virtualization
CN112583949A (en) VPC (virtual private network) public network access method and VPC equipment
US20170041262A1 (en) Prioritizing and handling of messages across multiple communication systems
US10348636B2 (en) Outbound request management

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 266100 Shandong Province, Qingdao city Laoshan District Songling Road No. 336

Applicant after: QINGDAO TGOOD ELECTRIC Co.,Ltd.

Applicant after: Telai New Energy Co.,Ltd.

Address before: 266100 Shandong Province, Qingdao city Laoshan District Songling Road No. 336

Applicant before: QINGDAO TGOOD ELECTRIC Co.,Ltd.

Applicant before: QINGDAO TELD NEW ENERGY Co.,Ltd.

CB02 Change of applicant information
TA01 Transfer of patent application right

Effective date of registration: 20200618

Address after: Room 1001, 10 / F, No. 336, Songling Road, Laoshan District, Qingdao City, Shandong Province

Applicant after: Qingdao teltel New Energy Technology Co.,Ltd.

Address before: 266100 Shandong Province, Qingdao city Laoshan District Songling Road No. 336

Applicant before: QINGDAO TGOOD ELECTRIC Co.,Ltd.

Applicant before: Telai New Energy Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant