You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/10/27 00:43:03 UTC
svn commit: r1027765 - in /trafficserver/traffic/trunk: CHANGES
iocore/dns/DNS.cc iocore/dns/I_DNSProcessor.h proxy/mgmt2/RecordsConfig.cc
Author: zwoop
Date: Tue Oct 26 22:43:02 2010
New Revision: 1027765
URL: http://svn.apache.org/viewvc?rev=1027765&view=rev
Log:
TS-307 Add support for a dedicate DNS thread.
This is disabled by default, but can be enabled with
CONFIG proxy.config.dns.dedicated_thread INT 1
I'd imagine this is primarily useful on systems with either plenty of
physical CPUs to spare, or where there are a lot of DNS lookups (e.g.
transparent proxy quite likely). Enabling this will avoid uneven load
on the #0 net-thread.
Modified:
trafficserver/traffic/trunk/CHANGES
trafficserver/traffic/trunk/iocore/dns/DNS.cc
trafficserver/traffic/trunk/iocore/dns/I_DNSProcessor.h
trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc
Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1027765&r1=1027764&r2=1027765&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Tue Oct 26 22:43:02 2010
@@ -2,6 +2,14 @@
Changes with Apache Traffic Server 2.1.4
+ *) Experimental supoprt for a dedicated DNS thread. This can be
+ enabled with the records.config option
+
+ CONFIG proxy.config.dns.dedicated_thread INT 1
+
+ This feature is possibly useful for very busy forward or transparent
+ proxies [TS-307].
+
*) Accept threads can leak some amount of memory. This patch also
supports multiple accept threads (very experimental!) [TS-496].
Modified: trafficserver/traffic/trunk/iocore/dns/DNS.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/dns/DNS.cc?rev=1027765&r1=1027764&r2=1027765&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/dns/DNS.cc (original)
+++ trafficserver/traffic/trunk/iocore/dns/DNS.cc Tue Oct 26 22:43:02 2010
@@ -33,6 +33,7 @@
#define SRV_SERVER (RRFIXEDSZ+6)
#define SRV_FIXEDSZ (RRFIXEDSZ+6)
+EventType ET_DNS = ET_CALL;
//
// Config
@@ -50,6 +51,7 @@ int dns_ns_rr = 0;
int dns_ns_rr_init_down = 1;
char *dns_ns_list = NULL;
char *dns_resolv_conf = NULL;
+int dns_threads = 0;
DNSProcessor dnsProcessor;
ClassAllocator<DNSEntry> dnsEntryAllocator("dnsEntryAllocator");
@@ -106,9 +108,6 @@ DNSProcessor::free_hostent(HostEnt * ent
int
DNSProcessor::start(int)
{
- // Initialize the first event thread for DNS.
- dnsProcessor.thread = eventProcessor.eventthread[ET_DNS][0];
-
//
// Read configuration
//
@@ -122,9 +121,18 @@ DNSProcessor::start(int)
IOCORE_EstablishStaticConfigInt32(dns_ns_rr, "proxy.config.dns.round_robin_nameservers");
IOCORE_ReadConfigStringAlloc(dns_ns_list, "proxy.config.dns.nameservers");
IOCORE_ReadConfigStringAlloc(dns_resolv_conf, "proxy.config.dns.resolv_conf");
+ IOCORE_EstablishStaticConfigInt32(dns_threads, "proxy.config.dns.dedicated_thread");
- dns_failover_try_period = dns_timeout + 1; // Modify the "default" accordingly
+ if (dns_threads > 0) {
+ ET_DNS = eventProcessor.spawn_event_threads(dns_threads);
+ initialize_thread_for_net(eventProcessor.eventthread[ET_DNS][0], -1);
+ } else {
+ // Initialize the first event thread for DNS.
+ ET_DNS = ET_CALL;
+ }
+ dnsProcessor.thread = eventProcessor.eventthread[ET_DNS][0];
+ dns_failover_try_period = dns_timeout + 1; // Modify the "default" accordingly
dns_init();
open();
@@ -355,7 +363,7 @@ DNSHandler::open_con(unsigned int aip, i
/**
Initial state of the DNSHandler. Can reinitialize the running DNS
- hander to a new nameserver.
+ handler to a new nameserver.
*/
int
@@ -365,7 +373,7 @@ DNSHandler::startEvent(int event, Event
//
// If this is for the default server, get it
//
- Debug("dns", "DNSHandler::startEvent: on thread%d\n", e->ethread->id);
+ Debug("dns", "DNSHandler::startEvent: on thread %d\n", e->ethread->id);
if (ip == DEFAULT_DOMAIN_NAME_SERVER) {
// seems that res_init always sets m_res.nscount to at least 1!
if (!m_res->nscount)
Modified: trafficserver/traffic/trunk/iocore/dns/I_DNSProcessor.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/dns/I_DNSProcessor.h?rev=1027765&r1=1027764&r2=1027765&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/dns/I_DNSProcessor.h (original)
+++ trafficserver/traffic/trunk/iocore/dns/I_DNSProcessor.h Tue Oct 26 22:43:02 2010
@@ -65,7 +65,7 @@ struct HostEnt
}
};
-const EventType ET_DNS = ET_CALL;
+extern EventType ET_DNS;
struct DNSHandler;
Modified: trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc?rev=1027765&r1=1027764&r2=1027765&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc Tue Oct 26 22:43:02 2010
@@ -2051,6 +2051,8 @@ RecordElement RecordsConfig[] = {
,
{CONFIG, "proxy.config.dns.round_robin_nameservers", "", INK_INT, "0", RU_REREAD, RR_NULL, RC_NULL, NULL, RA_NULL}
,
+ {CONFIG, "proxy.config.dns.dedicated_thread", "", INK_INT, "0", RU_RESTART_TS, RR_NULL, RC_NULL, "[0-1]", RA_NULL}
+ ,
{PROCESS, "proxy.process.dns.total_dns_lookups", "", INK_INT, "0", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
,
{PROCESS, "proxy.process.dns.lookup_avg_time", "", INK_FLOAT, "0.00", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}