CN106302390A - A kind of method limited based on NGINX access frequency and system - Google Patents

A kind of method limited based on NGINX access frequency and system Download PDF

Info

Publication number
CN106302390A
CN106302390A CN201610600132.7A CN201610600132A CN106302390A CN 106302390 A CN106302390 A CN 106302390A CN 201610600132 A CN201610600132 A CN 201610600132A CN 106302390 A CN106302390 A CN 106302390A
Authority
CN
China
Prior art keywords
request
nginx
data base
access
limited based
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.)
Pending
Application number
CN201610600132.7A
Other languages
Chinese (zh)
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.)
Fujian Fujitsu Communication Software Co Ltd
Original Assignee
Fujian Fujitsu Communication Software 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 Fujian Fujitsu Communication Software Co Ltd filed Critical Fujian Fujitsu Communication Software Co Ltd
Priority to CN201610600132.7A priority Critical patent/CN106302390A/en
Publication of CN106302390A publication Critical patent/CN106302390A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • H04L63/1458Denial of Service

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention provides a kind of method limited based on NGINX access frequency, and user sends access request;Front-end server receives user's request, and is connected to data base;Such request current connection number s is obtained from data base;If s is less than threshold value M, then s is added 1 or flow value, and this access request is sent to back-end processing server;No, then this access request is intercepted;The present invention also provides for a kind of system limited based on NGINX access frequency so that server stress slows down.

Description

A kind of method limited based on NGINX access frequency and system
Technical field
The present invention relates to a kind of method limited based on NGINX access frequency and system.
Background technology
The most a lot of free or charge service has the restriction of access frequency, the flow control of such as three big operators System, the access times restriction etc. of Map Services.These are required for controlling number of times or the flow that user accesses, if so can have The method that a set of access frequency limits, and high concurrent (ceaselessly calculating) can be supported, can significantly alleviate the pressure of service.
Wherein, access frequency controls, in fact with regard to the addition and subtraction of somewhat similar mathematics;Such as we control this user of this service Can only access frequency be 100 times simultaneously, the most each request enters and adds 1, subtracts 1 after returning result.If by background service computing If, need the state before rollback if there is mistake, it may appear that leak or cannot be precisely controlled, and request amount is many Time, calculating the consequence caused the most frequently is exactly that service pressure increases, and the machine of delaying seriously occurs.
Summary of the invention
The technical problem to be solved in the present invention, is provide a kind of method limited based on NGINX access frequency and be System, it is simple to reduce server stress.
One of present invention is achieved in that a kind of method limited based on NGINX access frequency, comprises the steps:
Step 1, user send access request;
Step 2, front-end server receive user's request, and are connected to data base;
Step 3, from data base, obtain that such request is current connects number s;If s is less than threshold value M, then s is added 1 or flow Value, and this access request is sent to back-end processing server;No, then this access request is intercepted.
Further, described step 2 is further particularly as follows: nginx front-end server receives user's request, and passes through The lua script of nginx is connected to data base.
The two of the present invention are achieved in that a kind of system limited based on NGINX access frequency, including such as lower module:
Request module, sends access request for user;
Receiver module, receives user's request for front-end server, and is connected to data base;
Limiting module, for obtaining from data base, such request is current connects number s;If s is less than threshold value M, then s is added 1 Or flow value, and this access request is sent to back-end processing server;No, then this access request is intercepted.
Further, described receiver module is further particularly as follows: nginx front-end server receives user's request, and passes through The lua script of nginx is connected to data base.
Present invention have the advantage that a kind of method limited based on NGINX access frequency of the present invention and system, transfer to Nginx controls access frequency, reduces background service frequency and calculates.Nginx supports high concurrent, when a large amount of requests are come in, and nginx Can normally receive and calculate efficiently, greatly reduce background service pressure.
Accompanying drawing explanation
The present invention is further illustrated the most in conjunction with the embodiments.
Fig. 1 is that the inventive method performs flow chart.
Detailed description of the invention
As it is shown in figure 1, the method that the present invention limits based on NGINX access frequency, comprise the steps:
Step 1, user send access request;
Step 2, nginx front-end server receive user's request, and are connected to data base by the lua script of nginx;
Step 3, from data base, obtain that such request is current connects number s;If s is less than threshold value M, then s is added 1 or flow Value, and this access request is sent to back-end processing server;No, then this access request is intercepted.
The system that the present invention limits based on NGINX access frequency, including such as lower module:
Request module, sends access request for user;
Receiver module, nginx front-end server receives user's request, and is connected to data by the lua script of nginx Storehouse;
Limiting module, for obtaining from data base, such request is current connects number s;If s is less than threshold value M, then s is added 1 Or flow value, and this access request is sent to back-end processing server;No, then this access request is intercepted.
As it is shown in figure 1, one detailed description of the invention of the present invention:
1, user sends request request;
2, nginx receives user's request;
3, the lua script of nginx connects data base, connects number s by current for such request, and adds 1 by quantity or add upstream Amount;(if data can be stored in the data base of support by the data base that lua does not supports)
4, such request or flow rate upper limit M is obtained according to data base;
5, judge that whether the current number s that connects is more than upper limit number M;
If 6 s >=M, exceed access restriction number and intercept;
If 7 s < M, continue executing with next step;
8, nginx sends the request to back-end processing server by reverse proxy;
9, background server processes and returns result to user;
10, data base such number of request s is subtracted 1 or deduct flow value (this step is the control for concurrency, if Simple number of times can only be limited and can skip over this step).
Although the foregoing describing the detailed description of the invention of the present invention, but those familiar with the art should managing Solving, our described specific embodiment is merely exemplary rather than for the restriction to the scope of the present invention, is familiar with this The technical staff in field, in the equivalent modification made according to the spirit of the present invention and change, should be contained the present invention's In scope of the claimed protection.

Claims (4)

1. the method limited based on NGINX access frequency, it is characterised in that: comprise the steps:
Step 1, user send access request;
Step 2, front-end server receive user's request, and are connected to data base;
Step 3, from data base, obtain that such request is current connects number s;If s is less than threshold value M, then s is added 1 or flow value, and This access request is sent to back-end processing server;No, then this access request is intercepted.
A kind of method limited based on NGINX access frequency the most according to claim 1, it is characterised in that: described step 2 Further particularly as follows: nginx front-end server receives user's request, and it is connected to data base by the lua script of nginx.
3. the system limited based on NGINX access frequency, it is characterised in that: include such as lower module:
Request module, sends access request for user;
Receiver module, receives user's request for front-end server, and is connected to data base;
Limiting module, for obtaining from data base, such request is current connects number s;If s is less than threshold value M, then s is added 1 or stream Value, and this access request is sent to back-end processing server;No, then this access request is intercepted.
A kind of system limited based on NGINX access frequency, it is characterised in that: described reception mould Block is further particularly as follows: nginx front-end server receives user's request, and is connected to data base by the lua script of nginx.
CN201610600132.7A 2016-07-27 2016-07-27 A kind of method limited based on NGINX access frequency and system Pending CN106302390A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610600132.7A CN106302390A (en) 2016-07-27 2016-07-27 A kind of method limited based on NGINX access frequency and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610600132.7A CN106302390A (en) 2016-07-27 2016-07-27 A kind of method limited based on NGINX access frequency and system

Publications (1)

Publication Number Publication Date
CN106302390A true CN106302390A (en) 2017-01-04

Family

ID=57662378

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610600132.7A Pending CN106302390A (en) 2016-07-27 2016-07-27 A kind of method limited based on NGINX access frequency and system

Country Status (1)

Country Link
CN (1) CN106302390A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107800794A (en) * 2017-10-26 2018-03-13 广州市雷军游乐设备有限公司 The system for realizing platform safety stable operation
CN107888570A (en) * 2017-10-26 2018-04-06 广州市雷军游乐设备有限公司 Method, apparatus, storage medium and the system of data interaction based on front and back end separation
CN110716794A (en) * 2019-10-14 2020-01-21 网银在线(北京)科技有限公司 Information processing method, device, system and readable storage medium
CN112910947A (en) * 2020-12-31 2021-06-04 南京联创互联网技术有限公司 Lua-based high-concurrency current-limiting second killing technology

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024008A (en) * 2009-09-09 2011-04-20 浙江省电力公司 Limitation method of Web server concurrent number
CN102137165A (en) * 2011-04-22 2011-07-27 南京邮电大学 Method for realizing ARES indexing system based on peer-to-peer (P2P) network
CN102243655A (en) * 2011-06-16 2011-11-16 苏州阔地网络科技有限公司 Method and device for managing database connections
CN102915374A (en) * 2012-11-07 2013-02-06 北京搜狐新媒体信息技术有限公司 Method, device and system for controlling access to database resources
CN105281981A (en) * 2015-11-04 2016-01-27 北京百度网讯科技有限公司 Data traffic monitoring method and device for network service
CN105302692A (en) * 2015-10-28 2016-02-03 联动优势科技有限公司 Internal and external parameters based database connection pool monitoring and management method and apparatus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024008A (en) * 2009-09-09 2011-04-20 浙江省电力公司 Limitation method of Web server concurrent number
CN102137165A (en) * 2011-04-22 2011-07-27 南京邮电大学 Method for realizing ARES indexing system based on peer-to-peer (P2P) network
CN102243655A (en) * 2011-06-16 2011-11-16 苏州阔地网络科技有限公司 Method and device for managing database connections
CN102915374A (en) * 2012-11-07 2013-02-06 北京搜狐新媒体信息技术有限公司 Method, device and system for controlling access to database resources
CN105302692A (en) * 2015-10-28 2016-02-03 联动优势科技有限公司 Internal and external parameters based database connection pool monitoring and management method and apparatus
CN105281981A (en) * 2015-11-04 2016-01-27 北京百度网讯科技有限公司 Data traffic monitoring method and device for network service

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陶辉: "《深入理解Nginx模块开发与架构解析》", 30 April 2013 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107800794A (en) * 2017-10-26 2018-03-13 广州市雷军游乐设备有限公司 The system for realizing platform safety stable operation
CN107888570A (en) * 2017-10-26 2018-04-06 广州市雷军游乐设备有限公司 Method, apparatus, storage medium and the system of data interaction based on front and back end separation
CN110716794A (en) * 2019-10-14 2020-01-21 网银在线(北京)科技有限公司 Information processing method, device, system and readable storage medium
CN112910947A (en) * 2020-12-31 2021-06-04 南京联创互联网技术有限公司 Lua-based high-concurrency current-limiting second killing technology

Similar Documents

Publication Publication Date Title
CN106302390A (en) A kind of method limited based on NGINX access frequency and system
US20190191344A1 (en) Mobile edge platform servers and user equipment context migration management methods thereof
CN104599217A (en) Method and device for determining current destination of passenger
CN104850301A (en) Method and system for classifying application icons on system desktop
CN104954894B (en) A kind of video flow bootstrap technique, device and a kind of electronic equipment
CN110019496B (en) Data reading and writing method and system
CN103888281A (en) Server gray scale upgrading method and apparatus, and corresponding gray scale upgrading server
PH12019500601A1 (en) Method and apparatus for realizing communication between web page and native application, and electronic device
US20140359006A1 (en) Dynamic local function binding apparatus and method
CN105611607B (en) It realizes the method for merging multiple WiFi and realizes the method and system of WiFi connection
KR102266089B1 (en) Mec(mobile edge computing) system and control method thereof
JP2019506764A (en) System and method for obtaining, processing and updating global information
CN103916374A (en) Service gated launch method and device
CN109309943B (en) Multi-card multi-standby terminal, data card switching control method and device thereof, and storage medium
CN109933610B (en) Data processing method, device, computer equipment and storage medium
CN104572845A (en) File distribution method and device, equipment and system
CN105636007A (en) Terminating-access domain determining method and server
CN103595736B (en) Access request treating method and apparatus in video monitoring system
CN104410511B (en) A kind of server management method and system
CN106375102A (en) Service registration method, application method and correlation apparatus
CN107301084B (en) Virtual machine migration method and device of cluster server, server and storage medium
CN103607731B (en) A kind of processing method and processing device of measurement report
US20210262812A1 (en) Online ride-hailing and invoice issuing method, system and apparatus
US11265807B2 (en) Method for network sharing on a terminal, apparatus, air conditioner and storage medium
RU2016150414A (en) PREVIOUS CREDIT CONTROL

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170104