CN106487945B - A kind of DNS forwarding inquiries method - Google Patents
A kind of DNS forwarding inquiries method Download PDFInfo
- Publication number
- CN106487945B CN106487945B CN201610814683.3A CN201610814683A CN106487945B CN 106487945 B CN106487945 B CN 106487945B CN 201610814683 A CN201610814683 A CN 201610814683A CN 106487945 B CN106487945 B CN 106487945B
- Authority
- CN
- China
- Prior art keywords
- socket
- resource
- resource group
- dns
- group
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/45—Network directories; Name-to-address mapping
- H04L61/4505—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
- H04L61/4511—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention proposes a kind of DNS forwarding inquiries methods comprising following steps: step 101, system initialization;Step 103 establishes n socket resource group, has N number of socket resource in each group;Step 105, the n resource group carry out DNS forwarding inquiries with cycle T rotation.It is forwarded by the present invention in that multiple queries are multiplexed the same socket, reduces and use system socket descriptor quantity in the unit time, so that greater number of inquiry can be forwarded under system process filec descriptor resource constraint;It also reduces simultaneously and establishes socket bring system call overhead, improve the forward efficiency of DNS.
Description
Technical field
The present invention relates to the field DNS more particularly to a kind of DNS forwarding inquiries methods.
Background technique
DNS (Domain Name System, domain name system), one mutually mapped on internet as domain name and IP address
A distributed data base is able to use family and more easily accesses internet, remembers can be directly read by machine without spending
IP number string.By host name, the process for finally obtaining the corresponding IP address of the host name is called domain name mapping (or host name solution
Analysis).
Forwarding capability is one of the critical function that DNS realizes inquiry.Forwarding server can turn DNS query according to specified
Hair strategy is forwarded directly to downstream recursion server, after completing this DNS recursive query by recursion server, and by query result
It is back to forwarding server, forwarding server handles query result, so that result is responded user, deposit caches or straight
Connect discarding.
With the swift and violent growth that current internet needs, the data volume of internet access is sharply increased, single dns server
Amount of access also substantially increase sharply, QPS (query rate per second) has reached million or even ten million rank.The demand of high QPS, it is meant that
Dns server will provide high-performance, the analysis software of high security, important link of the forwarding capability as DNS query, performance
Promotion it is most important to the internet demand for meeting current high access.
Traditional dns resolution software, in order to guarantee to forward port randomness, forwarding performance is constantly subjected to limit, only
It is thousands of between 10,000 QPS, be unable to satisfy the demand of high-performance dns server.To guarantee to forward port randomness, tradition side
The each DNS query of method is required to re-establish socket, and the method has following two points obviously insufficient: one, system is to process file
The limitation of descriptor resource limits forwarding inquiries per second so that creation socket quantity is restricted in the unit time significantly
Quantity.Two, the time overhead that the used system of creation socket is called, also significantly reduces forwarding performance.
Summary of the invention
The present invention is directed to the shortcomings that conventional method, proposes " socket multiplexing " technology, provides a kind of high-performance high safety
The forwarding solution of property, substantially increases forwarding performance.
The invention proposes a kind of DNS forwarding inquiries methods comprising following steps:
Step 101, system initialization;
Step 103 establishes n socket resource group, has N number of socket resource in each group;
Step 105, the n resource group carry out DNS forwarding inquiries with cycle T rotation.
Wherein, every group of socket resource group has reference count X, and it is 0 that wherein X, which is greater than or equal to 0, X initial value, works as X=0
When, it indicates to occupy socket resource without inquiry.
Wherein, step 103 includes:
Step 1031 uses first socket resource group;
Step 1033, when the 1st DNS query occurs, start timing, and create a socket descriptor, reference meter
Number plus one, is occupied first socket resource of the resource group, is forwarded using random port;
Step 1035, later DNS query of every generation, then create a socket descriptor, and reference count sequentially adds
One, and socket resource is sequentially occupied, it is forwarded using new random port.
Wherein, step 1035 further include: when the N+1 times inquiry occurs, which will be multiplexed first socket resource
Group, and reference count is added one, the inquiry occurred later is sequentially multiplexed subsequent sokcet resource.
Wherein, it under each socket resource, safeguards that a hash divides table, when generating new inquiry, which is inserted into
In this hash table, when responding packet for being successfully received downstream recursion server, corresponding query entity is quickly found, and looking into
It is deleted from hash table after inquiry.
Wherein, after one query, the socket quoting resource counting used subtracts one.
Wherein, step 105 further include: when timing reaches rotational cycle T, if first resource group has occurred and that again
With, then currently used resource group is adjusted to second resource group, be otherwise still with first resource group, and so on to
N resource group.
Wherein, step 105 further include: if timing reaches rotational cycle T again, if n-th of resource group has been sent out
Raw multiplexing, then be adjusted to first resource group for currently used resource group, otherwise still uses n-th of resource group.
Wherein, step 105 further include: if timing reaches rotational cycle T again, if be adjusted to using first
A resource group needs to judge at this time whether reference count is 0, if it is 0, creates socket descriptor, while using newly
Random port is forwarded, and is otherwise multiplexed current descriptor.
The present invention has the advantages that being multiplexed by multiple queries same due to using " socket multiplexing " technology
Socket, so that in the limitation of process file descriptor, the forwarding inquiries as much as possible within the unit time;It decreases simultaneously
Socket bring system call overhead is established, the forward efficiency of DNS is improved.
It is forwarded by the present invention in that multiple queries are multiplexed the same socket, reduces and use system in the unit time
Socket descriptor quantity, so that greater number of inquiry can be forwarded under system process filec descriptor resource constraint;Together
When also reduce establish socket bring system call overhead, improve the forward efficiency of DNS.Moreover, in order to guarantee DNS
Safety, this method opens two groups of socket resources, and carries out rotation use at the appointed time.When rotation occurs, i.e.,
The most of socket resource in socket resource group that will be come into operation has discharged, then can establish on idling-resource
New socket obtains new random port and is forwarded, to ensure that the safety of DNS.By by " socket is multiple
With " technology combines with " random port " technology, safety has been taken into account again while improving DNS forwarding performance.
Detailed description of the invention
By reading the following detailed description of the preferred embodiment, various other advantages and benefits are common for this field
Technical staff will become clear.The drawings are only for the purpose of illustrating a preferred embodiment, and is not considered as to the present invention
Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Attached drawing 1 shows the flow chart of the DNS forwarding inquiries method of embodiment according to the present invention.
Specific embodiment
The illustrative embodiments of the disclosure are more fully described below with reference to accompanying drawings.Although showing this public affairs in attached drawing
The illustrative embodiments opened, it being understood, however, that may be realized in various forms the disclosure without the reality that should be illustrated here
The mode of applying is limited.It is to be able to thoroughly understand the disclosure on the contrary, providing these embodiments, and can be by this public affairs
The range opened is fully disclosed to those skilled in the art.
The invention proposes a kind of DNS forwarding inquiries methods comprising following steps:
Step 101, system initialization;
Step 103 establishes n socket resource group, has N number of socket resource in each group, n and N are natural numbers;
Step 105, the n resource group carry out DNS forwarding inquiries with cycle T rotation.
Wherein, every group of socket resource group has reference count X, is used to indicate the X currently occupied
Socket resource, it is 0 that wherein X, which is greater than or equal to 0, X initial value, as X=0, indicates to occupy socket resource without inquiry.
Wherein, step 103 includes:
Step 1031 uses first socket resource group;
Step 1033, when the 1st DNS query occurs, start timing, and create a socket descriptor, reference meter
Number plus one, is occupied first socket resource of the resource group, is forwarded using random port;
Step 1035, later DNS query of every generation, then create a socket descriptor, and reference count sequentially adds
One, and socket resource is sequentially occupied, it is forwarded using new random port.
Wherein, step 1035 further include: when the N+1 times inquiry occurs, which will be multiplexed first socket resource
Group, and reference count is added one, the inquiry occurred later is sequentially multiplexed subsequent sokcet resource.
Wherein, it under each socket resource, safeguards that a hash divides table, when generating new inquiry, which is inserted into
In this hash table, when responding packet for being successfully received downstream recursion server, corresponding query entity is quickly found, and looking into
It is deleted from hash table after inquiry.
Wherein, after one query, the socket quoting resource counting used subtracts one.
Wherein, step 105 further include: when timing reaches rotational cycle T, if first resource group has occurred and that again
With, then currently used resource group is adjusted to second resource group, be otherwise still with first resource group, and so on to
N resource group.
Wherein, step 105 further include: if timing reaches rotational cycle T again, if n-th of resource group has been sent out
Raw multiplexing, then be adjusted to first resource group for currently used resource group, otherwise still uses n-th of resource group.
Wherein, step 105 further include: if timing reaches rotational cycle T again, if be adjusted to using first
A resource group needs to judge at this time whether reference count is 0, if it is 0, creates socket descriptor, while using newly
Random port is forwarded, and is otherwise multiplexed current descriptor.
The present invention is illustrated for using two socket resource groups below.Certain present invention simultaneously is limited to be divided into two
A resource group.
The currently used socket descriptor of each resource record in group, and safeguard reference count.When there is one
When inquiry occupies the resource, reference count adds 1, and when a poll-final, reference count subtracts 1.I.e. when reference count is greater than 1,
Illustrate there are one or more inquiry multiplexings, when being equal to 0, illustrate to occupy without inquiry, need to discharge the socket resource at this time.
It is assumed that each socket resource group includes N number of socket resource, and with the period for progress rotation use in T seconds.When being
After system initialization, resource group 1 is used first.DNS query of every generation by newly-built socket descriptor, while using newly
Random port is forwarded, and sequentially occupies socket resource, and corresponding reference count adds 1.It, should when the N+1 times inquiry occurs
First socket resource in multiplexing group 1 is increased reference count by inquiry, and the inquiry occurred later is sequentially multiplexed subsequent
Socket resource.After one query, the socket quoting resource counting used subtracts 1.It is provided simultaneously in each socket
Under source, safeguard that a hash divides table.When generating new inquiry, inquiry is inserted into this hash table, is passed convenient for being successfully received downstream
When returning server response packet, corresponding query entity is quickly found.After poll-final, it is deleted from hash table.
When the time reaching rotational cycle T, if 1 resource of group has been multiplexed, currently used resource group is adjusted to
Group 2, otherwise still using group 1.If being adjusted to group 2, application method is identical as group 1.
When such as arriving again at rotational cycle T, if 2 resources of group have been multiplexed, currently used resource group is adjusted to
Group 1, otherwise still using group 2.If being adjusted to group 1, at this time when using socket resource, whether need to judge reference numeration
It is 0, if it is 0, creates socket descriptor, while being forwarded using new random port, otherwise directly multiplexing is current
Descriptor.
By above method, when transfer amount is larger, in the unit time, a socket resource is responsible for turning for multiple queries
Hair, without in conventional method for another example, a socket resource can only forward an inquiry, while will not be as frequent such as conventional method
Creation socket is called by system, overhead has been saved, to substantially increase forward efficiency.In actual use process
In, it should be according to the resource quantity N and rotational cycle T of real network situation and application scenarios reasonable set socket resource group.It answers
So that:
The socket resource quantity summation < process file descriptor upper limit-process has used descriptor quantity
Meanwhile make as far as possible all inquiries of socket resource group RTT (Round-Trip Time, inquire two-way time) it
Be less than rotational cycle T socket descriptor may be created in idle socket resource after rotation, using it is new with
Generator terminal mouth is forwarded, and guarantees DNS security.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto,
In the technical scope disclosed by the present invention, any changes or substitutions that can be easily thought of by anyone skilled in the art,
It should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention answers the protection model with claim
Subject to enclosing.
Claims (7)
1. a kind of DNS forwarding inquiries method comprising following steps:
Step 101, system initialization;
Step 103 establishes n socket resource group, has N number of socket resource in each group;
Step 105, the n resource group carry out DNS forwarding inquiries with cycle T rotation;
Wherein every group of socket resource group has reference count X, and it is 0, as X=0, table that wherein X, which is greater than or equal to 0, X initial value,
Show and occupy socket resource without inquiry,
It is characterized in that, wherein step 103 includes:
Step 1031 uses first socket resource group;
Step 1033, when the 1st DNS query occurs, start timing, and create a socket descriptor, reference count adds
One, first socket resource of the resource group is occupied, is forwarded using random port;
Step 1035, later DNS query of every generation then create a socket descriptor, and reference count sequentially adds one, and
Socket resource is sequentially occupied, is forwarded using new random port.
2. DNS forwarding inquiries method as described in claim 1, wherein step 1035 further include: when the N+1 times inquiry occurs,
The inquiry will be multiplexed first socket resource group, and reference count is added one, and the inquiry occurred later is sequentially multiplexed subsequent
Sokcet resource.
3. DNS forwarding inquiries method as described in claim 1, wherein safeguard that a hash divides table under each socket resource,
When generating new inquiry, which is inserted into this hash table, when responding packet for being successfully received downstream recursion server, quickly
Corresponding query entity is found, and is deleted from hash table after poll-final.
4. DNS forwarding inquiries method as described in claim 1, wherein after one query, the socket resource that uses
Reference count subtracts one.
5. DNS forwarding inquiries method as described in claim 1, wherein step 105 further include: when timing reaches rotational cycle T,
If first resource group has occurred and that multiplexing, currently used resource group is adjusted to second resource group, is otherwise still
With first resource group, and so on to n-th of resource group.
6. DNS forwarding inquiries method as claimed in claim 5, wherein step 105 further include: if timing reaches rotation week again
When phase T, if n-th of resource group has occurred and that multiplexing, currently used resource group is adjusted to first resource group, otherwise still
Use n-th of resource group.
7. DNS forwarding inquiries method as claimed in claim 5, wherein step 105 further include: if timing reaches rotation week again
When phase T, if being adjusted to need to judge whether reference count is 0 at this time, if it is 0, newly using first resource group
Socket descriptor is built, while being forwarded using new random port, current descriptor is otherwise multiplexed.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610814683.3A CN106487945B (en) | 2016-09-09 | 2016-09-09 | A kind of DNS forwarding inquiries method |
PCT/CN2017/074402 WO2018045724A1 (en) | 2016-09-09 | 2017-02-22 | Dns query forwarding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610814683.3A CN106487945B (en) | 2016-09-09 | 2016-09-09 | A kind of DNS forwarding inquiries method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106487945A CN106487945A (en) | 2017-03-08 |
CN106487945B true CN106487945B (en) | 2019-05-17 |
Family
ID=58273546
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610814683.3A Active CN106487945B (en) | 2016-09-09 | 2016-09-09 | A kind of DNS forwarding inquiries method |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106487945B (en) |
WO (1) | WO2018045724A1 (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101068229A (en) * | 2007-06-08 | 2007-11-07 | 北京工业大学 | Content filtering gateway realizing method based on network filter |
CN101383690A (en) * | 2008-10-27 | 2009-03-11 | 西安交通大学 | Grid synchronization method for fault tolerant computer system based on socket |
CN101867609A (en) * | 2010-06-03 | 2010-10-20 | 中兴通讯股份有限公司 | Method for media gateway agent and device thereof |
CN102045654A (en) * | 2009-10-10 | 2011-05-04 | 上海中兴通讯技术有限责任公司 | Asynchronous socket communication method and mobile phone positioning system using same |
CN102263837A (en) * | 2011-08-10 | 2011-11-30 | 北京天融信科技有限公司 | Domain name system (DNS) analysis method and device |
CN104123385A (en) * | 2014-08-07 | 2014-10-29 | 肖龙旭 | File storage and management method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103166994A (en) * | 2011-12-14 | 2013-06-19 | 腾讯科技(深圳)有限公司 | Method and device of obtaining network data |
KR20130086408A (en) * | 2012-01-25 | 2013-08-02 | 삼성전자주식회사 | Method and apparatus for managing a http persistence socket pool of client |
CN103095608B (en) * | 2013-01-07 | 2016-06-29 | 深圳市共进电子股份有限公司 | A kind of agency retransmission method of DNS data bag |
-
2016
- 2016-09-09 CN CN201610814683.3A patent/CN106487945B/en active Active
-
2017
- 2017-02-22 WO PCT/CN2017/074402 patent/WO2018045724A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101068229A (en) * | 2007-06-08 | 2007-11-07 | 北京工业大学 | Content filtering gateway realizing method based on network filter |
CN101383690A (en) * | 2008-10-27 | 2009-03-11 | 西安交通大学 | Grid synchronization method for fault tolerant computer system based on socket |
CN102045654A (en) * | 2009-10-10 | 2011-05-04 | 上海中兴通讯技术有限责任公司 | Asynchronous socket communication method and mobile phone positioning system using same |
CN101867609A (en) * | 2010-06-03 | 2010-10-20 | 中兴通讯股份有限公司 | Method for media gateway agent and device thereof |
CN102263837A (en) * | 2011-08-10 | 2011-11-30 | 北京天融信科技有限公司 | Domain name system (DNS) analysis method and device |
CN104123385A (en) * | 2014-08-07 | 2014-10-29 | 肖龙旭 | File storage and management method |
Non-Patent Citations (1)
Title |
---|
《基于HAProxy的TCP长连接复用的研究与实现》;周少涛;《中国优秀硕士学位论文全文数据库》;20111215;第23-41页 |
Also Published As
Publication number | Publication date |
---|---|
CN106487945A (en) | 2017-03-08 |
WO2018045724A1 (en) | 2018-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105959433B (en) | A kind of domain name analytic method and its domain name analysis system | |
US10185730B2 (en) | Methods and systems for key-value-tuple-encoded storage | |
EP3427465A1 (en) | Methods and apparatus for intelligent domain name system forwarding | |
CN109983752A (en) | Network address with NS grades of information of encoding D | |
Kim et al. | Multi-source multipath HTTP (mHTTP) a proposal | |
Edmonds | ISC passive DNS architecture | |
CN1711743A (en) | Method and apparatus allowing remote access in data networks | |
WO2021155671A1 (en) | High-latency network environment robust federated learning training method and apparatus, computer device, and storage medium | |
EP2605486A1 (en) | Method and system for handling a domain name service request | |
BR112013029001B1 (en) | METHOD FOR DNS RESOLUTION OF CONTENT REQUESTS IN A CDN SERVICE | |
CN102868550B (en) | Total network flow scheduler and method for querying domain name resolution record by using total network flow scheduler | |
CN1848778A (en) | Method of monitoring progress of a signalling message and network monitoring apparatus | |
CN104702710B (en) | Port assignment method and device | |
CN104917680B (en) | For executing the computer system of the parallel hash of stream of packets | |
CN103281211B (en) | Large-scale network node system for managing in groups and management method | |
CN107547346B (en) | Message transmission method and device | |
WO2016197727A1 (en) | Data transmission method and device | |
CN104144223B (en) | A kind of data capture method and device | |
CN104506460B (en) | A kind of method for realizing the distribution of NAPT port resources | |
Yu et al. | Hardware accelerator to speed up packet processing in NDN router | |
CN104253875B (en) | A kind of DNS flow analysis methods | |
CN106487945B (en) | A kind of DNS forwarding inquiries method | |
CN110336752A (en) | A kind of method and system improving locally broadcast pushing efficiency | |
CN109413224A (en) | Message forwarding method and device | |
CN103281317A (en) | Attack testing method for SDN (software defined network) |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |