xo::pool_remap_watchdog (private)

 xo::pool_remap_watchdog [ -maxWaiting maxWaiting ] \
    [ -maxRunning maxRunning ]

Defined in packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl

Watchdoc function to ensure liveliness of the server. This watchdog checks every minute the running jobs and maps very slow requests to the slow pool (if configured) to avoid that the default pool is getting filled up with more stuck requests. The watchdog is managed via an ad_schedule_proc started from the init-procs.

Switches:
-maxWaiting
(defaults to "10") (optional)
-maxRunning
(defaults to "100") (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::send acs_mail_lite::send (public) ad_host_administrator ad_host_administrator (public) ad_system_name ad_system_name (public) ad_system_owner ad_system_owner (public) ad_url ad_url (public) xo::pool_remap_watchdog xo::pool_remap_watchdog xo::pool_remap_watchdog->acs_mail_lite::send xo::pool_remap_watchdog->ad_host_administrator xo::pool_remap_watchdog->ad_system_name xo::pool_remap_watchdog->ad_system_owner xo::pool_remap_watchdog->ad_url

Testcases:
No testcase defined.
Source code:
    foreach s [ns_info servers] {
      #
      # Check default connection pool and remap slow request to the
      # "slow" pool when defined.
      #
      set reqs [ns_server -server $s -pool "" active]
      foreach req $reqs {
        set runtime [lindex $req end-1]
        if {$runtime >= 3.0} {
          set method [lindex $req 3]
          set url [lindex $req 4]
          ns_log notice "CALL TRY REMAP ::xo::remap_pool -runtime $runtime $method $url"
          ::xo::remap_pool -runtime $runtime $method $url
        }
      }
      #
      # Check queueing situation for every connection pool and report
      # to sysadmin when things pile up.
      #
      set message ""
      foreach pool [ns_server -server $s pools] {
        set reqs [ns_server -server $s -pool $pool active]
        set waiting [ns_server -server $s -pool $pool waiting]
        set running [llength $reqs]
        if {$waiting >= $maxWaiting || $running >= $maxRunning} {
          set threadInfo [ns_server -server $s -pool $pool threads]
          lappend threadInfo waiting $waiting
          set message ""
          append message  "Server $s on [ad_system_name]: "  "more than $maxWaiting requests are waiting "  "in connection pool '$pool' ($threadInfo)" \n  "Currently running requests:" \n  "   " [join $reqs "\n   "] \n
        }
      }
      if {$message ne ""} {
        ns_log warning $message
        try {
          #
          # Try to send a mail to the webmaster and include a link to
          # the recommended nsstats location.
          #
          acs_mail_lite::send -send_immediately  -to_addr [ad_host_administrator]  -from_addr [ad_system_owner]  -subject "High load warning on [ad_system_name]"  -body "$message\nVisit:  [ad_url]/admin/nsstats/admin/nsstats"
        } on error {errorMsg} {
          ns_log error "Could not send high-load warning: $errorMsg"
        }
      }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: