Skip to content

DNS cache for proxying to remote server? #653

Open

Description

@Rush

While I am primarily doing proxying to localhost servers I have experimented today with proxying to a remote server and it seems DNS query is being done on every request substantially increasing the request time. Should I query the IP from DNS manually or is there a cleaner way?

Activity

  1. Rush commented on Jun 7, 2014

    @Rush
    ContributorAuthor

    On a side-note, what performance penalty should I be looking at while proxying to remote host?
    Having put my dns name to /etc/hosts I expected to see not more than 10% penalty but I what I see is:

    • Native request to remote server ~40ms
    • Request proxied through node-http-proxy with host in /etc/hosts: ~80ms
      I am measuring the time both in chrome in code from doing request to getting proxyRes.
  2. aaronmaturen commented on Dec 20, 2016

    @aaronmaturen
    Contributor

    I found that by using https://www.npmjs.com/package/dnscache I'm able to get my performance tests to external domains down to about 6ms from 40ms... with just the default settings in the readme

    const require('dnscache')
    dnscache({
       "enable" : true,
      "ttl" : 300,
      "cachesize" : 1000
    })
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions