Changeset 1507
- Timestamp:
- 02/06/10 13:20:31 (3 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 3 modified
-
pdns_recursor.cc (modified) (5 diffs)
-
recursor_cache.cc (modified) (3 diffs)
-
syncres.hh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r1505 r1507 113 113 __thread MT_t* MT; // the big MTasker 114 114 115 unsigned int g_numThreads; 116 115 117 #define LOCAL_NETS "127.0.0.0/8, 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10" 116 118 … … 1057 1059 Utility::gettimeofday(&now, 0); 1058 1060 1059 if(now.tv_sec - last_prune > (time_t)( 300 + 3*t_id)) {1061 if(now.tv_sec - last_prune > (time_t)(5 + t_id)) { 1060 1062 DTime dt; 1061 1063 dt.setTimeval(now); 1062 1064 t_RC->doPrune(); // this function is local to a thread, so fine anyhow 1063 t_packetCache->doPruneTo(::arg().asNum("max-packetcache-entries") );1065 t_packetCache->doPruneTo(::arg().asNum("max-packetcache-entries") / g_numThreads); 1064 1066 1065 1067 typedef SyncRes::negcache_t::nth_index<1>::type negcache_by_ttd_index_t; … … 1108 1110 void makeThreadPipes() 1109 1111 { 1110 int numThreads = ::arg().asNum("threads"); 1111 for(int n=0; n < numThreads; ++n) { 1112 for(unsigned int n=0; n < g_numThreads; ++n) { 1112 1113 struct ThreadPipeSet tps; 1113 1114 int fd[2]; … … 1655 1656 g_maxMThreads=::arg().asNum("max-mthreads"); 1656 1657 1657 intnumThreads = ::arg().asNum("threads");1658 if( numThreads == 1) {1658 g_numThreads = ::arg().asNum("threads"); 1659 if(g_numThreads == 1) { 1659 1660 L<<Logger::Warning<<"Operating unthreaded"<<endl; 1660 1661 recursorThread(0); … … 1662 1663 else { 1663 1664 pthread_t tid; 1664 L<<Logger::Warning<<"Launching "<< numThreads <<" threads"<<endl;1665 for( int n=0; n <numThreads; ++n) {1665 L<<Logger::Warning<<"Launching "<< g_numThreads <<" threads"<<endl; 1666 for(unsigned int n=0; n < g_numThreads; ++n) { 1666 1667 pthread_create(&tid, 0, recursorThread, (void*)n); 1667 1668 } -
trunk/pdns/pdns/recursor_cache.cc
r1501 r1507 359 359 d_cachecachevalid=false; 360 360 361 unsigned int maxCached=::arg().asNum("max-cache-entries") ;361 unsigned int maxCached=::arg().asNum("max-cache-entries") / g_numThreads; 362 362 unsigned int toTrim=0; 363 363 … … 367 367 toTrim = cacheSize - maxCached; 368 368 } 369 369 370 370 // cout<<"Need to trim "<<toTrim<<" from cache to meet target!\n"; 371 371 … … 375 375 unsigned int tried=0, lookAt, erased=0; 376 376 377 // two modes - if toTrim is 0, just look through 10000records and nuke everything that is expired377 // two modes - if toTrim is 0, just look through 0.1% of all records and nuke everything that is expired 378 378 // otherwise, scan first 5*toTrim records, and stop once we've nuked enough 379 379 if(toTrim) 380 380 lookAt=5*toTrim; 381 381 else 382 lookAt=cacheSize/10; 383 382 lookAt=cacheSize/1000; 384 383 385 384 sequence_t::iterator iter=sidx.begin(), eiter; -
trunk/pdns/pdns/syncres.hh
r1505 r1507 497 497 void parseACLs(); 498 498 extern RecursorStats g_stats; 499 499 extern unsigned int g_numThreads; 500 500 501 501 template<typename Index>