Changeset 464
- Timestamp:
- 09/01/05 20:35:10 (8 years ago)
- Location:
- trunk/pdns
- Files:
-
- 3 modified
-
configure.in (modified) (1 diff)
-
pdns/dnsreplay-mindex.cc (modified) (8 diffs)
-
pdns/pdns_recursor.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/configure.in
r445 r464 1 1 dnl intro 2 2 AC_INIT(pdns/receiver.cc) 3 AM_INIT_AUTOMAKE(pdns, 2.9.1 8)3 AM_INIT_AUTOMAKE(pdns, 2.9.19-svn) 4 4 AC_CANONICAL_HOST 5 5 AM_CONFIG_HEADER(config.h) -
trunk/pdns/pdns/dnsreplay-mindex.cc
r462 r464 31 31 #include <set> 32 32 #include <deque> 33 #include <boost/format.hpp> 33 34 #include <boost/utility.hpp> 34 35 #include <boost/multi_index_container.hpp> … … 101 102 > qids_t; 102 103 103 104 //typedef map<QuestionIdentifier, shared_ptr<QuestionData> > qids_t;105 104 qids_t qids; 106 105 107 //typedef map<uint16_t, struct QuestionIdentifier > id2qi_t; 108 //id2qi_t id2qi;109 110 unsigned int s_questions, s_ answers, s_wetimedout, s_perfect, s_mostly, s_origtimedout;106 107 bool g_throttled; 108 109 unsigned int s_questions, s_origanswers, s_weanswers, s_wetimedout, s_perfect, s_mostly, s_origtimedout; 111 110 unsigned int s_wenever, s_orignever; 112 111 unsigned int s_webetter, s_origbetter, s_norecursionavailable; … … 128 127 129 128 130 pair<unsigned int, unsigned int> WeOrigSlowQueriesDelta()129 void WeOrigSlowQueriesDelta(int& weOutstanding, int& origOutstanding, int& weSlow, int& origSlow) 131 130 { 132 131 struct timeval now; 133 132 gettimeofday(&now, 0); 134 133 135 pair<unsigned int, unsigned int> ret=make_pair(0,0); 134 weOutstanding=origOutstanding=weSlow=origSlow=0; 135 136 136 for(qids_t::iterator i=qids.begin(); i!=qids.end(); ++i) { 137 137 double dt=DiffTime(i->d_resentTime, now); 138 if(dt > 2.0) { 138 if(dt < 2.0) { 139 if(i->d_newRcode == -1) 140 weOutstanding++; 141 if(i->d_origRcode == -1) 142 origOutstanding++; 143 } 144 else { 139 145 if(i->d_newRcode == -1) { 146 weSlow++; 140 147 if(!i->d_newlate) { 141 // i->d_newlate=true;Â // error 148 QuestionData qd=*i; 149 qd.d_newlate=true; 150 qids.replace(i, qd); 151 142 152 s_wetimedout++; 143 153 } 144 ret.first++;145 154 } 146 155 if(i->d_origRcode == -1) { 156 origSlow++; 147 157 if(!i->d_origlate) { 148 158 QuestionData qd=*i; … … 152 162 s_origtimedout++; 153 163 } 154 ret.second++; 155 } 156 } 157 } 158 return ret; 164 } 165 } 166 } 159 167 } 160 168 … … 243 251 while(s_socket->recvFromAsync(packet, remote)) { 244 252 try { 253 s_weanswers++; 245 254 MOADNSParser mdp(packet.c_str(), packet.length()); 246 255 if(!mdp.d_header.qr) { … … 314 323 void houseKeeping() 315 324 { 316 pair<unsigned int, unsigned int> slows=WeOrigSlowQueriesDelta(); 325 static timeval last; 326 327 struct timeval now; 328 gettimeofday(&now, 0); 329 330 if(DiffTime(last, now) < 0.3) 331 return; 332 333 int weWaitingFor, origWaitingFor, weSlow, origSlow; 334 WeOrigSlowQueriesDelta(weWaitingFor, origWaitingFor, weSlow, origSlow); 317 335 318 int waitingFor=qids.size() - slows.first - slows.second; 319 if(waitingFor > 1000) { 320 cerr<<"Too many questions outstanding, waiting 0.25 seconds"<<endl; 321 usleep(250000); 322 } 323 324 cerr<<waitingFor<<" queries that could still come in on time, "<<qids.size()<<" outstanding"<<endl; 325 326 cerr<<"we late: "<<s_wetimedout<<", orig late: "<< s_origtimedout<<", "<<s_questions<<" questions sent, "<<s_answers 336 if(!g_throttled) { 337 if( weWaitingFor > 1000) { 338 cerr<<"Too many questions ("<<weWaitingFor<<") outstanding, throttling"<<endl; 339 g_throttled=true; 340 } 341 } 342 else if(weWaitingFor < 750) { 343 cerr<<"Unthrottling ("<<weWaitingFor<<")"<<endl; 344 g_throttled=false; 345 } 346 347 if(DiffTime(last, now) < 2) 348 return; 349 350 last=now; 351 352 /* 353 Questions - Pend. - Drop = Answers = (On time + Late) = (Err + Ok) 354 Orig 9 21 29 36 47 57 66 72 355 356 357 */ 358 359 format headerfmt ("%|9t|Questions - Pend. - Drop = Answers = (On time + Late) = (Err + Ok)\n"); 360 format datafmt("%s%|9t|%d %|21t|%d %|29t|%d %|36t|%d %|47t|%d %|57t|%d %|66t|%d %|72t|%d\n"); 361 362 363 cerr<<headerfmt; 364 cerr<<(datafmt % "Orig" % s_questions % origWaitingFor % s_orignever % s_origanswers % 0 % s_origtimedout % 0 % 0); 365 cerr<<(datafmt % "Refer." % s_questions % weWaitingFor % s_wenever % s_weanswers % 0 % s_wetimedout % 0 % 0); 366 367 368 369 cerr<<weWaitingFor<<" queries that could still come in on time, "<<qids.size()<<" outstanding"<<endl; 370 371 cerr<<"we late: "<<s_wetimedout<<", orig late: "<< s_origtimedout<<", "<<s_questions<<" questions sent, "<<s_origanswers 327 372 <<" original answers, "<<s_perfect<<" perfect, "<<s_mostly<<" mostly correct"<<", "<<s_webetter<<" we better, "<<s_origbetter<<" orig better ("<<s_origbetterset.size()<<" diff)"<<endl; 328 373 cerr<<"we never: "<<s_wenever<<", orig never: "<<s_orignever<<endl; … … 398 443 } 399 444 else { 400 s_ answers++;445 s_origanswers++; 401 446 402 447 if(qids.count(qi)) { … … 459 504 unsigned int once=0; 460 505 for(;;) { 461 if(!((once++)% 4000))506 if(!((once++)%100)) 462 507 houseKeeping(); 463 508 464 if(!pr.getUDPPacket()) 465 break; 466 467 sendPacketFromPR(pr, remote); 509 if(!g_throttled) { 510 if(!pr.getUDPPacket()) 511 break; 512 513 sendPacketFromPR(pr, remote); 514 } 515 else 516 usleep(1000); // move to 'swift poll' 517 468 518 receiveFromReference(); 469 519 } -
trunk/pdns/pdns/pdns_recursor.cc
r462 r464 504 504 arg().set("setgid","If set, change group id to this gid for more security")=""; 505 505 arg().set("setuid","If set, change user id to this uid for more security")=""; 506 arg().set("quiet","Suppress logging of questions and answers")=" off";506 arg().set("quiet","Suppress logging of questions and answers")="true"; 507 507 arg().set("config-dir","Location of configuration directory (recursor.conf)")=SYSCONFDIR; 508 508 arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR;